aboutsummaryrefslogtreecommitdiffstats
path: root/mm/slob.c
diff options
context:
space:
mode:
authorChristoph Lameter <cl@linux.com>2012-11-28 11:23:16 -0500
committerPekka Enberg <penberg@kernel.org>2012-12-11 05:14:28 -0500
commit4590685546a374fb0f60682ce0e3a6fd48911d46 (patch)
tree1287ce1e1633067f8bf2cf9f93f1d6fe8a1f8908 /mm/slob.c
parent2f9baa9fcf8d0a204ca129a671d6086cc100faab (diff)
mm/sl[aou]b: Common alignment code
Extract the code to do object alignment from the allocators. Do the alignment calculations in slab_common so that the __kmem_cache_create functions of the allocators do not have to deal with alignment. Signed-off-by: Christoph Lameter <cl@linux.com> Signed-off-by: Pekka Enberg <penberg@kernel.org>
Diffstat (limited to 'mm/slob.c')
-rw-r--r--mm/slob.c10
1 files changed, 0 insertions, 10 deletions
diff --git a/mm/slob.c b/mm/slob.c
index 87e16c4d9143..795bab7d391d 100644
--- a/mm/slob.c
+++ b/mm/slob.c
@@ -123,7 +123,6 @@ static inline void clear_slob_page_free(struct page *sp)
123 123
124#define SLOB_UNIT sizeof(slob_t) 124#define SLOB_UNIT sizeof(slob_t)
125#define SLOB_UNITS(size) (((size) + SLOB_UNIT - 1)/SLOB_UNIT) 125#define SLOB_UNITS(size) (((size) + SLOB_UNIT - 1)/SLOB_UNIT)
126#define SLOB_ALIGN L1_CACHE_BYTES
127 126
128/* 127/*
129 * struct slob_rcu is inserted at the tail of allocated slob blocks, which 128 * struct slob_rcu is inserted at the tail of allocated slob blocks, which
@@ -527,20 +526,11 @@ EXPORT_SYMBOL(ksize);
527 526
528int __kmem_cache_create(struct kmem_cache *c, unsigned long flags) 527int __kmem_cache_create(struct kmem_cache *c, unsigned long flags)
529{ 528{
530 size_t align = c->size;
531
532 if (flags & SLAB_DESTROY_BY_RCU) { 529 if (flags & SLAB_DESTROY_BY_RCU) {
533 /* leave room for rcu footer at the end of object */ 530 /* leave room for rcu footer at the end of object */
534 c->size += sizeof(struct slob_rcu); 531 c->size += sizeof(struct slob_rcu);
535 } 532 }
536 c->flags = flags; 533 c->flags = flags;
537 /* ignore alignment unless it's forced */
538 c->align = (flags & SLAB_HWCACHE_ALIGN) ? SLOB_ALIGN : 0;
539 if (c->align < ARCH_SLAB_MINALIGN)
540 c->align = ARCH_SLAB_MINALIGN;
541 if (c->align < align)
542 c->align = align;
543
544 return 0; 534 return 0;
545} 535}
546 536