lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1196088427.4149.262.camel@johannes.berg>
Date:	Mon, 26 Nov 2007 15:47:06 +0100
From:	Johannes Berg <johannes@...solutions.net>
To:	Daniel Drake <dsd@...too.org>
Cc:	linux-kernel@...r.kernel.org, davem@...emloft.net,
	kune@...ne-taler.de
Subject: Re: [RFC] Documentation about unaligned memory access


> Sidenote: in the above example, you may wish to reorder the fields in the
> above structure so that the overall structure uses less memory. For example,
> moving field3 to sit inbetween field1 and field2 (where the padding is
> inserted) would shrink the overall structure by 1 byte:
> 
> 	struct foo {
> 		u16 field1;
> 		u8 field3;
> 		u32 field2;
> 	};

You can reorder to u32, u16, u8 order and save another byte :)

A reference to pahole could be appropriate here, and probably a small
note that some large existing structures like netdev have deliberate
holes to achieve cache alignment.

johannes

Download attachment "signature.asc" of type "application/pgp-signature" (829 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ