12 Feb, 2015

1 commit

  • Page owner uses the page_ext structure to keep meta-information for every
    page in the system. The structure also contains a field of type 'struct
    stack_trace', page owner uses this field during invocation of the function
    save_stack_trace. It is easy to notice that keeping a copy of this
    structure for every page in the system is very inefficiently in terms of
    memory.

    The patch removes this unnecessary field of page_ext and forces page owner
    to use a stack_trace structure allocated on the stack.

    [akpm@linux-foundation.org: use struct initializers]
    Signed-off-by: Sergei Rogachev
    Acked-by: Joonsoo Kim
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Sergei Rogachev
     

14 Dec, 2014

2 commits

  • Extended memory to store page owner information is initialized some time
    later than that page allocator starts. Until initialization, many pages
    can be allocated and they have no owner information. This make debugging
    using page owner harder, so some fixup will be helpful.

    This patch fixes up this situation by setting fake owner information
    immediately after page extension is initialized. Information doesn't tell
    the right owner, but, at least, it can tell whether page is allocated or
    not, more correctly.

    On my testing, this patch catches 13343 early allocated pages, although
    they are mostly allocated from page extension feature. Anyway, after
    then, there is no page left that it is allocated and has no page owner
    flag.

    Signed-off-by: Joonsoo Kim
    Cc: Mel Gorman
    Cc: Johannes Weiner
    Cc: Minchan Kim
    Cc: Dave Hansen
    Cc: Michal Nazarewicz
    Cc: Jungsoo Son
    Cc: Ingo Molnar
    Cc: Joonsoo Kim
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Joonsoo Kim
     
  • This is the page owner tracking code which is introduced so far ago. It
    is resident on Andrew's tree, though, nobody tried to upstream so it
    remain as is. Our company uses this feature actively to debug memory leak
    or to find a memory hogger so I decide to upstream this feature.

    This functionality help us to know who allocates the page. When
    allocating a page, we store some information about allocation in extra
    memory. Later, if we need to know status of all pages, we can get and
    analyze it from this stored information.

    In previous version of this feature, extra memory is statically defined in
    struct page, but, in this version, extra memory is allocated outside of
    struct page. It enables us to turn on/off this feature at boottime
    without considerable memory waste.

    Although we already have tracepoint for tracing page allocation/free,
    using it to analyze page owner is rather complex. We need to enlarge the
    trace buffer for preventing overlapping until userspace program launched.
    And, launched program continually dump out the trace buffer for later
    analysis and it would change system behaviour with more possibility rather
    than just keeping it in memory, so bad for debug.

    Moreover, we can use page_owner feature further for various purposes. For
    example, we can use it for fragmentation statistics implemented in this
    patch. And, I also plan to implement some CMA failure debugging feature
    using this interface.

    I'd like to give the credit for all developers contributed this feature,
    but, it's not easy because I don't know exact history. Sorry about that.
    Below is people who has "Signed-off-by" in the patches in Andrew's tree.

    Contributor:
    Alexander Nyberg
    Mel Gorman
    Dave Hansen
    Minchan Kim
    Michal Nazarewicz
    Andrew Morton
    Jungsoo Son

    Signed-off-by: Joonsoo Kim
    Cc: Mel Gorman
    Cc: Johannes Weiner
    Cc: Minchan Kim
    Cc: Dave Hansen
    Cc: Michal Nazarewicz
    Cc: Jungsoo Son
    Cc: Ingo Molnar
    Cc: Joonsoo Kim
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Joonsoo Kim