linux/fs/proc
William Cohen 97dc32cdb1 reduce size of task_struct on 64-bit machines
This past week I was playing around with that pahole tool
(http://oops.ghostprotocols.net:81/acme/dwarves/) and looking at the size
of various struct in the kernel.  I was surprised by the size of the
task_struct on x86_64, approaching 4K.  I looked through the fields in
task_struct and found that a number of them were declared as "unsigned
long" rather than "unsigned int" despite them appearing okay as 32-bit
sized fields.  On x86_64 "unsigned long" ends up being 8 bytes in size and
forces 8 byte alignment.  Is there a reason there a reason they are
"unsigned long"?

The patch below drops the size of the struct from 3808 bytes (60 64-byte
cachelines) to 3760 bytes (59 64-byte cachelines).  A couple other fields
in the task struct take a signficant amount of space:

struct thread_struct       thread;               688
struct held_lock           held_locks[30];       1680

CONFIG_LOCKDEP is turned on in the .config

[akpm@linux-foundation.org: fix printk warnings]
Cc: <linux-arch@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2007-05-08 11:14:58 -07:00
..
array.c reduce size of task_struct on 64-bit machines 2007-05-08 11:14:58 -07:00
base.c Allow access to /proc/$PID/fd after setuid() 2007-05-08 11:14:58 -07:00
generic.c [PATCH] sysctl: reimplement the sysctl proc support 2007-02-14 08:10:00 -08:00
inode-alloc.txt Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
inode.c slab allocators: Remove SLAB_DEBUG_INITIAL flag 2007-05-07 12:12:57 -07:00
internal.h [PATCH] proc: fix linkage with CONFIG_SYSCTL=y, CONFIG_PROC_SYSCTL=n 2007-04-02 10:06:08 -07:00
kcore.c [PATCH] elf: fix kcore note size calculation 2006-12-07 08:39:38 -08:00
kmsg.c [PATCH] Make most file operations structs in fs/ const 2006-03-28 09:16:06 -08:00
Makefile [PATCH] Fix kernel build with EMBEDDED & PROC_FS & !PROC_SYSCTL 2007-03-27 09:05:16 -07:00
mmu.c [PATCH] fix impossible VmallocChunk 2005-05-17 07:59:10 -07:00
nommu.c [PATCH] mark struct file_operations const 6 2007-02-12 09:48:45 -08:00
proc_devtree.c [POWERPC] Make struct property's value a void * 2007-04-13 03:55:18 +10:00
proc_misc.c mm/slab.c: proper prototypes 2007-05-07 12:12:52 -07:00
proc_sysctl.c [PATCH] sysctl: hide the sysctl proc inodes from selinux 2007-02-14 08:10:00 -08:00
proc_tty.c [PATCH] mark struct file_operations const 6 2007-02-12 09:48:45 -08:00
root.c [PATCH] proc: fix linkage with CONFIG_SYSCTL=y, CONFIG_PROC_SYSCTL=n 2007-04-02 10:06:08 -07:00
task_mmu.c smaps: add clear_refs file to clear reference 2007-05-07 12:12:52 -07:00
task_nommu.c [PATCH] mark struct file_operations const 6 2007-02-12 09:48:45 -08:00
vmcore.c [PATCH] i386: Allow i386 crash kernels to handle x86_64 dumps 2007-05-02 19:27:09 +02:00