25 Sep, 2019

1 commit

  • Patch series "mm: remove quicklist page table caches".

    A while ago Nicholas proposed to remove quicklist page table caches [1].

    I've rebased his patch on the curren upstream and switched ia64 and sh to
    use generic versions of PTE allocation.

    [1] https://lore.kernel.org/linux-mm/20190711030339.20892-1-npiggin@gmail.com

    This patch (of 3):

    Remove page table allocator "quicklists". These have been around for a
    long time, but have not got much traction in the last decade and are only
    used on ia64 and sh architectures.

    The numbers in the initial commit look interesting but probably don't
    apply anymore. If anybody wants to resurrect this it's in the git
    history, but it's unhelpful to have this code and divergent allocator
    behaviour for minor archs.

    Also it might be better to instead make more general improvements to page
    allocator if this is still so slow.

    Link: http://lkml.kernel.org/r/1565250728-21721-2-git-send-email-rppt@linux.ibm.com
    Signed-off-by: Nicholas Piggin
    Signed-off-by: Mike Rapoport
    Cc: Tony Luck
    Cc: Yoshinori Sato
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Nicholas Piggin
     

05 Jun, 2019

1 commit

  • Based on 1 normalized pattern(s):

    all code subject to the gpl version 2

    extracted by the scancode license scanner the SPDX license identifier

    GPL-2.0-only

    has been chosen to replace the boilerplate/reference in 1 file(s).

    Signed-off-by: Thomas Gleixner
    Reviewed-by: Armijn Hemel
    Reviewed-by: Allison Randal
    Cc: linux-spdx@vger.kernel.org
    Link: https://lkml.kernel.org/r/20190531190114.938134445@linutronix.de
    Signed-off-by: Greg Kroah-Hartman

    Thomas Gleixner
     

29 Dec, 2018

2 commits

  • Function show_mem() is used to print system memory status when user
    requires or fail to allocate memory. Generally, this is a best effort
    information so any races with memory hotplug (or very theoretically an
    early initialization) should be tolerable and the worst that could happen
    is to print an imprecise node state.

    Drop the resize lock because this is the only place which might hold the
    lock from the interrupt context and so all other callers might use a
    simple spinlock. Even though this doesn't solve any real issue it makes
    the code easier to follow and tiny more effective.

    Link: http://lkml.kernel.org/r/20181129235532.9328-1-richard.weiyang@gmail.com
    Signed-off-by: Wei Yang
    Acked-by: Michal Hocko
    Reviewed-by: Oscar Salvador
    Cc: Johannes Weiner
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Wei Yang
     
  • totalram_pages, zone->managed_pages and totalhigh_pages updates are
    protected by managed_page_count_lock, but readers never care about it.
    Convert these variables to atomic to avoid readers potentially seeing a
    store tear.

    This patch converts zone->managed_pages. Subsequent patches will convert
    totalram_panges, totalhigh_pages and eventually managed_page_count_lock
    will be removed.

    Main motivation was that managed_page_count_lock handling was complicating
    things. It was discussed in length here,
    https://lore.kernel.org/patchwork/patch/995739/#1181785 So it seemes
    better to remove the lock and convert variables to atomic, with preventing
    poteintial store-to-read tearing as a bonus.

    Link: http://lkml.kernel.org/r/1542090790-21750-3-git-send-email-arunks@codeaurora.org
    Signed-off-by: Arun KS
    Suggested-by: Michal Hocko
    Suggested-by: Vlastimil Babka
    Reviewed-by: Konstantin Khlebnikov
    Reviewed-by: David Hildenbrand
    Acked-by: Michal Hocko
    Acked-by: Vlastimil Babka
    Reviewed-by: Pavel Tatashin
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Arun KS
     

23 Feb, 2017

1 commit

  • show_mem() allows to filter out node specific data which is irrelevant
    to the allocation request via SHOW_MEM_FILTER_NODES. The filtering is
    done in skip_free_areas_node which skips all nodes which are not in the
    mems_allowed of the current process. This works most of the time as
    expected because the nodemask shouldn't be outside of the allocating
    task but there are some exceptions. E.g. memory hotplug might want to
    request allocations from outside of the allowed nodes (see
    new_node_page).

    Get rid of this hardcoded behavior and push the allocation mask down the
    show_mem path and use it instead of cpuset_current_mems_allowed. NULL
    nodemask is interpreted as cpuset_current_mems_allowed.

    [akpm@linux-foundation.org: coding-style fixes]
    Link: http://lkml.kernel.org/r/20170117091543.25850-5-mhocko@kernel.org
    Signed-off-by: Michal Hocko
    Acked-by: Mel Gorman
    Cc: Hillf Danton
    Cc: Johannes Weiner
    Cc: Vlastimil Babka
    Cc: David Rientjes
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Michal Hocko
     

09 Sep, 2015

1 commit

  • CMA reserved memory is not part of total reserved memory. Currently
    when we print the total reserve memory it considers cma as part of
    reserve memory and do minus of totalcma_pages from reserved, which is
    wrong. In cases where total reserved is less than cma reserved we will
    get negative values & while printing we print as unsigned and we will
    get a very large value.

    Below is the show mem output on X86 ubuntu based system where CMA
    reserved is 100MB (25600 pages) & total reserved is ~40MB(10316 pages).
    And reserve memory shows a large value because of this bug.

    Before:
    [ 127.066430] 898908 pages RAM
    [ 127.066432] 671682 pages HighMem/MovableOnly
    [ 127.066434] 4294952012 pages reserved
    [ 127.066436] 25600 pages cma reserved

    After:
    [ 44.663129] 898908 pages RAM
    [ 44.663130] 671682 pages HighMem/MovableOnly
    [ 44.663130] 10316 pages reserved
    [ 44.663131] 25600 pages cma reserved

    Signed-off-by: Vishnu Pratap Singh
    Cc: Michal Nazarewicz
    Cc: Marek Szyprowski
    Cc: Joonsoo Kim
    Cc: Laurent Pinchart
    Cc: Sasha Levin
    Cc: Danesh Petigara
    Cc: Laura Abbott
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Vishnu Pratap Singh
     

13 Feb, 2015

1 commit

  • show_mem.c doesn't use anything from nmi.h. Removing it yields identical
    objdump -d output for each of {allyes,allno,def}config and eliminates more
    than 100 lines in the dependency file.

    Signed-off-by: Rasmus Villemoes
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Rasmus Villemoes
     

19 Dec, 2014

1 commit

  • Add cma reserved information which is currently shown as a part of total
    reserved only. This patch is continuation of our previous cma patches
    related to this.

    https://lkml.org/lkml/2014/10/20/64
    https://lkml.org/lkml/2014/10/22/383

    [akpm@linux-foundation.org: remove hopefully-unneeded ifdefs]
    Signed-off-by: Vishnu Pratap Singh
    Cc: David Rientjes
    Cc: KOSAKI Motohiro
    Cc: Mel Gorman
    Cc: Xishi Qiu
    Cc: Pintu Kumar
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Vishnu Pratap Singh
     

03 Dec, 2014

1 commit


22 Jan, 2014

2 commits

  • Show num_poisoned_pages when oom, it is a little helpful to find the
    reason. Also it will be emitted anytime show_mem() is called.

    Signed-off-by: Xishi Qiu
    Suggested-by: Naoya Horiguchi
    Acked-by: Michal Hocko
    Acked-by: David Rientjes
    Reviewed-by: Wanpeng Li
    Acked-by: KOSAKI Motohiro
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Xishi Qiu
     
  • Commit 4b59e6c47309 ("mm, show_mem: suppress page counts in
    non-blockable contexts") introduced SHOW_MEM_FILTER_PAGE_COUNT to
    suppress PFN walks on large memory machines. Commit c78e93630d15 ("mm:
    do not walk all of system memory during show_mem") avoided a PFN walk in
    the generic show_mem helper which removes the requirement for
    SHOW_MEM_FILTER_PAGE_COUNT in that case.

    This patch removes PFN walkers from the arch-specific implementations
    that report on a per-node or per-zone granularity. ARM and unicore32
    still do a PFN walk as they report memory usage on each bank which is a
    much finer granularity where the debugging information may still be of
    use. As the remaining arches doing PFN walks have relatively small
    amounts of memory, this patch simply removes SHOW_MEM_FILTER_PAGE_COUNT.

    [akpm@linux-foundation.org: fix parisc]
    Signed-off-by: Mel Gorman
    Acked-by: David Rientjes
    Cc: Tony Luck
    Cc: Russell King
    Cc: James Bottomley
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Mel Gorman
     

13 Nov, 2013

1 commit

  • It has been reported on very large machines that show_mem is taking almost
    5 minutes to display information. This is a serious problem if there is
    an OOM storm. The bulk of the cost is in show_mem doing a very expensive
    PFN walk to give us the following information

    Total RAM: Also available as totalram_pages
    Highmem pages: Also available as totalhigh_pages
    Reserved pages: Can be inferred from the zone structure
    Shared pages: PFN walk required
    Unshared pages: PFN walk required
    Quick pages: Per-cpu walk required

    Only the shared/unshared pages requires a full PFN walk but that
    information is useless. It is also inaccurate as page pins of unshared
    pages would be accounted for as shared. Even if the information was
    accurate, I'm struggling to think how the shared/unshared information
    could be useful for debugging OOM conditions. Maybe it was useful before
    rmap existed when reclaiming shared pages was costly but it is less
    relevant today.

    The PFN walk could be optimised a bit but why bother as the information is
    useless. This patch deletes the PFN walker and infers the total RAM,
    highmem and reserved pages count from struct zone. It omits the
    shared/unshared page usage on the grounds that it is useless. It also
    corrects the reporting of HighMem as HighMem/MovableOnly as ZONE_MOVABLE
    has similar problems to HighMem with respect to lowmem/highmem exhaustion.

    Signed-off-by: Mel Gorman
    Cc: David Rientjes
    Acked-by: KOSAKI Motohiro
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Mel Gorman
     

30 Apr, 2013

1 commit

  • On large systems with a lot of memory, walking all RAM to determine page
    types may take a half second or even more.

    In non-blockable contexts, the page allocator will emit a page allocation
    failure warning unless __GFP_NOWARN is specified. In such contexts, irqs
    are typically disabled and such a lengthy delay may even result in NMI
    watchdog timeouts.

    To fix this, suppress the page walk in such contexts when printing the
    page allocation failure warning.

    Signed-off-by: David Rientjes
    Cc: Mel Gorman
    Acked-by: Michal Hocko
    Cc: Dave Hansen
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    David Rientjes
     

25 May, 2011

1 commit

  • Architectures that implement their own show_mem() function did not pass
    the filter argument to show_free_areas() to appropriately avoid emitting
    the state of nodes that are disallowed in the current context. This patch
    now passes the filter argument to show_free_areas() so those nodes are now
    avoided.

    This patch also removes the show_free_areas() wrapper around
    __show_free_areas() and converts existing callers to pass an empty filter.

    ia64 emits additional information for each node, so skip_free_areas_zone()
    must be made global to filter disallowed nodes and it is converted to use
    a nid argument rather than a zone for this use case.

    Signed-off-by: David Rientjes
    Cc: Russell King
    Cc: Tony Luck
    Cc: Fenghua Yu
    Cc: Kyle McMartin
    Cc: Helge Deller
    Cc: James Bottomley
    Cc: "David S. Miller"
    Cc: Guan Xuetao
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    David Rientjes
     

25 Mar, 2011

1 commit

  • Commit ddd588b5dd55 ("oom: suppress nodes that are not allowed from
    meminfo on oom kill") moved lib/show_mem.o out of lib/lib.a, which
    resulted in build warnings on all architectures that implement their own
    versions of show_mem():

    lib/lib.a(show_mem.o): In function `show_mem':
    show_mem.c:(.text+0x1f4): multiple definition of `show_mem'
    arch/sparc/mm/built-in.o:(.text+0xd70): first defined here

    The fix is to remove __show_mem() and add its argument to show_mem() in
    all implementations to prevent this breakage.

    Architectures that implement their own show_mem() actually don't do
    anything with the argument yet, but they could be made to filter nodes
    that aren't allowed in the current context in the future just like the
    generic implementation.

    Reported-by: Stephen Rothwell
    Reported-by: James Bottomley
    Suggested-by: Andrew Morton
    Signed-off-by: David Rientjes
    Signed-off-by: Linus Torvalds

    David Rientjes
     

23 Mar, 2011

1 commit

  • The oom killer is extremely verbose for machines with a large number of
    cpus and/or nodes. This verbosity can often be harmful if it causes other
    important messages to be scrolled from the kernel log and incurs a
    signicant time delay, specifically for kernels with CONFIG_NODES_SHIFT >
    8.

    This patch causes only memory information to be displayed for nodes that
    are allowed by current's cpuset when dumping the VM state. Information
    for all other nodes is irrelevant to the oom condition; we don't care if
    there's an abundance of memory elsewhere if we can't access it.

    This only affects the behavior of dumping memory information when an oom
    is triggered. Other dumps, such as for sysrq+m, still display the
    unfiltered form when using the existing show_mem() interface.

    Additionally, the per-cpu pageset statistics are extremely verbose in oom
    killer output, so it is now suppressed. This removes

    nodes_weight(current->mems_allowed) * (1 + nr_cpus)

    lines from the oom killer output.

    Callers may use __show_mem(SHOW_MEM_FILTER_NODES) to filter disallowed
    nodes.

    Signed-off-by: David Rientjes
    Cc: Mel Gorman
    Cc: KAMEZAWA Hiroyuki
    Cc: KOSAKI Motohiro
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    David Rientjes
     

07 Mar, 2010

1 commit


27 Jul, 2008

1 commit

  • This implements a platform-independent version of show_mem().

    Signed-off-by: Johannes Weiner
    Cc: Richard Henderson
    Cc: Ivan Kokshaysky
    Cc: Haavard Skinnemoen
    Cc: Bryan Wu
    Cc: Chris Zankel
    Cc: Ingo Molnar
    Cc: Jeff Dike
    Cc: David S. Miller
    Cc: Paul Mundt
    Cc: Heiko Carstens
    Cc: Martin Schwidefsky
    Cc: David Howells
    Cc: Benjamin Herrenschmidt
    Cc: Paul Mackerras
    Cc: Yoshinori Sato
    Cc: Ralf Baechle
    Cc: Greg Ungerer
    Cc: Geert Uytterhoeven
    Cc: Roman Zippel
    Cc: Hirokazu Takata
    Cc: Mikael Starvik
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Johannes Weiner