Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

mm: mm_struct: remove 16 bytes of alignment padding on 64 bit builds

Reorder mm_struct to remove 16 bytes of alignment padding on 64 bit
builds. On my config this shrinks mm_struct by enough to fit in one
fewer cache lines and allows more objects per slab in mm_struct
kmem_cache under SLUB.

slabinfo before patch :-
Sizes (bytes) Slabs
--------------------------------
Object : 848 Total : 9
SlabObj: 896 Full : 2
SlabSiz: 16384 Partial: 5
Loss : 48 CpuSlab: 2
Align : 64 Objects: 18

slabinfo after :-
Sizes (bytes) Slabs
--------------------------------
Object : 832 Total : 7
SlabObj: 832 Full : 2
SlabSiz: 16384 Partial: 3
Loss : 0 CpuSlab: 2
Align : 64 Objects: 19

Signed-off-by: Richard Kennedy <richard@rsk.demon.co.uk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Richard Kennedy and committed by
Linus Torvalds
481b4bb5 cb240452

+5 -3
+5 -3
include/linux/mm_types.h
··· 237 237 atomic_t mm_users; /* How many users with user space? */ 238 238 atomic_t mm_count; /* How many references to "struct mm_struct" (users count as 1) */ 239 239 int map_count; /* number of VMAs */ 240 - struct rw_semaphore mmap_sem; 240 + 241 241 spinlock_t page_table_lock; /* Protects page tables and some counters */ 242 + struct rw_semaphore mmap_sem; 242 243 243 244 struct list_head mmlist; /* List of maybe swapped mm's. These are globally strung 244 245 * together off init_mm.mmlist, and are protected ··· 282 281 unsigned int token_priority; 283 282 unsigned int last_interval; 284 283 284 + /* How many tasks sharing this mm are OOM_DISABLE */ 285 + atomic_t oom_disable_count; 286 + 285 287 unsigned long flags; /* Must use atomic bitops to access the bits */ 286 288 287 289 struct core_state *core_state; /* coredumping support */ ··· 317 313 #ifdef CONFIG_TRANSPARENT_HUGEPAGE 318 314 pgtable_t pmd_huge_pte; /* protected by page_table_lock */ 319 315 #endif 320 - /* How many tasks sharing this mm are OOM_DISABLE */ 321 - atomic_t oom_disable_count; 322 316 }; 323 317 324 318 /* Future-safe accessor for struct mm_struct's cpu_vm_mask. */