Skip to content

Commit

Permalink
mm/page_alloc.c: cleanups
Browse files Browse the repository at this point in the history
- 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: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
Andrew Morton authored and Linus Torvalds committed May 29, 2012
1 parent acc50c1 commit 51300ce
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions mm/page_alloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -5938,7 +5938,7 @@ bool is_free_buddy_page(struct page *page)
}
#endif

static struct trace_print_flags pageflag_names[] = {
static const struct trace_print_flags pageflag_names[] = {
{1UL << PG_locked, "locked" },
{1UL << PG_error, "error" },
{1UL << PG_referenced, "referenced" },
Expand Down Expand Up @@ -5976,7 +5976,6 @@ static struct trace_print_flags pageflag_names[] = {
#ifdef CONFIG_TRANSPARENT_HUGEPAGE
{1UL << PG_compound_lock, "compound_lock" },
#endif
{-1UL, NULL },
};

static void dump_page_flags(unsigned long flags)
Expand All @@ -5985,14 +5984,14 @@ static void dump_page_flags(unsigned long flags)
unsigned long mask;
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);

/* remove zone id */
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;
if ((flags & mask) != mask)
Expand Down

0 comments on commit 51300ce

Please sign in to comment.