Skip to content

Commit

Permalink
shrink struct pid by removing padding on 64 bit builds
Browse files Browse the repository at this point in the history
When struct pid is built on a 64 bit platform gcc has to insert padding to
maintain the correct alignment, by simply reordering its members the
memory usage shrinks from 88 bytes to 80.

I've successfully run with this patch on my desktop AMD64 machine.

There are no significant kernel size changes to a default config.X86_64
on the latest git v2.6.26-rc1

   text    data     bss     dec     hex filename
5404828  976760  734280 7115868  6c945c vmlinux
5404811  976760  734280 7115851  6c944b vmlinux.pid-patch

Acked-by: "Eric W. Biederman" <ebiederm@xmission.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
Richard Kennedy authored and Linus Torvalds committed Jul 25, 2008
1 parent 3ae4eed commit 33166b1
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion include/linux/pid.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,10 @@ struct upid {
struct pid
{
atomic_t count;
unsigned int level;
/* lists of tasks that use this pid */
struct hlist_head tasks[PIDTYPE_MAX];
struct rcu_head rcu;
unsigned int level;
struct upid numbers[1];
};

Expand Down

0 comments on commit 33166b1

Please sign in to comment.