From: Canjiang Lu Date: Thu, 6 Jul 2017 22:36:37 +0000 (-0700) Subject: mm/slab.c: replace open-coded round-up code with ALIGN X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=e07719502916a675023d9d31b9fd4370c7413b68;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git mm/slab.c: replace open-coded round-up code with ALIGN Link: http://lkml.kernel.org/r/20170616072918epcms5p4ff16c24ef8472b4c3b4371823cd87856@epcms5p4 Signed-off-by: Canjiang Lu Cc: Christoph Lameter Cc: Pekka Enberg Cc: David Rientjes Cc: Joonsoo Kim Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/mm/slab.c b/mm/slab.c index 2a31ee3c5814..503317188926 100644 --- a/mm/slab.c +++ b/mm/slab.c @@ -2040,17 +2040,13 @@ __kmem_cache_create (struct kmem_cache *cachep, unsigned long flags) * unaligned accesses for some archs when redzoning is used, and makes * sure any on-slab bufctl's are also correctly aligned. */ - if (size & (BYTES_PER_WORD - 1)) { - size += (BYTES_PER_WORD - 1); - size &= ~(BYTES_PER_WORD - 1); - } + size = ALIGN(size, BYTES_PER_WORD); if (flags & SLAB_RED_ZONE) { ralign = REDZONE_ALIGN; /* If redzoning, ensure that the second redzone is suitably * aligned, by adjusting the object size accordingly. */ - size += REDZONE_ALIGN - 1; - size &= ~(REDZONE_ALIGN - 1); + size = ALIGN(size, REDZONE_ALIGN); } /* 3) caller mandated alignment */