29 Apr, 2020

1 commit

  • commit cf01699ee220c38099eb3e43ce3d10690c8b7060 upstream.

    Commit 7ed1c1901fe5 ("tools: fix cross-compile var clobbering") moved
    the setup of the CC variable to tools/scripts/Makefile.include to make
    the behavior consistent across all the tools Makefiles.

    As the vm tools missed the include we end up with the wrong CC in a
    cross-compiling evironment.

    Fixes: 7ed1c1901fe5 (tools: fix cross-compile var clobbering)
    Signed-off-by: Lucas Stach
    Signed-off-by: Andrew Morton
    Cc: Martin Kelly
    Cc:
    Link: http://lkml.kernel.org/r/20200416104748.25243-1-l.stach@pengutronix.de
    Signed-off-by: Linus Torvalds
    Signed-off-by: Greg Kroah-Hartman

    Lucas Stach
     

13 Jul, 2019

4 commits

  • Passing more than one sorting option has undefined behaviour.

    Add an explicit statement as such to the help menu, this also has the
    advantage of highlighting all the sorting options.

    Link: http://lkml.kernel.org/r/20190426022622.4089-5-tobin@kernel.org
    Signed-off-by: Tobin C. Harding
    Cc: Alexander Duyck
    Cc: Brendan Gregg ,
    Cc: Christoph Lameter
    Cc: David Rientjes
    Cc: Jesper Dangaard Brouer
    Cc: Joonsoo Kim
    Cc: Mel Gorman
    Cc: Michal Hocko
    Cc: Pekka Enberg
    Cc: Qian Cai
    Cc: Tejun Heo
    Cc: Vlastimil Babka
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Tobin C. Harding
     
  • We would like to get a better view of the level of fragmentation within
    the SLUB allocator. Total number of partial slabs is an indicator of
    fragmentation.

    Add a command line option (-P | --partial) to sort the slab list by total
    number of partial slabs.

    Link: http://lkml.kernel.org/r/20190426022622.4089-4-tobin@kernel.org
    Signed-off-by: Tobin C. Harding
    Cc: Alexander Duyck
    Cc: Brendan Gregg ,
    Cc: Christoph Lameter
    Cc: David Rientjes
    Cc: Jesper Dangaard Brouer
    Cc: Joonsoo Kim
    Cc: Mel Gorman
    Cc: Michal Hocko
    Cc: Pekka Enberg
    Cc: Qian Cai
    Cc: Tejun Heo
    Cc: Vlastimil Babka
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Tobin C. Harding
     
  • We would like to see how fragmented the SLUB allocator is, one window into
    fragmentation is the total number of partial slabs.

    Currently `slabinfo -X` shows slabs sorted by loss and by size. We can
    use this option to also show slabs sorted by number of partial slabs.

    Option '-X' can be used in conjunction with '-N' to control the number of
    slabs shown e.g. list of top 5 slabs:

    slabinfo -X -N5

    Add list of slabs ordered by number of partial slabs to output of
    `slabinfo -X`.

    Link: http://lkml.kernel.org/r/20190426022622.4089-3-tobin@kernel.org
    Signed-off-by: Tobin C. Harding
    Cc: Alexander Duyck
    Cc: Brendan Gregg ,
    Cc: Christoph Lameter
    Cc: David Rientjes
    Cc: Jesper Dangaard Brouer
    Cc: Joonsoo Kim
    Cc: Mel Gorman
    Cc: Michal Hocko
    Cc: Pekka Enberg
    Cc: Qian Cai
    Cc: Tejun Heo
    Cc: Vlastimil Babka
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Tobin C. Harding
     
  • During recent discussion on LKML over SLAB vs SLUB it was suggested by
    Jesper that it would be nice to have a tool to view the current
    fragmentation of the slab allocators. CC list for this set is taken
    from that thread.

    For SLUB we have all the information for this already exposed by the
    kernel and also we have a userspace tool for displaying this info:

    tools/vm/slabinfo.c

    Extend slabinfo to improve the fragmentation information by enabling
    sorting of caches by number of partial slabs.

    Also add cache list sorted in this manner to the output of `slabinfo -X`.

    This patch (of 4):

    get_opt() has a spurious character within the option string. Remove it
    and reorder the options in alphabetic order so that it is easier to keep
    the options correct. Use the same ordering for command help output and
    long option handling code.

    Link: http://lkml.kernel.org/r/20190426022622.4089-2-tobin@kernel.org
    Signed-off-by: Tobin C. Harding
    Cc: Jesper Dangaard Brouer
    Cc: Pekka Enberg
    Cc: Vlastimil Babka
    Cc: Christoph Lameter
    Cc: David Rientjes
    Cc: Joonsoo Kim
    Cc: Tejun Heo
    Cc: Qian Cai
    Cc: Mel Gorman
    Cc: Alexander Duyck
    Cc: Michal Hocko
    Cc: Brendan Gregg ,
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Tobin C. Harding
     

05 Jun, 2019

2 commits

  • Based on 1 normalized pattern(s):

    this software is licensed under the terms of the gnu general public
    license version 2 as published by the free software foundation and
    may be copied distributed and modified under those terms this
    program is distributed in the hope that it will be useful but
    without any warranty without even the implied warranty of
    merchantability or fitness for a particular purpose see the gnu
    general public license for more details

    extracted by the scancode license scanner the SPDX license identifier

    GPL-2.0-only

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

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

    Thomas Gleixner
     
  • Based on 1 normalized pattern(s):

    this program is free software you can redistribute it and or modify
    it under the terms of the gnu general public license as published by
    the free software foundation version 2 this program is distributed
    in the hope that it will be useful but without any warranty without
    even the implied warranty of merchantability or fitness for a
    particular purpose see the gnu general public license for more
    details you should find a copy of v2 of the gnu general public
    license somewhere on your linux system if not write to the free
    software foundation inc 59 temple place suite 330 boston ma 02111
    1307 usa

    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: Allison Randal
    Reviewed-by: Alexios Zavras
    Cc: linux-spdx@vger.kernel.org
    Link: https://lkml.kernel.org/r/20190529141900.073926682@linutronix.de
    Signed-off-by: Greg Kroah-Hartman

    Thomas Gleixner
     

06 Mar, 2019

5 commits

  • Attempt to make the usage comment for debug options a little cleaner.

    Link: http://lkml.kernel.org/r/20190212001219.27769-5-tobin@kernel.org
    Signed-off-by: Tobin C. Harding
    Acked-by: Christoph Lameter
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Tobin C. Harding
     
  • Usage message uses spaces not tabspaces, a few tabspaces have snuck in
    making the columns not align correctly when output.

    Align usage output columns using spaces instead of tabspaces.

    Link: http://lkml.kernel.org/r/20190212001219.27769-4-tobin@kernel.org
    Signed-off-by: Tobin C. Harding
    Acked-by: Christoph Lameter
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Tobin C. Harding
     
  • Primarily the usage message lists options in alphabetic order however
    there are a bunch of the options that are not in alphabetic order.

    Put options in alphabetic order.

    Link: http://lkml.kernel.org/r/20190212001219.27769-3-tobin@kernel.org
    Signed-off-by: Tobin C. Harding
    Acked-by: Christoph Lameter
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Tobin C. Harding
     
  • Currently usage message list only a subset of the available options.
    should list them all.

    Update options in usage massage to include all available options.

    Link: http://lkml.kernel.org/r/20190212001219.27769-2-tobin@kernel.org
    Signed-off-by: Tobin C. Harding
    Acked-by: Christoph Lameter
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Tobin C. Harding
     
  • PG_balloon was introduced to implement page migration/compaction for
    pages inflated in virtio-balloon. Nowadays, it is only a marker that a
    page is part of virtio-balloon and therefore logically offline.

    We also want to make use of this flag in other balloon drivers - for
    inflated pages or when onlining a section but keeping some pages offline
    (e.g. used right now by XEN and Hyper-V via set_online_page_callback()).

    We are going to expose this flag to dump tools like makedumpfile. But
    instead of exposing PG_balloon, let's generalize the concept of marking
    pages as logically offline, so it can be reused for other purposes later
    on.

    Rename PG_balloon to PG_offline. This is an indicator that the page is
    logically offline, the content stale and that it should not be touched
    (e.g. a hypervisor would have to allocate backing storage in order for
    the guest to dump an unused page). We can then e.g. exclude such pages
    from dumps.

    We replace and reuse KPF_BALLOON (23), as this shouldn't really harm
    (and for now the semantics stay the same). In following patches, we
    will make use of this bit also in other balloon drivers. While at it,
    document PGTABLE.

    [akpm@linux-foundation.org: fix comment text, per David]
    Link: http://lkml.kernel.org/r/20181119101616.8901-3-david@redhat.com
    Signed-off-by: David Hildenbrand
    Acked-by: Konstantin Khlebnikov
    Acked-by: Michael S. Tsirkin
    Acked-by: Pankaj gupta
    Cc: Jonathan Corbet
    Cc: Alexey Dobriyan
    Cc: Mike Rapoport
    Cc: Christian Hansen
    Cc: Vlastimil Babka
    Cc: "Kirill A. Shutemov"
    Cc: Stephen Rothwell
    Cc: Matthew Wilcox
    Cc: Michal Hocko
    Cc: Pavel Tatashin
    Cc: Alexander Duyck
    Cc: Naoya Horiguchi
    Cc: Miles Chen
    Cc: David Rientjes
    Cc: Kazuhito Hagio
    Cc: Arnd Bergmann
    Cc: Baoquan He
    Cc: Borislav Petkov
    Cc: Boris Ostrovsky
    Cc: Dave Young
    Cc: Greg Kroah-Hartman
    Cc: Haiyang Zhang
    Cc: Juergen Gross
    Cc: Julien Freche
    Cc: Kairui Song
    Cc: "K. Y. Srinivasan"
    Cc: Len Brown
    Cc: Lianbo Jiang
    Cc: Michal Hocko
    Cc: Nadav Amit
    Cc: Omar Sandoval
    Cc: Pavel Machek
    Cc: Rafael J. Wysocki
    Cc: "Rafael J. Wysocki"
    Cc: Stefano Stabellini
    Cc: Stephen Hemminger
    Cc: Vitaly Kuznetsov
    Cc: Xavier Deguillard
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    David Hildenbrand
     

09 Jan, 2019

1 commit

  • The example in comment does not useable because the output binary is
    named "page_owner_sort", not "sort".

    Also add a reference to Documentation/vm/page_owner.rst

    Link: http://lkml.kernel.org/r/1546515361-8317-1-git-send-email-miles.chen@mediatek.com
    Signed-off-by: Miles Chen
    Reviewed-by: Andrew Morton
    Cc: Joonsoo Kim
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Miles Chen
     

29 Dec, 2018

1 commit

  • Because kpagecount_read() fakes success if map counts are not being
    collected, clamp the page count passed to it by walk_pfn() to the pages
    value returned by the preceding call to kpageflags_read().

    Link: http://lkml.kernel.org/r/1543962269-26116-1-git-send-email-anthony.yznaga@oracle.com
    Fixes: 7f1d23e60718 ("tools/vm/page-types.c: include shared map counts")
    Signed-off-by: Anthony Yznaga
    Reviewed-by: Naoya Horiguchi
    Cc: Vlastimil Babka
    Cc: Matthew Wilcox
    Cc: David Rientjes
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Anthony Yznaga
     

05 Sep, 2018

2 commits

  • debugfs_known_mountpoints[] is not used any more, so let's remove it.

    Link: http://lkml.kernel.org/r/1535102651-19418-1-git-send-email-n-horiguchi@ah.jp.nec.com
    Signed-off-by: Naoya Horiguchi
    Reviewed-by: Andrew Morton
    Cc: Matthew Wilcox
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Naoya Horiguchi
     
  • Currently we get the following compiler warning:

    slabinfo.c:854:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    if (s->object_size < min_objsize)
    ^

    due to the mismatch of signed/unsigned comparison. ->object_size and
    ->slab_size are never expected to be negative, so let's define them as
    unsigned int.

    [n-horiguchi@ah.jp.nec.com: convert everything - none of these can be negative]
    Link: http://lkml.kernel.org/r/20180826234947.GA9787@hori1.linux.bs1.fc.nec.co.jp
    Link: http://lkml.kernel.org/r/1535103134-20239-1-git-send-email-n-horiguchi@ah.jp.nec.com
    Signed-off-by: Naoya Horiguchi
    Reviewed-by: Andrew Morton
    Cc: Matthew Wilcox
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Naoya Horiguchi
     

18 Aug, 2018

2 commits

  • Add a flag which causes page-types to use the kernels's idle page
    tracking to mark pages idle. As the tool already prints the idle flag
    if set, subsequent runs will show which pages have been accessed since
    last run.

    [akpm@linux-foundation.org: simplify mark_page_idle()]
    [chansen3@cisco.com: reorganize mark_page_idle() logic, add docs]
    Link: http://lkml.kernel.org/r/20180706172237.21691-1-chansen3@cisco.com
    Link: http://lkml.kernel.org/r/20180612153223.13174-1-chansen3@cisco.com
    Signed-off-by: Christian Hansen
    Reviewed-by: Andrew Morton
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Christian Hansen
     
  • Add a new flag that will read kpagecount for each PFN and print out the
    number of times the page is mapped along with the flags in the listing
    view.

    This information is useful in understanding and optimizing memory usage.
    Identifying pages which are not shared allows us to focus on adjusting
    the memory layout or access patterns for the sole owning process.
    Knowing the number of processes that share a page tells us how many
    other times we must make the same adjustments or how many processes to
    potentially disable.

    Truncated sample output:

    voffset map-cnt offset len flags
    561a3591e 1 15fe8 1 ___U_lA____Ma_b___________________________
    561a3591f 1 2b103 1 ___U_lA____Ma_b___________________________
    561a36ca4 1 2cc78 1 ___U_lA____Ma_b___________________________
    7f588bb4e 14 2273c 1 __RU_lA____M______________________________

    [akpm@linux-foundation.org: coding-style fixes]
    [chansen3@cisco.com: add documentation, tweak whitespace]
    Link: http://lkml.kernel.org/r/20180705181204.5529-1-chansen3@cisco.com
    Link: http://lkml.kernel.org/r/20180612153205.12879-1-chansen3@cisco.com
    Signed-off-by: Christian Hansen
    Reviewed-by: Andrew Morton
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Christian Hansen
     

08 Jun, 2018

1 commit

  • Define a new PageTable bit in the page_type and use it to mark pages in
    use as page tables. This can be helpful when debugging crashdumps or
    analysing memory fragmentation. Add a KPF flag to report these pages to
    userspace and update page-types.c to interpret that flag.

    Note that only pages currently accounted as NR_PAGETABLES are tracked as
    PageTable; this does not include pgd/p4d/pud/pmd pages. Those will be the
    subject of a later patch.

    Link: http://lkml.kernel.org/r/20180518194519.3820-4-willy@infradead.org
    Signed-off-by: Matthew Wilcox
    Acked-by: Kirill A. Shutemov
    Acked-by: Vlastimil Babka
    Cc: Christoph Lameter
    Cc: Dave Hansen
    Cc: Jérôme Glisse
    Cc: Lai Jiangshan
    Cc: Martin Schwidefsky
    Cc: Pekka Enberg
    Cc: Randy Dunlap
    Cc: Andrey Ryabinin
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Matthew Wilcox
     

22 Feb, 2018

1 commit

  • Currently a number of Makefiles break when used with toolchains that
    pass extra flags in CC and other cross-compile related variables (such
    as --sysroot).

    Thus we get this error when we use a toolchain that puts --sysroot in
    the CC var:

    ~/src/linux/tools$ make iio
    [snip]
    iio_event_monitor.c:18:10: fatal error: unistd.h: No such file or directory
    #include
    ^~~~~~~~~~

    This occurs because we clobber several env vars related to
    cross-compiling with lines like this:

    CC = $(CROSS_COMPILE)gcc

    Although this will point to a valid cross-compiler, we lose any extra
    flags that might exist in the CC variable, which can break toolchains
    that rely on them (for example, those that use --sysroot).

    This easily shows up using a Yocto SDK:

    $ . [snip]/sdk/environment-setup-cortexa8hf-neon-poky-linux-gnueabi

    $ echo $CC
    arm-poky-linux-gnueabi-gcc -march=armv7-a -mfpu=neon -mfloat-abi=hard
    -mcpu=cortex-a8
    --sysroot=[snip]/sdk/sysroots/cortexa8hf-neon-poky-linux-gnueabi

    $ echo $CROSS_COMPILE
    arm-poky-linux-gnueabi-

    $ echo ${CROSS_COMPILE}gcc
    krm-poky-linux-gnueabi-gcc

    Although arm-poky-linux-gnueabi-gcc is a cross-compiler, we've lost the
    --sysroot and other flags that enable us to find the right libraries to
    link against, so we can't find unistd.h and other libraries and headers.
    Normally with the --sysroot flag we would find unistd.h in the sdk
    directory in the sysroot:

    $ find [snip]/sdk/sysroots -path '*/usr/include/unistd.h'
    [snip]/sdk/sysroots/cortexa8hf-neon-poky-linux-gnueabi/usr/include/unistd.h

    The perf Makefile adds CC = $(CROSS_COMPILE)gcc if and only if CC is not
    already set, and it compiles correctly with the above toolchain.

    So, generalize the logic that perf uses in the common Makefile and
    remove the manual CC = $(CROSS_COMPILE)gcc lines from each Makefile.

    Note that this patch does not fix cross-compile for all the tools (some
    have other bugs), but it does fix it for all except usb and acpi, which
    still have other unrelated issues.

    I tested both with and without the patch on native and cross-build and
    there appear to be no regressions.

    Link: http://lkml.kernel.org/r/20180107214028.23771-1-martin@martingkelly.com
    Signed-off-by: Martin Kelly
    Acked-by: Mark Brown
    Cc: Tejun Heo
    Cc: Li Zefan
    Cc: Johannes Weiner
    Cc: Linus Walleij
    Cc: "K. Y. Srinivasan"
    Cc: Haiyang Zhang
    Cc: Stephen Hemminger
    Cc: Jonathan Cameron
    Cc: Pali Rohar
    Cc: Richard Purdie
    Cc: Jacek Anaszewski
    Cc: Pavel Machek
    Cc: Peter Zijlstra
    Cc: Ingo Molnar
    Cc: Arnaldo Carvalho de Melo
    Cc: Robert Moore
    Cc: Lv Zheng
    Cc: "Rafael J. Wysocki"
    Cc: Greg Kroah-Hartman
    Cc: Valentina Manea
    Cc: Shuah Khan
    Cc: Mario Limonciello
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Martin Kelly
     

01 Feb, 2018

1 commit

  • page-types currently hardcodes /proc/kpageflags as the file to parse.
    This works when using the tool to examine the state of pageflags on the
    same system, but does not allow storing a snapshot of pageflags at a
    given time to debug issues nor on a different system.

    This allows the user to specify a saved version of kpageflags with a new
    page-types -F option.

    [akpm@linux-foundation.org: add "filename" to fix usage() string]
    [rientjes@google.com: fix layout]
    Link: http://lkml.kernel.org/r/alpine.DEB.2.10.1801301840050.140969@chino.kir.corp.google.com
    Link: http://lkml.kernel.org/r/alpine.DEB.2.10.1801301458180.153857@chino.kir.corp.google.com
    Signed-off-by: David Rientjes
    Reviewed-by: Andrew Morton
    Reviewed-by: Naoya Horiguchi
    Cc: Konstantin Khlebnikov
    Cc: Vladimir Davydov
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    David Rientjes
     

15 Dec, 2017

1 commit

  • On some linux distributions, the default link of sh is dash which
    deoesn't support split array like "${var//,/ }"

    It's better to force to use bash shell directly.

    Link: http://lkml.kernel.org/r/20171208093751.GA175471@sofia
    Signed-off-by: Liu Changcheng
    Reviewed-by: Sergey Senozhatsky
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Liu, Changcheng
     

16 Nov, 2017

1 commit

  • Patch series "oom: capture unreclaimable slab info in oom message", v10.

    Recently we ran into a oom issue, kernel panic due to no killable
    process. The dmesg shows huge unreclaimable slabs used almost 100%
    memory, but kdump doesn't capture vmcore due to some reason.

    So, it may sound better to capture unreclaimable slab info in oom
    message when kernel panic to aid trouble shooting and cover the corner
    case. Since kernel already panic, so capturing more information sounds
    worthy and doesn't bother normal oom killer.

    With the patchset, tools/vm/slabinfo has a new option, "-U", to show
    unreclaimable slab only.

    And, oom will print all non zero (num_objs * size != 0) unreclaimable
    slabs in oom killer message.

    This patch (of 3):

    Add "-U" option to show unreclaimable slabs only.

    "-U" and "-S" together can tell us what unreclaimable slabs use the most
    memory to help debug huge unreclaimable slabs issue.

    Link: http://lkml.kernel.org/r/1507152550-46205-2-git-send-email-yang.s@alibaba-inc.com
    Signed-off-by: Yang Shi
    Acked-by: Christoph Lameter
    Acked-by: David Rientjes
    Cc: Pekka Enberg
    Cc: Joonsoo Kim
    Cc: Michal Hocko
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Yang Shi
     

02 Nov, 2017

1 commit

  • Many source files in the tree are missing licensing information, which
    makes it harder for compliance tools to determine the correct license.

    By default all files without license information are under the default
    license of the kernel, which is GPL version 2.

    Update the files which contain no license information with the 'GPL-2.0'
    SPDX license identifier. The SPDX identifier is a legally binding
    shorthand, which can be used instead of the full boiler plate text.

    This patch is based on work done by Thomas Gleixner and Kate Stewart and
    Philippe Ombredanne.

    How this work was done:

    Patches were generated and checked against linux-4.14-rc6 for a subset of
    the use cases:
    - file had no licensing information it it.
    - file was a */uapi/* one with no licensing information in it,
    - file was a */uapi/* one with existing licensing information,

    Further patches will be generated in subsequent months to fix up cases
    where non-standard license headers were used, and references to license
    had to be inferred by heuristics based on keywords.

    The analysis to determine which SPDX License Identifier to be applied to
    a file was done in a spreadsheet of side by side results from of the
    output of two independent scanners (ScanCode & Windriver) producing SPDX
    tag:value files created by Philippe Ombredanne. Philippe prepared the
    base worksheet, and did an initial spot review of a few 1000 files.

    The 4.13 kernel was the starting point of the analysis with 60,537 files
    assessed. Kate Stewart did a file by file comparison of the scanner
    results in the spreadsheet to determine which SPDX license identifier(s)
    to be applied to the file. She confirmed any determination that was not
    immediately clear with lawyers working with the Linux Foundation.

    Criteria used to select files for SPDX license identifier tagging was:
    - Files considered eligible had to be source code files.
    - Make and config files were included as candidates if they contained >5
    lines of source
    - File already had some variant of a license header in it (even if
    Reviewed-by: Philippe Ombredanne
    Reviewed-by: Thomas Gleixner
    Signed-off-by: Greg Kroah-Hartman

    Greg Kroah-Hartman
     

23 Feb, 2017

1 commit

  • Currently the tools/vm Makefile has a rather arbitrary implicit build
    rule; page-types is the first value in TARGETS so lets just build that
    one! Additionally there is no install rule and this is needed for make -C
    tools vm_install to work properly.

    Provide a more sensible implicit build rule and a new install rule.

    Note that the variables names used by the install rule (DESTDIR and
    sbindir) are copied from prior-art in tools/power/cpupower.

    Link: http://lkml.kernel.org/r/20170113165630.27541-1-daniel.thompson@linaro.org
    Signed-off-by: Daniel Thompson
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Daniel Thompson
     

27 Jul, 2016

1 commit

  • Page owner will be changed to store more deep stacktrace so current
    temporary buffer size isn't enough. Increase it.

    Link: http://lkml.kernel.org/r/1464230275-25791-5-git-send-email-iamjoonsoo.kim@lge.com
    Signed-off-by: Joonsoo Kim
    Acked-by: Vlastimil Babka
    Cc: Mel Gorman
    Cc: Minchan Kim
    Cc: Alexander Potapenko
    Cc: Hugh Dickins
    Cc: Michal Hocko
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Joonsoo Kim
     

23 Jul, 2016

1 commit

  • The curly braces are missing here so we print stuff unintentionally.

    Fixes: 9da4714a2d44 ('slub: slabinfo update for cmpxchg handling')
    Link: http://lkml.kernel.org/r/20160715211243.GE19522@mwanda
    Signed-off-by: Dan Carpenter
    Acked-by: Christoph Lameter
    Cc: Sergey Senozhatsky
    Cc: Colin Ian King
    Cc: Laura Abbott
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Dan Carpenter
     

25 Jun, 2016

1 commit


18 Mar, 2016

3 commits

  • I found that page-types is very slow and my testing shows many timeout
    errors. Here's an example with a simple program allocating 1000 thps.

    $ time ./page-types -p $(pgrep -f test_alloc)
    ...
    real 0m17.201s
    user 0m16.889s
    sys 0m0.312s

    Most of time is spent in memset(). Currently memset() clears over whole
    buffer for every walk_pfn() call, which is inefficient when walk_pfn()
    is called from walk_vma(), because in that case walk_pfn() is called for
    each pfn. So this patch limits the zero initialization only for the
    first element.

    $ time ./page-types.patched -p $(pgrep -f test_alloc)
    ...
    real 0m0.182s
    user 0m0.046s
    sys 0m0.135s

    Fixes: 954e95584579 ("tools/vm/page-types.c: add memory cgroup dumping and filtering")
    Signed-off-by: Naoya Horiguchi
    Suggested-by: Konstantin Khlebnikov
    Cc: Vladimir Davydov
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Naoya Horiguchi
     
  • This adds two command line keys:

    -c|--cgroup path|@inode Walk only pages owned by this memory cgroup
    -C|--list-cgroup Show memory cgroup inodes

    [vdavydov@virtuozzo.com: opt_cgroup should be uint64_t. Fix conflicts with "tools/vm/page-types.c: support swap entry"]
    Signed-off-by: Konstantin Khlebnikov
    Cc: Naoya Horiguchi
    Reviewed-by: Vladimir Davydov
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Konstantin Khlebnikov
     
  • /proc/pid/pagemap (pte_to_pagemap_entry() internally) already reports
    about swap entry, so let's make the in-kernel utility aware of it.

    Signed-off-by: Naoya Horiguchi
    Cc: Vladimir Davydov
    Cc: Konstantin Khlebnikov
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Naoya Horiguchi
     

16 Mar, 2016

1 commit

  • SLAB_DEBUG_FREE allows expensive consistency checks at free to be turned
    on or off. Expand its use to be able to turn off all consistency
    checks. This gives a nice speed up if you only want features such as
    poisoning or tracing.

    Credit to Mathias Krause for the original work which inspired this
    series

    Signed-off-by: Laura Abbott
    Acked-by: Christoph Lameter
    Cc: Pekka Enberg
    Cc: David Rientjes
    Cc: Joonsoo Kim
    Cc: Kees Cook
    Cc: Mathias Krause
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Laura Abbott
     

21 Nov, 2015

1 commit


06 Nov, 2015

7 commits

  • GNUplot `slabinfo -X' stats, collected, for example, using the
    following command:
    while [ 1 ]; do slabinfo -X >> stats; sleep 1; done

    `slabinfo-gnuplot.sh stats' pre-processes collected records
    and generate graphs (totals, slabs sorted by size, slabs
    sorted by size).

    Graphs can be [individually] regenerate with different samples
    range and graph width-heigh (-r %d,%d and -s %d,%d options).

    To visually compare N `totals' graphs:
    slabinfo-gnuplot.sh -t FILE1-totals FILE2-totals ... FILEN-totals

    Signed-off-by: Sergey Senozhatsky
    Cc: Christoph Lameter
    Cc: Pekka Enberg
    Cc: David Rientjes
    Cc: Joonsoo Kim
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Sergey Senozhatsky
     
  • checkpatch.pl complains about globals being explicitly zeroed
    out: "ERROR: do not initialise globals to 0 or NULL".

    New globals, introduced in this patch set, have no explicit 0
    initialization; clean up the old ones to make it less hairy.

    Signed-off-by: Sergey Senozhatsky
    Cc: Christoph Lameter
    Cc: Pekka Enberg
    Cc: David Rientjes
    Cc: Joonsoo Kim
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Sergey Senozhatsky
     
  • Introduce "-B|--Bytes" opt to disable store_size() dynamic
    size scaling and report size in bytes instead.

    This `expands' the interface a bit, it's impossible to use
    printf("%6s") anymore to output sizes.

    Example:

    slabinfo -X -N 2
    Slabcache Totals
    ----------------
    Slabcaches : 91 Aliases : 119->69 Active: 63
    Memory used: 199798784 # Loss : 10689376 MRatio: 5%
    # Objects : 324301 # PartObj: 18151 ORatio: 5%

    Per Cache Average Min Max Total
    ----------------------------------------------------------------------------
    #Objects 5147 1 89068 324301
    #Slabs 199 1 3886 12537
    #PartSlab 12 0 240 778
    %PartSlab 32% 0% 100% 6%
    PartObjs 5 0 4569 18151
    % PartObj 26% 0% 100% 5%
    Memory 3171409 8192 127336448 199798784
    Used 3001736 160 121429728 189109408
    Loss 169672 0 5906720 10689376

    Per Object Average Min Max
    -----------------------------------------------------------
    Memory 585 8 8192
    User 583 8 8192
    Loss 2 0 64

    Slabs sorted by size
    --------------------
    Name Objects Objsize Space Slabs/Part/Cpu O/S O %Fr %Ef Flg
    ext4_inode_cache 69948 1736 127336448 3871/0/15 18 3 0 95 a
    dentry 89068 288 26058752 3164/0/17 28 1 0 98 a

    Slabs sorted by loss
    --------------------
    Name Objects Objsize Loss Slabs/Part/Cpu O/S O %Fr %Ef Flg
    ext4_inode_cache 69948 1736 5906720 3871/0/15 18 3 0 95 a
    inode_cache 11628 864 537472 642/0/4 18 2 0 94 a

    Besides, store_size() does not use powers of two for G/M/K

    if (value > 1000000000UL) {
    divisor = 100000000UL;
    trailer = 'G';
    } else if (value > 1000000UL) {
    divisor = 100000UL;
    trailer = 'M';
    } else if (value > 1000UL) {
    divisor = 100;
    trailer = 'K';
    }

    Signed-off-by: Sergey Senozhatsky
    Cc: Christoph Lameter
    Cc: Pekka Enberg
    Cc: David Rientjes
    Cc: Joonsoo Kim
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Sergey Senozhatsky
     
  • Add "-X|--Xtotals" opt to output extended totals summary,
    which includes:
    -- totals summary
    -- slabs sorted by size
    -- slabs sorted by loss (waste)

    Example:
    =======

    slabinfo --X -N 1
    Slabcache Totals
    ----------------
    Slabcaches : 91 Aliases : 120->69 Active: 65
    Memory used: 568.3M # Loss : 30.4M MRatio: 5%
    # Objects : 920.1K # PartObj: 161.2K ORatio: 17%

    Per Cache Average Min Max Total
    ---------------------------------------------------------
    #Objects 14.1K 1 227.8K 920.1K
    #Slabs 533 1 11.7K 34.7K
    #PartSlab 86 0 4.3K 5.6K
    %PartSlab 24% 0% 100% 16%
    PartObjs 17 0 129.3K 161.2K
    % PartObj 17% 0% 100% 17%
    Memory 8.7M 8.1K 384.7M 568.3M
    Used 8.2M 160 366.5M 537.9M
    Loss 468.8K 0 18.2M 30.4M

    Per Object Average Min Max
    ---------------------------------------------
    Memory 587 8 8.1K
    User 584 8 8.1K
    Loss 2 0 64

    Slabs sorted by size
    ----------------------
    Name Objects Objsize Space Slabs/Part/Cpu O/S O %Fr %Ef Flg
    ext4_inode_cache 211142 1736 384.7M 11732/40/10 18 3 0 95 a

    Slabs sorted by loss
    ----------------------
    Name Objects Objsize Loss Slabs/Part/Cpu O/S O %Fr %Ef Flg
    ext4_inode_cache 211142 1736 18.2M 11732/40/10 18 3 0 95 a

    Signed-off-by: Sergey Senozhatsky
    Cc: Christoph Lameter
    Cc: Pekka Enberg
    Cc: David Rientjes
    Cc: Joonsoo Kim
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Sergey Senozhatsky
     
  • Fix mismatches between usage() output and real opts[] options. Add
    missing alternative opt names, e.g., '-S' had no '--Size' opts[] entry,
    etc.

    Signed-off-by: Sergey Senozhatsky
    Cc: Christoph Lameter
    Cc: Pekka Enberg
    Cc: David Rientjes
    Cc: Joonsoo Kim
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Sergey Senozhatsky
     
  • Introduce opt "-L|--sort-loss" to sort and output slabs by
    loss (waste) in slabcache().

    Signed-off-by: Sergey Senozhatsky
    Cc: Christoph Lameter
    Cc: Pekka Enberg
    Cc: David Rientjes
    Cc: Joonsoo Kim
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Sergey Senozhatsky
     
  • Introduce opt "-N|--lines=K" to limit the number of slabs
    being reported in output_slabs().

    Signed-off-by: Sergey Senozhatsky
    Cc: Christoph Lameter
    Cc: Pekka Enberg
    Cc: David Rientjes
    Cc: Joonsoo Kim
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Sergey Senozhatsky