* [PATCH] mm/buddy: dump PG_compound_lock page flag
@ 2012-05-14 10:26 Gavin Shan
2012-05-14 20:51 ` Johannes Weiner
0 siblings, 1 reply; 4+ messages in thread
From: Gavin Shan @ 2012-05-14 10:26 UTC (permalink / raw)
To: linux-mm; +Cc: hannes, akpm, Gavin Shan
The array pageflag_names[] is doing the conversion from page flag
into the corresponding names so that the meaingful string again
the corresponding page flag can be printed. The mechniasm is used
while dumping the specified page frame. However, the array missed
PG_compound_lock. So PG_compound_lock page flag would be printed
as ditigal number instead of meaningful string.
The patch fixes that and print "compound_lock" for PG_compound_lock
page flag.
Signed-off-by: Gavin Shan <shangw@linux.vnet.ibm.com>
---
mm/page_alloc.c | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 1277632..d39f253 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -5652,6 +5652,9 @@ static struct trace_print_flags pageflag_names[] = {
#ifdef CONFIG_MEMORY_FAILURE
{1UL << PG_hwpoison, "hwpoison" },
#endif
+#ifdef CONFIG_TRANSPARENT_HUGEPAGE
+ {1UL << PG_compound_lock, "compound_lock" },
+#endif
{-1UL, NULL },
};
--
1.7.5.4
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] mm/buddy: dump PG_compound_lock page flag
2012-05-14 10:26 [PATCH] mm/buddy: dump PG_compound_lock page flag Gavin Shan
@ 2012-05-14 20:51 ` Johannes Weiner
2012-05-15 9:21 ` Gavin Shan
2012-05-15 22:18 ` Andrew Morton
0 siblings, 2 replies; 4+ messages in thread
From: Johannes Weiner @ 2012-05-14 20:51 UTC (permalink / raw)
To: Gavin Shan; +Cc: linux-mm, akpm
On Mon, May 14, 2012 at 06:26:53PM +0800, Gavin Shan wrote:
> The array pageflag_names[] is doing the conversion from page flag
> into the corresponding names so that the meaingful string again
> the corresponding page flag can be printed. The mechniasm is used
> while dumping the specified page frame. However, the array missed
> PG_compound_lock. So PG_compound_lock page flag would be printed
> as ditigal number instead of meaningful string.
>
> The patch fixes that and print "compound_lock" for PG_compound_lock
> page flag.
>
> Signed-off-by: Gavin Shan <shangw@linux.vnet.ibm.com>
Acked-by: Johannes Weiner <hannes@cmpxchg.org>
This on top?
---
From: Johannes Weiner <hannes@cmpxchg.org>
Subject: [patch] mm: page_alloc: catch out-of-date list of page flag names
String tables with names of enum items are always prone to go out of
sync with the enums themselves. Ensure during compile time that the
name table of page flags has the same size as the page flags enum.
Signed-off-by: Johannes Weiner <hannes@cmpxchg.org>
---
mm/page_alloc.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 9325913..65ae58d 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -5986,6 +5986,8 @@ static void dump_page_flags(unsigned long flags)
unsigned long mask;
int i;
+ BUILD_BUG_ON(ARRAY_SIZE(pageflag_names) - 1 != __NR_PAGEFLAGS);
+
printk(KERN_ALERT "page flags: %#lx(", flags);
/* remove zone id */
--
1.7.10.1
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] mm/buddy: dump PG_compound_lock page flag
2012-05-14 20:51 ` Johannes Weiner
@ 2012-05-15 9:21 ` Gavin Shan
2012-05-15 22:18 ` Andrew Morton
1 sibling, 0 replies; 4+ messages in thread
From: Gavin Shan @ 2012-05-15 9:21 UTC (permalink / raw)
To: Johannes Weiner; +Cc: linux-mm, akpm
>> The array pageflag_names[] is doing the conversion from page flag
>> into the corresponding names so that the meaingful string again
>> the corresponding page flag can be printed. The mechniasm is used
>> while dumping the specified page frame. However, the array missed
>> PG_compound_lock. So PG_compound_lock page flag would be printed
>> as ditigal number instead of meaningful string.
>>
>> The patch fixes that and print "compound_lock" for PG_compound_lock
>> page flag.
>>
>> Signed-off-by: Gavin Shan <shangw@linux.vnet.ibm.com>
>
>Acked-by: Johannes Weiner <hannes@cmpxchg.org>
>
>This on top?
>
>---
Thanks for your time, Johannes. The check at compliling time looks good.
Thanks,
Gavin
>From: Johannes Weiner <hannes@cmpxchg.org>
>Subject: [patch] mm: page_alloc: catch out-of-date list of page flag names
>
>String tables with names of enum items are always prone to go out of
>sync with the enums themselves. Ensure during compile time that the
>name table of page flags has the same size as the page flags enum.
>
>Signed-off-by: Johannes Weiner <hannes@cmpxchg.org>
>---
> mm/page_alloc.c | 2 ++
> 1 file changed, 2 insertions(+)
>
>diff --git a/mm/page_alloc.c b/mm/page_alloc.c
>index 9325913..65ae58d 100644
>--- a/mm/page_alloc.c
>+++ b/mm/page_alloc.c
>@@ -5986,6 +5986,8 @@ static void dump_page_flags(unsigned long flags)
> unsigned long mask;
> int i;
>
>+ BUILD_BUG_ON(ARRAY_SIZE(pageflag_names) - 1 != __NR_PAGEFLAGS);
>+
> printk(KERN_ALERT "page flags: %#lx(", flags);
>
> /* remove zone id */
>--
>1.7.10.1
>
>--
>To unsubscribe, send a message with 'unsubscribe linux-mm' in
>the body to majordomo@kvack.org. For more info on Linux MM,
>see: http://www.linux-mm.org/ .
>Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
>Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
>
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] mm/buddy: dump PG_compound_lock page flag
2012-05-14 20:51 ` Johannes Weiner
2012-05-15 9:21 ` Gavin Shan
@ 2012-05-15 22:18 ` Andrew Morton
1 sibling, 0 replies; 4+ messages in thread
From: Andrew Morton @ 2012-05-15 22:18 UTC (permalink / raw)
To: Johannes Weiner; +Cc: Gavin Shan, linux-mm
On Mon, 14 May 2012 22:51:34 +0200
Johannes Weiner <hannes@cmpxchg.org> wrote:
> On Mon, May 14, 2012 at 06:26:53PM +0800, Gavin Shan wrote:
> > The array pageflag_names[] is doing the conversion from page flag
> > into the corresponding names so that the meaingful string again
> > the corresponding page flag can be printed. The mechniasm is used
> > while dumping the specified page frame. However, the array missed
> > PG_compound_lock. So PG_compound_lock page flag would be printed
> > as ditigal number instead of meaningful string.
> >
> > The patch fixes that and print "compound_lock" for PG_compound_lock
> > page flag.
> >
> > Signed-off-by: Gavin Shan <shangw@linux.vnet.ibm.com>
>
> Acked-by: Johannes Weiner <hannes@cmpxchg.org>
>
> This on top?
Can I play too?
From: Andrew Morton <akpm@linux-foundation.org>
Subject: 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: Andrew Morton <akpm@linux-foundation.org>
---
mm/page_alloc.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff -puN mm/page_alloc.c~mm-page_allocc-cleanups mm/page_alloc.c
--- a/mm/page_alloc.c~mm-page_allocc-cleanups
+++ a/mm/page_alloc.c
@@ -5934,7 +5934,7 @@ bool is_free_buddy_page(struct page *pag
}
#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" },
@@ -5972,7 +5972,6 @@ static struct trace_print_flags pageflag
#ifdef CONFIG_TRANSPARENT_HUGEPAGE
{1UL << PG_compound_lock, "compound_lock" },
#endif
- {-1UL, NULL },
};
static void dump_page_flags(unsigned long flags)
@@ -5981,14 +5980,14 @@ static void dump_page_flags(unsigned lon
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)
_
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2012-05-15 22:18 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-05-14 10:26 [PATCH] mm/buddy: dump PG_compound_lock page flag Gavin Shan
2012-05-14 20:51 ` Johannes Weiner
2012-05-15 9:21 ` Gavin Shan
2012-05-15 22:18 ` Andrew Morton
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).