All of lore.kernel.org
 help / color / mirror / Atom feed
* Subject: [PATCH] mm/slab: trivial change to replace round-up code with ALIGN
       [not found] <CGME20170616072918epcms5p4ff16c24ef8472b4c3b4371823cd87856@epcms5p4>
@ 2017-06-16  7:29 ` 陆灿江
  0 siblings, 0 replies; only message in thread
From: 陆灿江 @ 2017-06-16  7:29 UTC (permalink / raw)
  To: trivial
  Cc: cl, penberg, rientjes, iamjoonsoo.kim, akpm,
	杨伟杰,
	mm-commits, linux-kernel

This patch makes use of ALIGN() to remove duplicate round-up code.

Signed-off-by: Canjiang Lu <canjiang.lu@samsung.com>
---
 mm/slab.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/mm/slab.c b/mm/slab.c
index 807d86c..69e08a4 100644
--- a/mm/slab.c
+++ b/mm/slab.c
@@ -2040,17 +2040,13 @@ static bool set_on_slab_cache(struct kmem_cache *cachep,
 	 * 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 */
-- 
1.9.1

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2017-06-16  7:29 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <CGME20170616072918epcms5p4ff16c24ef8472b4c3b4371823cd87856@epcms5p4>
2017-06-16  7:29 ` Subject: [PATCH] mm/slab: trivial change to replace round-up code with ALIGN 陆灿江

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.