• Atsushi Kumagai's avatar
    kexec: add the values related to buddy system for filtering free pages. · 8d67091e
    Atsushi Kumagai authored
    tAdd 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.  But, _mapcount shares its memory with other
    fields for SLAB/SLUB when PG_slab is set, so we need to check if PG_slab
    is set or not before looking up _mapcount value.  And we can get the
    order of buddy system from private field.  To sum it up, the values
    below are required for this logic.
    
    Required values:
      - OFFSET(page._mapcount)
      - OFFSET(page.private)
      - NUMBER(PG_slab)
      - NUMBER(PAGE_BUDDY_MAPCOUNT_VALUE)
    
    Changelog from v1 to v2:
    1. remove SIZE(pageflags)
      The new logic was changed after I sent v1 patch.
      Accordingly, SIZE(pageflags) has been unnecessary for makedumpfile.
    
    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: default avatarAtsushi Kumagai <kumagai-atsushi@mxc.nes.nec.co.jp>
    Cc: "Eric W. Biederman" <ebiederm@xmission.com>
    Acked-by: default avatarVivek Goyal <vgoyal@redhat.com>
    Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
    Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
    8d67091e
kexec.c 40.4 KB