]> git.neil.brown.name Git - history.git/commit
[PATCH] slab alignment fixes
authorAndrew Morton <akpm@osdl.org>
Mon, 26 Apr 2004 15:59:12 +0000 (08:59 -0700)
committerLinus Torvalds <torvalds@ppc970.osdl.org>
Mon, 26 Apr 2004 15:59:12 +0000 (08:59 -0700)
commitafcd93a406ce973ad480947610596f582620deb3
treed14d886d32d78e46dae582cbd498c1e448864878
parent01305153702021e4a15e9fcc26d46aa847df58fc
[PATCH] slab alignment fixes

From: Manfred Spraul <manfred@colorfullife.com>

Below is a patch that redefines the kmem_cache_alloc `align' argument:

- align not zero: use the specified alignment.  I think values smaller than
  sizeof(void*) will work, even on archs with strict alignment requirement (or
  at least: slab shouldn't crash.  Obviously the user must handle the
  alignment properly).

- align zero:
* debug on: align to sizeof(void*)
* debug off, SLAB_HWCACHE_ALIGN clear: align to sizeof(void*)
* debug off, SLAB_HWCACHE_ALIGN set: align to the smaller of
   - cache_line_size()
   - the object size, rounded up to the next power of two.
  Slab never honored cache align for tiny objects: otherwise the 32-byte
  kmalloc objects would use 128 byte objects.

There is one additional point: right now slab uses ints for the bufctls.
Using short would save two bytes for each object.  Initially I had used short,
but davem objected.  IIRC because some archs do not handle short efficiently.
Should I allow arch overrides for the bufctls?  On i386, saving two bytes
might allow a few additional anon_vma objects in each page.
mm/slab.c