linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Add the values related to buddy system for filtering free pages
@ 2012-11-21  8:02 Atsushi Kumagai
  2012-12-07 15:08 ` Vivek Goyal
  0 siblings, 1 reply; 3+ messages in thread
From: Atsushi Kumagai @ 2012-11-21  8:02 UTC (permalink / raw)
  To: linux-kernel, kexec

This patch adds the values related to buddy system to vmcoreinfo data
so that makedumpfile (dump filtering command) can filter out all free
pages with the new logic.
It's faster than the current logic because it can distinguish free page
by analyzing page structure at the same time as filtering for other
unnecessary pages (e.g. anonymous page).
OTOH, the current logic has to trace free_list to distinguish free 
pages while analyzing page structure to filter out other unnecessary
pages.

The new logic uses the fact that buddy page is marked by _mapcount == 
PAGE_BUDDY_MAPCOUNT_VALUE. The values below are required to distinguish
it.

Required values:
  - OFFSET(page._mapcount)
  - OFFSET(page.private)
  - SIZE(pageflags)
  - NUMBER(PG_slab)
  - NUMBER(PAGE_BUDDY_MAPCOUNT_VALUE)
  
What's makedumpfile:
  makedumpfile creates a small dumpfile by excluding unnecessary pages
  for the analysis. To distinguish unnecessary pages, makedumpfile gets
  the vmcoreinfo data which has the minimum debugging information only
  for dump filtering.

Signed-off-by: Atsushi Kumagai <kumagai-atsushi@mxc.nes.nec.co.jp>
---
 include/linux/kexec.h | 3 +++
 kernel/kexec.c        | 5 +++++
 2 files changed, 8 insertions(+)

diff --git a/include/linux/kexec.h b/include/linux/kexec.h
index d0b8458..a90b148 100644
--- a/include/linux/kexec.h
+++ b/include/linux/kexec.h
@@ -158,6 +158,9 @@ unsigned long paddr_vmcoreinfo_note(void);
 #define VMCOREINFO_STRUCT_SIZE(name) \
        vmcoreinfo_append_str("SIZE(%s)=%lu\n", #name, \
                              (unsigned long)sizeof(struct name))
+#define VMCOREINFO_ENUM_SIZE(name) \
+       vmcoreinfo_append_str("SIZE(%s)=%lu\n", #name, \
+                             (unsigned long)sizeof(enum name))
 #define VMCOREINFO_OFFSET(name, field) \
        vmcoreinfo_append_str("OFFSET(%s.%s)=%lu\n", #name, #field, \
                              (unsigned long)offsetof(struct name, field))
diff --git a/kernel/kexec.c b/kernel/kexec.c
index 5e4bd78..511151b 100644
--- a/kernel/kexec.c
+++ b/kernel/kexec.c
@@ -1485,10 +1485,13 @@ static int __init crash_save_vmcoreinfo_init(void)
        VMCOREINFO_STRUCT_SIZE(zone);
        VMCOREINFO_STRUCT_SIZE(free_area);
        VMCOREINFO_STRUCT_SIZE(list_head);
+       VMCOREINFO_ENUM_SIZE(pageflags);
        VMCOREINFO_SIZE(nodemask_t);
        VMCOREINFO_OFFSET(page, flags);
        VMCOREINFO_OFFSET(page, _count);
        VMCOREINFO_OFFSET(page, mapping);
+       VMCOREINFO_OFFSET(page, _mapcount);
+       VMCOREINFO_OFFSET(page, private);
        VMCOREINFO_OFFSET(page, lru);
        VMCOREINFO_OFFSET(pglist_data, node_zones);
        VMCOREINFO_OFFSET(pglist_data, nr_zones);
@@ -1512,6 +1515,8 @@ static int __init crash_save_vmcoreinfo_init(void)
        VMCOREINFO_NUMBER(PG_lru);
        VMCOREINFO_NUMBER(PG_private);
        VMCOREINFO_NUMBER(PG_swapcache);
+       VMCOREINFO_NUMBER(PG_slab);
+       VMCOREINFO_NUMBER(PAGE_BUDDY_MAPCOUNT_VALUE);

        arch_crash_save_vmcoreinfo();
        update_vmcoreinfo_note();
--
1.7.11

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] Add the values related to buddy system for filtering free pages
  2012-11-21  8:02 [PATCH] Add the values related to buddy system for filtering free pages Atsushi Kumagai
@ 2012-12-07 15:08 ` Vivek Goyal
  2012-12-10  2:42   ` Atsushi Kumagai
  0 siblings, 1 reply; 3+ messages in thread
From: Vivek Goyal @ 2012-12-07 15:08 UTC (permalink / raw)
  To: Atsushi Kumagai; +Cc: linux-kernel, kexec

On Wed, Nov 21, 2012 at 05:02:47PM +0900, Atsushi Kumagai wrote:
> This patch adds the values related to buddy system to vmcoreinfo data
> so that makedumpfile (dump filtering command) can filter out all free
> pages with the new logic.
> It's faster than the current logic because it can distinguish free page
> by analyzing page structure at the same time as filtering for other
> unnecessary pages (e.g. anonymous page).
> OTOH, the current logic has to trace free_list to distinguish free 
> pages while analyzing page structure to filter out other unnecessary
> pages.
> 
> The new logic uses the fact that buddy page is marked by _mapcount == 
> PAGE_BUDDY_MAPCOUNT_VALUE. The values below are required to distinguish
> it.
> 
> Required values:
>   - OFFSET(page._mapcount)
>   - OFFSET(page.private)
>   - SIZE(pageflags)
>   - NUMBER(PG_slab)
>   - NUMBER(PAGE_BUDDY_MAPCOUNT_VALUE)
>   

As per your explanation, you should just need to export page._mapcount
offset and PAGE_BUDDY_MAPCOUNT_VALUE value so that you can figure out
if a page is free or not.

Why do we need rest of the three fields.

- OFFSET(page.private)
- SIZE(pageflags)
- NUMBER(PG_slab)

Thanks
Vivek

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Add the values related to buddy system for filtering free pages
  2012-12-07 15:08 ` Vivek Goyal
@ 2012-12-10  2:42   ` Atsushi Kumagai
  0 siblings, 0 replies; 3+ messages in thread
From: Atsushi Kumagai @ 2012-12-10  2:42 UTC (permalink / raw)
  To: vgoyal; +Cc: linux-kernel, kexec

Hello Vivek,

On Fri, 7 Dec 2012 10:08:05 -0500
Vivek Goyal <vgoyal@redhat.com> wrote:

> On Wed, Nov 21, 2012 at 05:02:47PM +0900, Atsushi Kumagai wrote:
> > This patch adds the values related to buddy system to vmcoreinfo data
> > so that makedumpfile (dump filtering command) can filter out all free
> > pages with the new logic.
> > It's faster than the current logic because it can distinguish free page
> > by analyzing page structure at the same time as filtering for other
> > unnecessary pages (e.g. anonymous page).
> > OTOH, the current logic has to trace free_list to distinguish free 
> > pages while analyzing page structure to filter out other unnecessary
> > pages.
> > 
> > The new logic uses the fact that buddy page is marked by _mapcount == 
> > PAGE_BUDDY_MAPCOUNT_VALUE. The values below are required to distinguish
> > it.
> > 
> > Required values:
> >   - OFFSET(page._mapcount)
> >   - OFFSET(page.private)
> >   - SIZE(pageflags)
> >   - NUMBER(PG_slab)
> >   - NUMBER(PAGE_BUDDY_MAPCOUNT_VALUE)
> >   
> 
> As per your explanation, you should just need to export page._mapcount
> offset and PAGE_BUDDY_MAPCOUNT_VALUE value so that you can figure out
> if a page is free or not.
> 
> Why do we need rest of the three fields.
> 
> - OFFSET(page.private)
> - SIZE(pageflags)
> - NUMBER(PG_slab)

Thanks for your comment.

SIZE(pageflags) is unnecessary as you said, but the other two are
certainly necessary.
I modified the description in v2 to make it clear, please see below:

  https://lkml.org/lkml/2012/12/9/138


Thanks
Atsushi Kumagai

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-12-10  2:44 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-11-21  8:02 [PATCH] Add the values related to buddy system for filtering free pages Atsushi Kumagai
2012-12-07 15:08 ` Vivek Goyal
2012-12-10  2:42   ` Atsushi Kumagai

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).