summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCanjiang Lu <canjiang.lu@samsung.com>2017-07-06 15:36:37 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2017-07-06 16:24:30 -0700
commite07719502916a675023d9d31b9fd4370c7413b68 (patch)
tree12b5ed516a1e09927601c4faf74820d62389ccdb
parente6d0e1dcf5f07fb04704b87ffab749589d29cb02 (diff)
downloadlinux-e07719502916a675023d9d31b9fd4370c7413b68.tar.gz
linux-e07719502916a675023d9d31b9fd4370c7413b68.tar.bz2
linux-e07719502916a675023d9d31b9fd4370c7413b68.zip
mm/slab.c: replace open-coded round-up code with ALIGN
Link: http://lkml.kernel.org/r/20170616072918epcms5p4ff16c24ef8472b4c3b4371823cd87856@epcms5p4 Signed-off-by: Canjiang Lu <canjiang.lu@samsung.com> Cc: Christoph Lameter <cl@linux.com> Cc: Pekka Enberg <penberg@kernel.org> Cc: David Rientjes <rientjes@google.com> Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--mm/slab.c8
1 files changed, 2 insertions, 6 deletions
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 */