Commit 51300cef authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

mm/page_alloc.c: cleanups

- make pageflag_names[] const

- remove null termination of pageflag_names[]

Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Gavin Shan <shangw@linux.vnet.ibm.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent acc50c11
...@@ -5938,7 +5938,7 @@ bool is_free_buddy_page(struct page *page) ...@@ -5938,7 +5938,7 @@ bool is_free_buddy_page(struct page *page)
} }
#endif #endif
static struct trace_print_flags pageflag_names[] = { static const struct trace_print_flags pageflag_names[] = {
{1UL << PG_locked, "locked" }, {1UL << PG_locked, "locked" },
{1UL << PG_error, "error" }, {1UL << PG_error, "error" },
{1UL << PG_referenced, "referenced" }, {1UL << PG_referenced, "referenced" },
...@@ -5976,7 +5976,6 @@ static struct trace_print_flags pageflag_names[] = { ...@@ -5976,7 +5976,6 @@ static struct trace_print_flags pageflag_names[] = {
#ifdef CONFIG_TRANSPARENT_HUGEPAGE #ifdef CONFIG_TRANSPARENT_HUGEPAGE
{1UL << PG_compound_lock, "compound_lock" }, {1UL << PG_compound_lock, "compound_lock" },
#endif #endif
{-1UL, NULL },
}; };
static void dump_page_flags(unsigned long flags) static void dump_page_flags(unsigned long flags)
...@@ -5985,14 +5984,14 @@ static void dump_page_flags(unsigned long flags) ...@@ -5985,14 +5984,14 @@ static void dump_page_flags(unsigned long flags)
unsigned long mask; unsigned long mask;
int i; int i;
BUILD_BUG_ON(ARRAY_SIZE(pageflag_names) - 1 != __NR_PAGEFLAGS); BUILD_BUG_ON(ARRAY_SIZE(pageflag_names) != __NR_PAGEFLAGS);
printk(KERN_ALERT "page flags: %#lx(", flags); printk(KERN_ALERT "page flags: %#lx(", flags);
/* remove zone id */ /* remove zone id */
flags &= (1UL << NR_PAGEFLAGS) - 1; flags &= (1UL << NR_PAGEFLAGS) - 1;
for (i = 0; pageflag_names[i].name && flags; i++) { for (i = 0; i < ARRAY_SIZE(pageflag_names) && flags; i++) {
mask = pageflag_names[i].mask; mask = pageflag_names[i].mask;
if ((flags & mask) != mask) if ((flags & mask) != mask)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment