summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorMuchun Song <songmuchun@bytedance.com>2021-09-07 19:56:15 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2021-09-08 11:50:24 -0700
commit41c961b9013ee9b6d0491f6926df546e37964b1f (patch)
treec31916704b7e85b7d69f193983e6cc9763b5c8ac /lib
parentea0eafead4b66543b8218ebfbe14173315feb7d1 (diff)
downloadlinux-rpi-41c961b9013ee9b6d0491f6926df546e37964b1f.tar.gz
linux-rpi-41c961b9013ee9b6d0491f6926df546e37964b1f.tar.bz2
linux-rpi-41c961b9013ee9b6d0491f6926df546e37964b1f.zip
mm: introduce PAGEFLAGS_MASK to replace ((1UL << NR_PAGEFLAGS) - 1)
Instead of hard-coding ((1UL << NR_PAGEFLAGS) - 1) everywhere, introducing PAGEFLAGS_MASK to make the code clear to get the page flags. Link: https://lkml.kernel.org/r/20210819150712.59948-1-songmuchun@bytedance.com Signed-off-by: Muchun Song <songmuchun@bytedance.com> Reviewed-by: Roman Gushchin <guro@fb.com> Acked-by: Johannes Weiner <hannes@cmpxchg.org> Reviewed-by: Shakeel Butt <shakeelb@google.com> Cc: Michal Hocko <mhocko@kernel.org> Cc: Vladimir Davydov <vdavydov.dev@gmail.com> Cc: Matthew Wilcox (Oracle) <willy@infradead.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'lib')
-rw-r--r--lib/test_printf.c2
-rw-r--r--lib/vsprintf.c2
2 files changed, 2 insertions, 2 deletions
diff --git a/lib/test_printf.c b/lib/test_printf.c
index 8ac71aee46af..ec69953cf80c 100644
--- a/lib/test_printf.c
+++ b/lib/test_printf.c
@@ -614,7 +614,7 @@ page_flags_test(int section, int node, int zone, int last_cpupid,
bool append = false;
int i;
- flags &= BIT(NR_PAGEFLAGS) - 1;
+ flags &= PAGEFLAGS_MASK;
if (flags) {
page_flags |= flags;
snprintf(cmp_buf + size, BUF_SIZE - size, "%s", name);
diff --git a/lib/vsprintf.c b/lib/vsprintf.c
index 26c83943748a..cc7bdd3ac2ee 100644
--- a/lib/vsprintf.c
+++ b/lib/vsprintf.c
@@ -2019,7 +2019,7 @@ static const struct page_flags_fields pff[] = {
static
char *format_page_flags(char *buf, char *end, unsigned long flags)
{
- unsigned long main_flags = flags & (BIT(NR_PAGEFLAGS) - 1);
+ unsigned long main_flags = flags & PAGEFLAGS_MASK;
bool append = false;
int i;