android_kernel_xiaomi_sm7250/Documentation/filesystems
Colin Cross 62dd4637d6 ANDROID: mm: add a field to store names for private anonymous memory
Userspace processes often have multiple allocators that each do
anonymous mmaps to get memory.  When examining memory usage of
individual processes or systems as a whole, it is useful to be
able to break down the various heaps that were allocated by
each layer and examine their size, RSS, and physical memory
usage.

This patch adds a user pointer to the shared union in
vm_area_struct that points to a null terminated string inside
the user process containing a name for the vma.  vmas that
point to the same address will be merged, but vmas that
point to equivalent strings at different addresses will
not be merged.

Userspace can set the name for a region of memory by calling
prctl(PR_SET_VMA, PR_SET_VMA_ANON_NAME, start, len, (unsigned long)name);
Setting the name to NULL clears it.

The names of named anonymous vmas are shown in /proc/pid/maps
as [anon:<name>] and in /proc/pid/smaps in a new "Name" field
that is only present for named vmas.  If the userspace pointer
is no longer valid all or part of the name will be replaced
with "<fault>".

The idea to store a userspace pointer to reduce the complexity
within mm (at the expense of the complexity of reading
/proc/pid/mem) came from Dave Hansen.  This results in no
runtime overhead in the mm subsystem other than comparing
the anon_name pointers when considering vma merging.  The pointer
is stored in a union with fieds that are only used on file-backed
mappings, so it does not increase memory usage.

Includes fix from Jed Davis <jld@mozilla.com> for typo in
prctl_set_vma_anon_name, which could attempt to set the name
across two vmas at the same time due to a typo, which might
corrupt the vma list.  Fix it to use tmp instead of end to limit
the name setting to a single vma at a time.

Change-Id: I9aa7b6b5ef536cd780599ba4e2fba8ceebe8b59f
Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>

[AmitP: Fix get_user_pages_remote() call to align with upstream commit
        5b56d49fc3 ("mm: add locked parameter to get_user_pages_remote()")]
Signed-off-by: Amit Pundir <amit.pundir@linaro.org>
2018-08-28 17:10:42 +05:30
..
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
9p.txt
00-INDEX Staging/IIO patches for 4.18-rc1 2018-06-09 10:32:39 -07:00
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
btrfs.txt
ceph.txt ceph: update description of some mount options 2018-06-04 20:46:02 +02:00
coda.txt
conf.py
cramfs.txt
dax.txt
debugfs.txt
devpts.txt
directory-locking
dlmfs.txt
dnotify.txt
ecryptfs.txt
efivarfs.txt
exofs.txt
ext2.txt
ext3.txt
f2fs.txt f2fs: support fault_type mount option 2018-08-13 10:48:17 -07:00
fiemap.txt
files.txt
fscrypt.rst fscrypt: add Speck128/256 support 2018-05-20 16:35:51 -04:00
fuse-io.txt
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
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: Provide a mount option metacopy=on/off for metadata copyup 2018-07-20 09:56:06 +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 document alloc_file() changes 2018-07-12 10:04:29 -04:00
proc.txt ANDROID: mm: add a field to store names for private anonymous memory 2018-08-28 17:10:42 +05:30
qnx6.txt
quota.txt
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
sysfs-tagging.txt
sysfs.txt
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
ufs.txt
vfat.txt
vfs.txt overlayfs update for 4.19 2018-08-21 18:19:09 -07: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