Skip to content
Snippets Groups Projects
  1. Jan 31, 2020
  2. Jul 12, 2019
    • Tobin C. Harding's avatar
      tools/vm/slabinfo: add sorting info to help menu · cbf800d9
      Tobin C. Harding authored
      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: default avatarTobin C. Harding <tobin@kernel.org>
      Cc: Alexander Duyck <alexander.duyck@gmail.com>
      Cc: Brendan Gregg <brendan.d.gregg@gmail.com>,
      Cc: Christoph Lameter <cl@linux.com>
      Cc: David Rientjes <rientjes@google.com>
      Cc: Jesper Dangaard Brouer <brouer@redhat.com>
      Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
      Cc: Mel Gorman <mgorman@techsingularity.net>
      Cc: Michal Hocko <mhocko@kernel.org>
      Cc: Pekka Enberg <penberg@iki.fi>
      Cc: Qian Cai <cai@lca.pw>
      Cc: Tejun Heo <tj@kernel.org>
      Cc: Vlastimil Babka <vbabka@suse.cz>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      cbf800d9
    • Tobin C. Harding's avatar
      tools/vm/slabinfo: add option to sort by partial slabs · 53a83f97
      Tobin C. Harding authored
      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: default avatarTobin C. Harding <tobin@kernel.org>
      Cc: Alexander Duyck <alexander.duyck@gmail.com>
      Cc: Brendan Gregg <brendan.d.gregg@gmail.com>,
      Cc: Christoph Lameter <cl@linux.com>
      Cc: David Rientjes <rientjes@google.com>
      Cc: Jesper Dangaard Brouer <brouer@redhat.com>
      Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
      Cc: Mel Gorman <mgorman@techsingularity.net>
      Cc: Michal Hocko <mhocko@kernel.org>
      Cc: Pekka Enberg <penberg@iki.fi>
      Cc: Qian Cai <cai@lca.pw>
      Cc: Tejun Heo <tj@kernel.org>
      Cc: Vlastimil Babka <vbabka@suse.cz>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      53a83f97
    • Tobin C. Harding's avatar
      tools/vm/slabinfo: add partial slab listing to -X · 1106b205
      Tobin C. Harding authored
      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: default avatarTobin C. Harding <tobin@kernel.org>
      Cc: Alexander Duyck <alexander.duyck@gmail.com>
      Cc: Brendan Gregg <brendan.d.gregg@gmail.com>,
      Cc: Christoph Lameter <cl@linux.com>
      Cc: David Rientjes <rientjes@google.com>
      Cc: Jesper Dangaard Brouer <brouer@redhat.com>
      Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
      Cc: Mel Gorman <mgorman@techsingularity.net>
      Cc: Michal Hocko <mhocko@kernel.org>
      Cc: Pekka Enberg <penberg@iki.fi>
      Cc: Qian Cai <cai@lca.pw>
      Cc: Tejun Heo <tj@kernel.org>
      Cc: Vlastimil Babka <vbabka@suse.cz>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      1106b205
    • Tobin C. Harding's avatar
      tools/vm/slabinfo: order command line options · d9149996
      Tobin C. Harding authored
      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: default avatarTobin C. Harding <tobin@kernel.org>
      Cc: Jesper Dangaard Brouer <brouer@redhat.com>
      Cc: Pekka Enberg <penberg@iki.fi>
      Cc: Vlastimil Babka <vbabka@suse.cz>
      Cc: Christoph Lameter <cl@linux.com>
      Cc: David Rientjes <rientjes@google.com>
      Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
      Cc: Tejun Heo <tj@kernel.org>
      Cc: Qian Cai <cai@lca.pw>
      Cc: Mel Gorman <mgorman@techsingularity.net>
      Cc: Alexander Duyck <alexander.duyck@gmail.com>
      Cc: Michal Hocko <mhocko@kernel.org>
      Cc: Brendan Gregg <brendan.d.gregg@gmail.com>,
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      d9149996
  3. Mar 06, 2019
  4. Sep 04, 2018
  5. Nov 16, 2017
  6. Nov 02, 2017
    • Greg Kroah-Hartman's avatar
      License cleanup: add SPDX GPL-2.0 license identifier to files with no license · b2441318
      Greg Kroah-Hartman authored
      
      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 <5
         lines).
      
      All documentation files were explicitly excluded.
      
      The following heuristics were used to determine which SPDX license
      identifiers to apply.
      
       - when both scanners couldn't find any license traces, file was
         considered to have no license information in it, and the top level
         COPYING file license applied.
      
         For non */uapi/* files that summary was:
      
         SPDX license identifier                            # files
         ---------------------------------------------------|-------
         GPL-2.0                                              11139
      
         and resulted in the first patch in this series.
      
         If that file was a */uapi/* path one, it was "GPL-2.0 WITH
         Linux-syscall-note" otherwise it was "GPL-2.0".  Results of that was:
      
         SPDX license identifier                            # files
         ---------------------------------------------------|-------
         GPL-2.0 WITH Linux-syscall-note                        930
      
         and resulted in the second patch in this series.
      
       - if a file had some form of licensing information in it, and was one
         of the */uapi/* ones, it was denoted with the Linux-syscall-note if
         any GPL family license was found in the file or had no licensing in
         it (per prior point).  Results summary:
      
         SPDX license identifier                            # files
         ---------------------------------------------------|------
         GPL-2.0 WITH Linux-syscall-note                       270
         GPL-2.0+ WITH Linux-syscall-note                      169
         ((GPL-2.0 WITH Linux-syscall-note) OR BSD-2-Clause)    21
         ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause)    17
         LGPL-2.1+ WITH Linux-syscall-note                      15
         GPL-1.0+ WITH Linux-syscall-note                       14
         ((GPL-2.0+ WITH Linux-syscall-note) OR BSD-3-Clause)    5
         LGPL-2.0+ WITH Linux-syscall-note                       4
         LGPL-2.1 WITH Linux-syscall-note                        3
         ((GPL-2.0 WITH Linux-syscall-note) OR MIT)              3
         ((GPL-2.0 WITH Linux-syscall-note) AND MIT)             1
      
         and that resulted in the third patch in this series.
      
       - when the two scanners agreed on the detected license(s), that became
         the concluded license(s).
      
       - when there was disagreement between the two scanners (one detected a
         license but the other didn't, or they both detected different
         licenses) a manual inspection of the file occurred.
      
       - In most cases a manual inspection of the information in the file
         resulted in a clear resolution of the license that should apply (and
         which scanner probably needed to revisit its heuristics).
      
       - When it was not immediately clear, the license identifier was
         confirmed with lawyers working with the Linux Foundation.
      
       - If there was any question as to the appropriate license identifier,
         the file was flagged for further research and to be revisited later
         in time.
      
      In total, over 70 hours of logged manual review was done on the
      spreadsheet to determine the SPDX license identifiers to apply to the
      source files by Kate, Philippe, Thomas and, in some cases, confirmation
      by lawyers working with the Linux Foundation.
      
      Kate also obtained a third independent scan of the 4.13 code base from
      FOSSology, and compared selected files where the other two scanners
      disagreed against that SPDX file, to see if there was new insights.  The
      Windriver scanner is based on an older version of FOSSology in part, so
      they are related.
      
      Thomas did random spot checks in about 500 files from the spreadsheets
      for the uapi headers and agreed with SPDX license identifier in the
      files he inspected. For the non-uapi files Thomas did random spot checks
      in about 15000 files.
      
      In initial set of patches against 4.14-rc6, 3 files were found to have
      copy/paste license identifier errors, and have been fixed to reflect the
      correct identifier.
      
      Additionally Philippe spent 10 hours this week doing a detailed manual
      inspection and review of the 12,461 patched files from the initial patch
      version early this week with:
       - a full scancode scan run, collecting the matched texts, detected
         license ids and scores
       - reviewing anything where there was a license detected (about 500+
         files) to ensure that the applied SPDX license was correct
       - reviewing anything where there was no detection but the patch license
         was not GPL-2.0 WITH Linux-syscall-note to ensure that the applied
         SPDX license was correct
      
      This produced a worksheet with 20 files needing minor correction.  This
      worksheet was then exported into 3 different .csv files for the
      different types of files to be modified.
      
      These .csv files were then reviewed by Greg.  Thomas wrote a script to
      parse the csv files and add the proper SPDX tag to the file, in the
      format that the file expected.  This script was further refined by Greg
      based on the output to detect more types of files automatically and to
      distinguish between header and source .c files (which need different
      comment types.)  Finally Greg ran the script using the .csv files to
      generate the patches.
      
      Reviewed-by: default avatarKate Stewart <kstewart@linuxfoundation.org>
      Reviewed-by: default avatarPhilippe Ombredanne <pombredanne@nexb.com>
      Reviewed-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      b2441318
  7. Jul 23, 2016
  8. Jun 25, 2016
  9. Mar 15, 2016
  10. Nov 06, 2015
    • Sergey Senozhatsky's avatar
      tools/vm/slabinfo: cosmetic globals cleanup · 2cee611a
      Sergey Senozhatsky authored
      
      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: default avatarSergey Senozhatsky <sergey.senozhatsky@gmail.com>
      Cc: Christoph Lameter <cl@linux.com>
      Cc: Pekka Enberg <penberg@kernel.org>
      Cc: David Rientjes <rientjes@google.com>
      Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      2cee611a
    • Sergey Senozhatsky's avatar
      tools/vm/slabinfo: output sizes in bytes · a8ea0bf1
      Sergey Senozhatsky authored
      
      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: default avatarSergey Senozhatsky <sergey.senozhatsky@gmail.com>
      Cc: Christoph Lameter <cl@linux.com>
      Cc: Pekka Enberg <penberg@kernel.org>
      Cc: David Rientjes <rientjes@google.com>
      Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      a8ea0bf1
    • Sergey Senozhatsky's avatar
      tools/vm/slabinfo: introduce extended totals mode · 016c6cdf
      Sergey Senozhatsky authored
      
      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: default avatarSergey Senozhatsky <sergey.senozhatsky@gmail.com>
      Cc: Christoph Lameter <cl@linux.com>
      Cc: Pekka Enberg <penberg@kernel.org>
      Cc: David Rientjes <rientjes@google.com>
      Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      016c6cdf
    • Sergey Senozhatsky's avatar
      tools/vm/slabinfo: fix alternate opts names · 0d00bf58
      Sergey Senozhatsky authored
      
      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: default avatarSergey Senozhatsky <sergey.senozhatsky@gmail.com>
      Cc: Christoph Lameter <cl@linux.com>
      Cc: Pekka Enberg <penberg@kernel.org>
      Cc: David Rientjes <rientjes@google.com>
      Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      0d00bf58
    • Sergey Senozhatsky's avatar
      tools/vm/slabinfo: sort slabs by loss · 2651f6e7
      Sergey Senozhatsky authored
      
      Introduce opt "-L|--sort-loss" to sort and output slabs by
      loss (waste) in slabcache().
      
      Signed-off-by: default avatarSergey Senozhatsky <sergey.senozhatsky@gmail.com>
      Cc: Christoph Lameter <cl@linux.com>
      Cc: Pekka Enberg <penberg@kernel.org>
      Cc: David Rientjes <rientjes@google.com>
      Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      2651f6e7
    • Sergey Senozhatsky's avatar
      tools/vm/slabinfo: limit the number of reported slabs · 4980a963
      Sergey Senozhatsky authored
      
      Introduce opt "-N|--lines=K" to limit the number of slabs
      being reported in output_slabs().
      
      Signed-off-by: default avatarSergey Senozhatsky <sergey.senozhatsky@gmail.com>
      Cc: Christoph Lameter <cl@linux.com>
      Cc: Pekka Enberg <penberg@kernel.org>
      Cc: David Rientjes <rientjes@google.com>
      Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      4980a963
    • Sergey Senozhatsky's avatar
      tools/vm/slabinfo: use getopt no_argument/optional_argument · 2b100755
      Sergey Senozhatsky authored
      This patchset adds 'extended' slabinfo mode that provides additional
      information:
      
       -- totals summary
       -- slabs sorted by size
       -- slabs sorted by loss (waste)
      
      The patches also introduces several new slabinfo options to limit the
      number of slabs reported, sort slabs by loss (waste); and some fixes.
      
      Extended output 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
      
      The last patch in the series addresses Linus' comment from
      http://marc.info/?l=linux-mm&m=144148518703321&w=2
      
      
      
      (well, it's been some time. sorry.)
      
      gnuplot script takes the slabinfo records file, where every record is a `slabinfo -X'
      output. So the basic workflow is, for example, as follows:
      
              while [ 1 ]; do slabinfo -X -N 2 >> stats; sleep 1; done
              ^C
              slabinfo-gnuplot.sh stats
      
      The last command will produce 3 png files (and 3 stats files)
      -- graph of slabinfo totals
      -- graph of slabs by size
      -- graph of slabs by loss
      
      It's also possible to select a range of records for plotting (a range of collected
      slabinfo outputs) via `-r 10,100` (for example); and compare totals from several
      measurements (to visially compare slabs behaviour (10,50 range)) using
      pre-parsed totals files:
              slabinfo-gnuplot.sh -r 10,50 -t stats-totals1 .. stats-totals2
      
      This also, technically, supports ktest. Upload new slabinfo to target,
      collect the stats and give the resulting stats file to slabinfo-gnuplot
      
      This patch (of 8):
      
      Use getopt constants in `struct option' ->has_arg instead of numerical
      representations.
      
      Signed-off-by: default avatarSergey Senozhatsky <sergey.senozhatsky@gmail.com>
      Cc: Christoph Lameter <cl@linux.com>
      Cc: Pekka Enberg <penberg@kernel.org>
      Cc: David Rientjes <rientjes@google.com>
      Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      2b100755
  11. Jul 02, 2012
  12. Mar 29, 2012
  13. Oct 18, 2011
  14. Aug 19, 2011
  15. Jul 02, 2011
  16. Nov 06, 2010
  17. Sep 23, 2009
  18. Jul 04, 2008
  19. May 01, 2008
  20. Apr 27, 2008
  21. Feb 21, 2008
  22. Feb 08, 2008
    • Christoph Lameter's avatar
      SLUB: Support for performance statistics · 8ff12cfc
      Christoph Lameter authored
      
      The statistics provided here allow the monitoring of allocator behavior but
      at the cost of some (minimal) loss of performance. Counters are placed in
      SLUB's per cpu data structure. The per cpu structure may be extended by the
      statistics to grow larger than one cacheline which will increase the cache
      footprint of SLUB.
      
      There is a compile option to enable/disable the inclusion of the runtime
      statistics and its off by default.
      
      The slabinfo tool is enhanced to support these statistics via two options:
      
      -D 	Switches the line of information displayed for a slab from size
      	mode to activity mode.
      
      -A	Sorts the slabs displayed by activity. This allows the display of
      	the slabs most important to the performance of a certain load.
      
      -r	Report option will report detailed statistics on
      
      Example (tbench load):
      
      slabinfo -AD		->Shows the most active slabs
      
      Name                   Objects    Alloc     Free   %Fast
      skbuff_fclone_cache         33 111953835 111953835  99  99
      :0000192                  2666  5283688  5281047  99  99
      :0001024                   849  5247230  5246389  83  83
      vm_area_struct            1349   119642   118355  91  22
      :0004096                    15    66753    66751  98  98
      :0000064                  2067    25297    23383  98  78
      dentry                   10259    28635    18464  91  45
      :0000080                 11004    18950     8089  98  98
      :0000096                  1703    12358    10784  99  98
      :0000128                   762    10582     9875  94  18
      :0000512                   184     9807     9647  95  81
      :0002048                   479     9669     9195  83  65
      anon_vma                   777     9461     9002  99  71
      kmalloc-8                 6492     9981     5624  99  97
      :0000768                   258     7174     6931  58  15
      
      So the skbuff_fclone_cache is of highest importance for the tbench load.
      Pretty high load on the 192 sized slab. Look for the aliases
      
      slabinfo -a | grep 000192
      :0000192     <- xfs_btree_cur filp kmalloc-192 uid_cache tw_sock_TCP
      	request_sock_TCPv6 tw_sock_TCPv6 skbuff_head_cache xfs_ili
      
      Likely skbuff_head_cache.
      
      
      Looking into the statistics of the skbuff_fclone_cache is possible through
      
      slabinfo skbuff_fclone_cache	->-r option implied if cache name is mentioned
      
      
      .... Usual output ...
      
      Slab Perf Counter       Alloc     Free %Al %Fr
      --------------------------------------------------
      Fastpath             111953360 111946981  99  99
      Slowpath                 1044     7423   0   0
      Page Alloc                272      264   0   0
      Add partial                25      325   0   0
      Remove partial             86      264   0   0
      RemoteObj/SlabFrozen      350     4832   0   0
      Total                111954404 111954404
      
      Flushes       49 Refill        0
      Deactivate Full=325(92%) Empty=0(0%) ToHead=24(6%) ToTail=1(0%)
      
      Looks good because the fastpath is overwhelmingly taken.
      
      
      skbuff_head_cache:
      
      Slab Perf Counter       Alloc     Free %Al %Fr
      --------------------------------------------------
      Fastpath              5297262  5259882  99  99
      Slowpath                 4477    39586   0   0
      Page Alloc                937      824   0   0
      Add partial                 0     2515   0   0
      Remove partial           1691      824   0   0
      RemoteObj/SlabFrozen     2621     9684   0   0
      Total                 5301739  5299468
      
      Deactivate Full=2620(100%) Empty=0(0%) ToHead=0(0%) ToTail=0(0%)
      
      
      Descriptions of the output:
      
      Total:		The total number of allocation and frees that occurred for a
      		slab
      
      Fastpath:	The number of allocations/frees that used the fastpath.
      
      Slowpath:	Other allocations
      
      Page Alloc:	Number of calls to the page allocator as a result of slowpath
      		processing
      
      Add Partial:	Number of slabs added to the partial list through free or
      		alloc (occurs during cpuslab flushes)
      
      Remove Partial:	Number of slabs removed from the partial list as a result of
      		allocations retrieving a partial slab or by a free freeing
      		the last object of a slab.
      
      RemoteObj/Froz:	How many times were remotely freed object encountered when a
      		slab was about to be deactivated. Frozen: How many times was
      		free able to skip list processing because the slab was in use
      		as the cpuslab of another processor.
      
      Flushes:	Number of times the cpuslab was flushed on request
      		(kmem_cache_shrink, may result from races in __slab_alloc)
      
      Refill:		Number of times we were able to refill the cpuslab from
      		remotely freed objects for the same slab.
      
      Deactivate:	Statistics how slabs were deactivated. Shows how they were
      		put onto the partial list.
      
      In general fastpath is very good. Slowpath without partial list processing is
      also desirable. Any touching of partial list uses node specific locks which
      may potentially cause list lock contention.
      
      Signed-off-by: default avatarChristoph Lameter <clameter@sgi.com>
      8ff12cfc
  23. Jan 25, 2008
  24. Oct 17, 2007
  25. Aug 10, 2007
  26. May 18, 2007
  27. May 17, 2007
  28. May 09, 2007
Loading