]> git.baikalelectronics.ru Git - kernel.git/commitdiff
mm/mempolicy: use PAGE_ALIGN instead of open-coding it
authorze zuo <zuoze1@huawei.com>
Tue, 13 Sep 2022 01:55:05 +0000 (01:55 +0000)
committerAndrew Morton <akpm@linux-foundation.org>
Mon, 3 Oct 2022 21:03:15 +0000 (14:03 -0700)
Replace the simple calculation with PAGE_ALIGN.

Link: https://lkml.kernel.org/r/20220913015505.1998958-1-zuoze1@huawei.com
Signed-off-by: ze zuo <zuoze1@huawei.com>
Reviewed-by: Muchun Song <songmuchun@bytedance.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
mm/mempolicy.c

index 143e2eaaa6ec54d149092906fa6fdb020176c56f..a937eaec5b68d82ff830b11faf46be17e2211fcf 100644 (file)
@@ -1270,7 +1270,7 @@ static long do_mbind(unsigned long start, unsigned long len,
        if (mode == MPOL_DEFAULT)
                flags &= ~MPOL_MF_STRICT;
 
-       len = (len + PAGE_SIZE - 1) & PAGE_MASK;
+       len = PAGE_ALIGN(len);
        end = start + len;
 
        if (end < start)
@@ -1507,7 +1507,7 @@ SYSCALL_DEFINE4(set_mempolicy_home_node, unsigned long, start, unsigned long, le
        if (home_node >= MAX_NUMNODES || !node_online(home_node))
                return -EINVAL;
 
-       len = (len + PAGE_SIZE - 1) & PAGE_MASK;
+       len = PAGE_ALIGN(len);
        end = start + len;
 
        if (end < start)