linux-stable/Documentation/filesystems
Michal Hocko 0d73e773ed mm, proc: be more verbose about unstable VMA flags in /proc/<pid>/smaps
[ Upstream commit 7550c60798 ]

Patch series "THP eligibility reporting via proc".

This series of three patches aims at making THP eligibility reporting much
more robust and long term sustainable.  The trigger for the change is a
regression report [2] and the long follow up discussion.  In short the
specific application didn't have good API to query whether a particular
mapping can be backed by THP so it has used VMA flags to workaround that.
These flags represent a deep internal state of VMAs and as such they
should be used by userspace with a great deal of caution.

A similar has happened for [3] when users complained that VM_MIXEDMAP is
no longer set on DAX mappings.  Again a lack of a proper API led to an
abuse.

The first patch in the series tries to emphasise that that the semantic of
flags might change and any application consuming those should be really
careful.

The remaining two patches provide a more suitable interface to address [2]
and provide a consistent API to query the THP status both for each VMA and
process wide as well.  [1]

http://lkml.kernel.org/r/20181120103515.25280-1-mhocko@kernel.org [2]
http://lkml.kernel.org/r/http://lkml.kernel.org/r/alpine.DEB.2.21.1809241054050.224429@chino.kir.corp.google.com
[3] http://lkml.kernel.org/r/20181002100531.GC4135@quack2.suse.cz

This patch (of 3):

Even though vma flags exported via /proc/<pid>/smaps are explicitly
documented to be not guaranteed for future compatibility the warning
doesn't go far enough because it doesn't mention semantic changes to those
flags.  And they are important as well because these flags are a deep
implementation internal to the MM code and the semantic might change at
any time.

Let's consider two recent examples:
http://lkml.kernel.org/r/20181002100531.GC4135@quack2.suse.cz
: commit e1fb4a0864 "dax: remove VM_MIXEDMAP for fsdax and device dax" has
: removed VM_MIXEDMAP flag from DAX VMAs. Now our testing shows that in the
: mean time certain customer of ours started poking into /proc/<pid>/smaps
: and looks at VMA flags there and if VM_MIXEDMAP is missing among the VMA
: flags, the application just fails to start complaining that DAX support is
: missing in the kernel.

http://lkml.kernel.org/r/alpine.DEB.2.21.1809241054050.224429@chino.kir.corp.google.com
: Commit 1860033237 ("mm: make PR_SET_THP_DISABLE immediately active")
: introduced a regression in that userspace cannot always determine the set
: of vmas where thp is ineligible.
: Userspace relies on the "nh" flag being emitted as part of /proc/pid/smaps
: to determine if a vma is eligible to be backed by hugepages.
: Previous to this commit, prctl(PR_SET_THP_DISABLE, 1) would cause thp to
: be disabled and emit "nh" as a flag for the corresponding vmas as part of
: /proc/pid/smaps.  After the commit, thp is disabled by means of an mm
: flag and "nh" is not emitted.
: This causes smaps parsing libraries to assume a vma is eligible for thp
: and ends up puzzling the user on why its memory is not backed by thp.

In both cases userspace was relying on a semantic of a specific VMA flag.
The primary reason why that happened is a lack of a proper interface.
While this has been worked on and it will be fixed properly, it seems that
our wording could see some refinement and be more vocal about semantic
aspect of these flags as well.

Link: http://lkml.kernel.org/r/20181211143641.3503-2-mhocko@kernel.org
Signed-off-by: Michal Hocko <mhocko@suse.com>
Acked-by: Jan Kara <jack@suse.cz>
Acked-by: Dan Williams <dan.j.williams@intel.com>
Acked-by: David Rientjes <rientjes@google.com>
Acked-by: Mike Rapoport <rppt@linux.ibm.com>
Acked-by: Vlastimil Babka <vbabka@suse.cz>
Cc: Dan Williams <dan.j.williams@intel.com>
Cc: David Rientjes <rientjes@google.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-01-26 09:32:44 +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 fs: configfs: don't return anything from drop_link 2016-12-01 10:50:49 +01:00
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 vfs: remove unused i_op->rename 2016-09-27 11:03:58 +02:00
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 docs: fix locations of several documents that got moved 2016-10-24 08:12:35 -02:00
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: automatically enable redirect_dir on metacopy=on 2018-11-21 09:19:13 +01:00
path-lookup.md autofs: use autofs instead of autofs4 in documentation 2018-06-07 17:34:39 -07:00
path-lookup.txt
porting document alloc_file() changes 2018-07-12 10:04:29 -04:00
proc.txt mm, proc: be more verbose about unstable VMA flags in /proc/<pid>/smaps 2019-01-26 09:32:44 +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