Skip to content
Snippets Groups Projects
  1. Nov 06, 2021
    • Naoya Horiguchi's avatar
      tools/vm/page-types.c: print file offset in hexadecimal · 41d4613b
      Naoya Horiguchi authored
      In page list mode (with -l and -L option), virtual address and physical
      address are printed in hexadecimal, but file offset is not, which is
      confusing, so let's align it.
      
      Link: https://lkml.kernel.org/r/20211004061325.1525902-4-naoya.horiguchi@linux.dev
      
      
      Signed-off-by: default avatarNaoya Horiguchi <naoya.horiguchi@nec.com>
      Cc: Bin Wang <wangbin224@huawei.com>
      Cc: Changbin Du <changbin.du@intel.com>
      Cc: Christian Hansen <chansen3@cisco.com>
      Cc: Konstantin Khlebnikov <koct9i@gmail.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      41d4613b
    • Naoya Horiguchi's avatar
      tools/vm/page-types.c: move show_file() to summary output · b76901db
      Naoya Horiguchi authored
      Currently file info from show_file() is printed out within page list
      like below, but this is inconvenient a little to utilize the page list
      from other scripts (maybe needs additional filtering).
      
          $ ./page-types -f page-types.c -l
          foffset offset  len     flags
          page-types.c Inode: 15108680 Size: 30953 (8 pages)
          Modify: Sat Oct  2 23:11:20 2021 (2399 seconds ago)
          Access: Sat Oct  2 23:11:28 2021 (2391 seconds ago)
          0       d9f59e  1       ___U_lA____________________________________
          1       1031eb5 1       __RU_l_____________________________________
          2       13bf717 1       __RU_l_____________________________________
          3       13ac333 1       ___U_lA____________________________________
          4       d9f59f  1       __RU_l_____________________________________
          5       183fd49 1       ___U_lA____________________________________
          6       13cbf69 1       ___U_lA____________________________________
          7       d9ef05  1       ___U_lA____________________________________
      
                       flags      page-count       MB  symbolic-flags                     long-symbolic-flags
          0x000000000000002c               3        0  __RU_l_____________________________________        referenced,uptodate,lru
          0x0000000000000068               5        0  ___U_lA____________________________________        uptodate,lru,active
                       total               8        0
      
      With this patch file info is printed out in summary part like below:
      
          $ ./page-types -f page-types.c -l
          foffset offset  len     flags
          0       d9f59e  1       ___U_lA_____________________________________
          1       1031eb5 1       __RU_l______________________________________
          2       13bf717 1       __RU_l______________________________________
          3       13ac333 1       ___U_lA_____________________________________
          4       d9f59f  1       __RU_l______________________________________
          5       183fd49 1       ___U_lA_____________________________________
          6       13cbf69 1       ___U_lA_____________________________________
      
          page-types.c Inode: 15108680 Size: 30953 (8 pages)
          Modify: Sat Oct  2 23:11:20 2021 (2435 seconds ago)
          Access: Sat Oct  2 23:11:28 2021 (2427 seconds ago)
      
                       flags      page-count       MB  symbolic-flags                     long-symbolic-flags
          0x000000000000002c               3        0  __RU_l______________________________________       referenced,uptodate,lru
          0x0000000000000068               4        0  ___U_lA_____________________________________       uptodate,lru,active
                       total               7        0
      
      Link: https://lkml.kernel.org/r/20211004061325.1525902-3-naoya.horiguchi@linux.dev
      
      
      Signed-off-by: default avatarNaoya Horiguchi <naoya.horiguchi@nec.com>
      Cc: Bin Wang <wangbin224@huawei.com>
      Cc: Changbin Du <changbin.du@intel.com>
      Cc: Christian Hansen <chansen3@cisco.com>
      Cc: Konstantin Khlebnikov <koct9i@gmail.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      b76901db
    • Naoya Horiguchi's avatar
      tools/vm/page-types.c: make walk_file() aware of address range option · a62f5ecb
      Naoya Horiguchi authored
      Patch series "tools/vm/page-types.c: a few improvements".
      
      This patchset adds some improvements on tools/vm/page-types.c.  Patch
      1/3 makes -a option (specify address range) work with -f (file cache
      mode).  Patch 2/3 and 3/3 are to fix minor formatting issues of this
      tool.  These would make life a little easier for the users of this tool.
      
      Please see individual patches for more details about specific issues.
      
      This patch (of 3):
      
      -a|--addr option is used to limit the range of address to be scanned for
      page status.  It works now for physical address space (dafult mode) or for
      virtual address space (with -p option), but not for file address space
      (with -f option).  So make walk_file() aware of -a option.
      
      Link: https://lkml.kernel.org/r/20211004061325.1525902-1-naoya.horiguchi@linux.dev
      Link: https://lkml.kernel.org/r/20211004061325.1525902-2-naoya.horiguchi@linux.dev
      
      
      Signed-off-by: default avatarNaoya Horiguchi <naoya.horiguchi@nec.com>
      Cc: Konstantin Khlebnikov <koct9i@gmail.com>
      Cc: Christian Hansen <chansen3@cisco.com>
      Cc: Changbin Du <changbin.du@intel.com>
      Cc: Bin Wang <wangbin224@huawei.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      a62f5ecb
  2. Sep 24, 2021
  3. Sep 04, 2020
    • Steven Price's avatar
      mm: Add PG_arch_2 page flag · 4beba948
      Steven Price authored
      
      For arm64 MTE support it is necessary to be able to mark pages that
      contain user space visible tags that will need to be saved/restored e.g.
      when swapped out.
      
      To support this add a new arch specific flag (PG_arch_2). This flag is
      only available on 64-bit architectures due to the limited number of
      spare page flags on the 32-bit ones.
      
      Signed-off-by: default avatarSteven Price <steven.price@arm.com>
      [catalin.marinas@arm.com: use CONFIG_64BIT for guarding this new flag]
      Signed-off-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      4beba948
  4. Jun 05, 2019
  5. Mar 06, 2019
    • David Hildenbrand's avatar
      mm: convert PG_balloon to PG_offline · ca215086
      David Hildenbrand authored
      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: default avatarDavid Hildenbrand <david@redhat.com>
      Acked-by: default avatarKonstantin Khlebnikov <koct9i@gmail.com>
      Acked-by: default avatarMichael S. Tsirkin <mst@redhat.com>
      Acked-by: default avatarPankaj gupta <pagupta@redhat.com>
      Cc: Jonathan Corbet <corbet@lwn.net>
      Cc: Alexey Dobriyan <adobriyan@gmail.com>
      Cc: Mike Rapoport <rppt@linux.vnet.ibm.com>
      Cc: Christian Hansen <chansen3@cisco.com>
      Cc: Vlastimil Babka <vbabka@suse.cz>
      Cc: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>
      Cc: Stephen Rothwell <sfr@canb.auug.org.au>
      Cc: Matthew Wilcox <willy@infradead.org>
      Cc: Michal Hocko <mhocko@suse.com>
      Cc: Pavel Tatashin <pasha.tatashin@oracle.com>
      Cc: Alexander Duyck <alexander.h.duyck@linux.intel.com>
      Cc: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
      Cc: Miles Chen <miles.chen@mediatek.com>
      Cc: David Rientjes <rientjes@google.com>
      Cc: Kazuhito Hagio <k-hagio@ab.jp.nec.com>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Baoquan He <bhe@redhat.com>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com>
      Cc: Dave Young <dyoung@redhat.com>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: Haiyang Zhang <haiyangz@microsoft.com>
      Cc: Juergen Gross <jgross@suse.com>
      Cc: Julien Freche <jfreche@vmware.com>
      Cc: Kairui Song <kasong@redhat.com>
      Cc: "K. Y. Srinivasan" <kys@microsoft.com>
      Cc: Len Brown <len.brown@intel.com>
      Cc: Lianbo Jiang <lijiang@redhat.com>
      Cc: Michal Hocko <mhocko@kernel.org>
      Cc: Nadav Amit <namit@vmware.com>
      Cc: Omar Sandoval <osandov@fb.com>
      Cc: Pavel Machek <pavel@ucw.cz>
      Cc: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
      Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>
      Cc: Stefano Stabellini <sstabellini@kernel.org>
      Cc: Stephen Hemminger <sthemmin@microsoft.com>
      Cc: Vitaly Kuznetsov <vkuznets@redhat.com>
      Cc: Xavier Deguillard <xdeguillard@vmware.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      ca215086
  6. Dec 28, 2018
  7. Sep 04, 2018
  8. Aug 17, 2018
  9. Jun 08, 2018
  10. Feb 01, 2018
  11. Mar 17, 2016
  12. Nov 21, 2015
  13. Sep 23, 2015
    • Arnaldo Carvalho de Melo's avatar
      tools vm: Fix build due to removal of tools/lib/api/fs/debugfs.h · f6489bc2
      Arnaldo Carvalho de Melo authored
      
      There were some changes in how this debugfs mounting helper is
      implemented/exported and we forgot to check if there were other users
      besides perf, fix it.
      
      Need to do a make -C tools/ everytime we do changes to
      tools/{lib,include} and other places where we're moving things from
      tools/perf/ to be used by other tools/ living code.
      
      Fixed:
      
        $ make -C tools/vm
        make: Entering directory '/home/git/linux/tools/vm'
        make -C ../lib/api
        make[1]: Entering directory '/home/git/linux/tools/lib/api'
          CC       fd/array.o
          LD       fd/libapi-in.o
          CC       fs/fs.o
          CC       fs/tracing_path.o
          LD       fs/libapi-in.o
          CC       cpu.o
          LD       libapi-in.o
          AR       libapi.a
        make[1]: Leaving directory '/home/git/linux/tools/lib/api'
        gcc -Wall -Wextra -I../lib/ -o page-types page-types.c ../lib/api/libapi.a
        make: Leaving directory '/home/git/linux/tools/vm'
        $
      
      Reported-by: default avatarVinson Lee <vlee@twopensource.com>
      Tested-by: default avatarVinson Lee <vlee@twopensource.com>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Matt Fleming <matt@codeblueprint.co.uk>
      Cc: Raphael Beamonte <raphael.beamonte@gmail.com>
      Cc: H. Peter Anvin <hpa@zytor.com>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Fixes: 60a1133a ("tools lib api fs: Remove debugfs, tracefs and findfs objects")
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      f6489bc2
  14. Sep 08, 2015
  15. Feb 12, 2015
  16. Oct 10, 2014
  17. Jun 04, 2014
  18. Apr 07, 2014
    • Konstantin Khlebnikov's avatar
      tools/vm/page-types.c: page-cache sniffing feature · 65a6a410
      Konstantin Khlebnikov authored
      
      After this patch 'page-types' can walk over a file's mappings and
      analyze populated page cache pages mostly without disturbing its state.
      
      It maps chunk of file, marks VMA as MADV_RANDOM to turn off readahead,
      pokes VMA via mincore() to determine cached pages, triggers page-fault
      only for them, and finally gathers information via pagemap/kpageflags.
      Before unmap it marks VMA as MADV_SEQUENTIAL for ignoring reference
      bits.
      
      usage: page-types -f <path>
      
      If <path> is directory it will analyse all files in all subdirectories.
      
      Symlinks are not followed as well as mount points.  Hardlinks aren't
      handled, they'll be dumped as many times as they are found.  Recursive
      walk brings all dentries into dcache and populates page cache of
      block-devices aka 'Buffers'.
      
      Probably it's worth to add ioctl for dumping file page cache as array of
      PFNs as a replacement for this hackish juggling with
      mmap/madvise/mincore/pagemap.  Also recursive walk could be replaced
      with dumping cached inodes via some ioctl or debugfs interface followed
      by openning them via open_by_handle_at, this would fix hardlinks
      handling and unneeded population of dcache and buffers.  This interface
      might be used as data source for constructing readahead plans and for
      background optimizations of actively used files.
      
      collateral changes:
      + fix 64-bit LFS: define _FILE_OFFSET_BITS instead of _LARGEFILE64_SOURCE
      + replace lseek + read with single pread
      + make show_page_range() reusable after flush
      
      usage example:
      
        ~/src/linux/tools/vm$ sudo ./page-types -L -f page-types
        foffset offset    flags
        page-types       Inode: 2229277       Size: 89065 (22 pages)
        Modify: Tue Feb 25 12:00:59 2014 (162 seconds ago)
        Access: Tue Feb 25 12:01:00 2014 (161 seconds ago)
        0       3cbf3b     __RU_lA____M________________________
        1       38946a     __RU_lA____M________________________
        2       1a3cec     __RU_lA____M________________________
        3       1a8321     __RU_lA____M________________________
        4       3af7cc     __RU_lA____M________________________
        5       1ed532     __RU_lA_____________________________
        6       2e436a     __RU_lA_____________________________
        7       29a35e     ___U_lA_____________________________
        8       2de86e     ___U_lA_____________________________
        9       3bdfb4     ___U_lA_____________________________
        10      3cd8a3     ___U_lA_____________________________
        11      2afa50     ___U_lA_____________________________
        12      2534c2     ___U_lA_____________________________
        13      1b7a40     ___U_lA_____________________________
        14      17b0be     ___U_lA_____________________________
        15      392b0c     ___U_lA_____________________________
        16      3ba46a     __RU_lA_____________________________
        17      397dc8     ___U_lA_____________________________
        18      1f2a36     ___U_lA_____________________________
        19      21fd30     __RU_lA_____________________________
        20      2c35ba     __RU_l______________________________
        21      20f181     __RU_l______________________________
      
                     flags page-count   MB  symbolic-flags                        long-symbolic-flags
        0x000000000000002c          2    0  __RU_l______________________________  referenced,uptodate,lru
        0x0000000000000068         11    0  ___U_lA_____________________________  uptodate,lru,active
        0x000000000000006c          4    0  __RU_lA_____________________________  referenced,uptodate,lru,active
        0x000000000000086c          5    0  __RU_lA____M________________________  referenced,uptodate,lru,active,mmap
                     total         22    0
      
        ~/src/linux/tools/vm$ sudo ./page-types -f /
                     flags page-count     MB  symbolic-flags                        long-symbolic-flags
        0x0000000000000028      21761     85  ___U_l______________________________  uptodate,lru
        0x000000000000002c     127279    497  __RU_l______________________________  referenced,uptodate,lru
        0x0000000000000068      74160    289  ___U_lA_____________________________  uptodate,lru,active
        0x000000000000006c      84469    329  __RU_lA_____________________________  referenced,uptodate,lru,active
        0x000000000000007c          1      0  __RUDlA_____________________________  referenced,uptodate,dirty,lru,active
        0x0000000000000228        370      1  ___U_l___I__________________________  uptodate,lru,reclaim
        0x0000000000000828         49      0  ___U_l_____M________________________  uptodate,lru,mmap
        0x000000000000082c        126      0  __RU_l_____M________________________  referenced,uptodate,lru,mmap
        0x0000000000000868        137      0  ___U_lA____M________________________  uptodate,lru,active,mmap
        0x000000000000086c      12890     50  __RU_lA____M________________________  referenced,uptodate,lru,active,mmap
                     total     321242   1254
      
      Signed-off-by: default avatarKonstantin Khlebnikov <koct9i@gmail.com>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Fengguang Wu <fengguang.wu@intel.com>
      Cc: Borislav Petkov <bp@suse.de>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      65a6a410
  19. Dec 16, 2013
    • Borislav Petkov's avatar
      tools/: Convert to new topic libraries · 553873e1
      Borislav Petkov authored
      
      Move debugfs.* to api/fs/. We have a common tools/lib/api/ place where
      the Makefile lives and then we place the headers in subdirs.
      
      For example, all the fs-related stuff goes to tools/lib/api/fs/ from
      which we get libapikfs.a (acme got almost the naming he wanted :-)) and
      we link it into the tools which need it - in this case perf and
      tools/vm/page-types.
      
      acme:
      
      "Looking at the implementation, I think some tools can even link
      directly to the .o files, avoiding the .a file altogether.
      
      But that is just an optimization/finer granularity tools/lib/
      cherrypicking that toolers can make use of."
      
      Fixup documentation cleaning target while at it.
      
      Signed-off-by: default avatarBorislav Petkov <bp@suse.de>
      Acked-by: default avatarIngo Molnar <mingo@kernel.org>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Arjan van de Ven <arjan@linux.intel.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Namhyung Kim <namhyung@gmail.com>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Pekka Enberg <penberg@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Robert Richter <rric@kernel.org>
      Cc: Stanislav Fomichev <stfomichev@yandex-team.ru>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Link: http://lkml.kernel.org/r/1386605664-24041-2-git-send-email-bp@alien8.de
      
      
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      553873e1
  20. Nov 13, 2013
    • Naoya Horiguchi's avatar
      tools/vm/page-types.c: support KPF_SOFTDIRTY bit · 46c77e2b
      Naoya Horiguchi authored
      
      Soft dirty bit allows us to track which pages are written since the last
      clear_ref (by "echo 4 > /proc/pid/clear_refs".) This is useful for
      userspace applications to know their memory footprints.
      
      Note that the kernel exposes this flag via bit[55] of /proc/pid/pagemap,
      and the semantics is not a default one (scheduled to be the default in the
      near future.) However, it shifts to the new semantics at the first
      clear_ref, and the users of soft dirty bit always do it before utilizing
      the bit, so that's not a big deal.  Users must avoid relying on the bit in
      page-types before the first clear_ref.
      
      Signed-off-by: default avatarNaoya Horiguchi <n-horiguchi@ah.jp.nec.com>
      Cc: Wu Fengguang <fengguang.wu@intel.com>
      Cc: Pavel Emelyanov <xemul@parallels.com>
      Cc: Cyrill Gorcunov <gorcunov@openvz.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      46c77e2b
  21. Mar 15, 2013
  22. Oct 25, 2012
  23. Oct 13, 2012
  24. May 29, 2012
  25. Mar 29, 2012
  26. Mar 22, 2012
  27. Mar 23, 2011
  28. Oct 07, 2010
  29. Aug 05, 2010
  30. Dec 16, 2009
  31. Dec 15, 2009
Loading