linux-stable/Documentation/filesystems
Michal Hocko c76adee347 mm, thp, proc: report THP eligibility for each vma
[ Upstream commit 7635d9cbe8 ]

Userspace falls short when trying to find out whether a specific memory
range is eligible for THP.  There are usecases that would like to know
that
http://lkml.kernel.org/r/alpine.DEB.2.21.1809251248450.50347@chino.kir.corp.google.com
: This is used to identify heap mappings that should be able to fault thp
: but do not, and they normally point to a low-on-memory or fragmentation
: issue.

The only way to deduce this now is to query for hg resp.  nh flags and
confronting the state with the global setting.  Except that there is also
PR_SET_THP_DISABLE that might change the picture.  So the final logic is
not trivial.  Moreover the eligibility of the vma depends on the type of
VMA as well.  In the past we have supported only anononymous memory VMAs
but things have changed and shmem based vmas are supported as well these
days and the query logic gets even more complicated because the
eligibility depends on the mount option and another global configuration
knob.

Simplify the current state and report the THP eligibility in
/proc/<pid>/smaps for each existing vma.  Reuse
transparent_hugepage_enabled for this purpose.  The original
implementation of this function assumes that the caller knows that the vma
itself is supported for THP so make the core checks into
__transparent_hugepage_enabled and use it for existing callers.
__show_smap just use the new transparent_hugepage_enabled which also
checks the vma support status (please note that this one has to be out of
line due to include dependency issues).

[mhocko@kernel.org: fix oops with NULL ->f_mapping]
  Link: http://lkml.kernel.org/r/20181224185106.GC16738@dhcp22.suse.cz
Link: http://lkml.kernel.org/r/20181211143641.3503-3-mhocko@kernel.org
Signed-off-by: Michal Hocko <mhocko@suse.com>
Acked-by: Vlastimil Babka <vbabka@suse.cz>
Cc: Dan Williams <dan.j.williams@intel.com>
Cc: David Rientjes <rientjes@google.com>
Cc: Jan Kara <jack@suse.cz>
Cc: Mike Rapoport <rppt@linux.ibm.com>
Cc: Paul Oppenheimer <bepvte@gmail.com>
Cc: William Kucharski <william.kucharski@oracle.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2019-12-17 20:35:45 +01:00
..
caching fscache: Pass object size in rather than calling back for it 2018-04-06 14:05:14 +01:00
cifs smb3: update readme to correct information about /proc/fs/cifs/Stats 2018-08-07 14:20:23 -05:00
configfs
ext4 docs: fix up the obviously obsolete bits in the new ext4 documentation 2018-07-29 16:35:23 -04:00
nfs ipconfig: Write NTP server IPs to /proc/net/ipconfig/ntp_servers 2018-04-24 13:40:42 -04:00
pohmelfs
00-INDEX Staging/IIO patches for 4.18-rc1 2018-06-09 10:32:39 -07:00
9p.txt
adfs.txt
affs.txt
afs.txt afs: Implement @sys substitution handling 2018-04-09 21:12:31 +01:00
autofs-mount-control.txt autofs: use autofs instead of autofs4 in documentation 2018-06-07 17:34:39 -07:00
autofs.txt autofs: use autofs instead of autofs4 in documentation 2018-06-07 17:34:39 -07:00
automount-support.txt autofs: use autofs instead of autofs4 in documentation 2018-06-07 17:34:39 -07:00
befs.txt
bfs.txt Tigran has moved 2017-05-12 15:57:15 -07:00
btrfs.txt
ceph.txt ceph: update description of some mount options 2018-06-04 20:46:02 +02:00
coda.txt
conf.py docs-rst: convert filesystems book to ReST 2017-05-16 08:44:08 -03:00
cramfs.txt cramfs: rehabilitate it 2017-10-15 00:47:23 -04:00
dax.txt powerpc/cell: Remove axonram driver 2018-01-28 17:00:36 +11:00
debugfs.txt
devpts.txt
directory-locking
dlmfs.txt
dnotify.txt Documentation: fix selftests related file refs 2017-10-19 12:58:21 -06:00
ecryptfs.txt
efivarfs.txt
exofs.txt
ext2.txt fs/*/Kconfig: drop links to 404-compliant http://acl.bestbits.at 2018-01-01 12:45:37 -07:00
ext3.txt
f2fs.txt f2fs: support fault_type mount option 2018-08-13 10:48:17 -07:00
fiemap.txt
files.txt
fscrypt.rst crypto: speck - remove Speck 2018-11-13 11:08:46 -08:00
fuse-io.txt fuse: add writeback documentation 2018-03-20 17:11:45 +01:00
fuse.txt
gfs2-glocks.txt GFS2: Minor improvements to comments and documentation 2018-04-12 10:07:51 -07:00
gfs2-uevents.txt
gfs2.txt
hfs.txt
hfsplus.txt
hpfs.txt
index.rst docs: create filesystem internal section 2018-07-29 16:14:02 -04:00
inotify.txt
isofs.txt
jfs.txt
Locking overlayfs update for 4.19 2018-08-21 18:19:09 -07:00
locks.txt
mandatory-locking.txt
nilfs2.txt MAINTAINERS, nilfs2: change project home URLs 2018-01-13 10:42:48 -08:00
ntfs.txt
ocfs2-online-filecheck.txt
ocfs2.txt
omfs.txt
orangefs.txt Orangefs: documentation updates 2018-04-04 14:05:48 -04:00
overlayfs.txt ovl: fix regression caused by overlapping layers detection 2019-09-21 07:17:14 +02:00
path-lookup.md autofs: use autofs instead of autofs4 in documentation 2018-06-07 17:34:39 -07:00
path-lookup.txt
porting dcache: sort the freeing-without-RCU-delay mess for good. 2019-05-25 18:23:26 +02:00
proc.txt mm, thp, proc: report THP eligibility for each vma 2019-12-17 20:35:45 +01:00
qnx6.txt
quota.txt scripts/spelling.txt: add "an user" pattern and fix typo instances 2017-02-27 18:43:46 -08:00
ramfs-rootfs-initramfs.txt initramfs: move gen_initramfs_list.sh from scripts/ to usr/ 2018-08-22 23:21:44 +09:00
relay.txt Documentation : Update relay function types 2018-07-10 15:11:00 -06:00
romfs.txt
seq_file.txt fs/seq_file.c: simplify seq_file iteration code and interface 2018-08-17 16:20:28 -07:00
sharedsubtree.txt
spufs.txt
squashfs.txt
sysfs-pci.txt PCI: Add pci_mmap_resource_range() and use it for ARM64 2017-04-20 08:47:47 -05:00
sysfs-tagging.txt
sysfs.txt kallsyms: remove print_symbol() function 2018-01-16 16:59:55 +01:00
sysv-fs.txt
tmpfs.txt docs/vm: move numa_memory_policy.rst to Documentation/admin-guide/mm 2018-05-08 09:31:31 -06:00
ubifs.txt
udf.txt udf: Remove never implemented mount options 2018-02-27 10:25:33 +01:00
ufs.txt
vfat.txt Documentation/filesystems/vfat.txt: fix a remark that implies UCS2 2017-12-21 13:39:28 -07:00
vfs.txt vfs: add the fadvise() file operation 2018-08-30 17:08:35 +02:00
xfs-delayed-logging-design.txt
xfs-self-describing-metadata.txt
xfs.txt xfs: remove deprecated barrier/nobarrier mount 2018-07-26 10:15:17 -07:00