No description
Find a file
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
arch ANDROID: goldfish: add ranchu defconfigs 2018-08-28 17:10:42 +05:30
block blk-wbt: don't maintain inflight counts if disabled 2018-08-23 09:34:46 -06:00
certs export.h: remove VMLINUX_SYMBOL() and VMLINUX_SYMBOL_STR() 2018-08-22 23:21:44 +09:00
crypto DMAengine updates for v4.19-rc1 2018-08-18 15:55:59 -07:00
Documentation ANDROID: mm: add a field to store names for private anonymous memory 2018-08-28 17:10:42 +05:30
drivers ANDROID: input: keyreset: switch to orderly_reboot 2018-08-28 17:10:42 +05:30
firmware kbuild: remove all dummy assignments to obj- 2017-11-18 11:46:06 +09:00
fs ANDROID: mm: add a field to store names for private anonymous memory 2018-08-28 17:10:42 +05:30
include ANDROID: mm: add a field to store names for private anonymous memory 2018-08-28 17:10:42 +05:30
init ANDROID: initramfs: Add skip_initramfs command line option 2018-08-28 17:10:42 +05:30
ipc ipc/util.c: update return value of ipc_getref from int to bool 2018-08-22 10:52:52 -07:00
kernel ANDROID: mm: add a field to store names for private anonymous memory 2018-08-28 17:10:42 +05:30
lib Merge branch 'ida-4.19' of git://git.infradead.org/users/willy/linux-dax 2018-08-26 11:48:42 -07:00
LICENSES LICENSES: Add Linux-OpenIB license text 2018-04-27 16:41:53 -06:00
mm ANDROID: mm: add a field to store names for private anonymous memory 2018-08-28 17:10:42 +05:30
net Merge branch 'ida-4.19' of git://git.infradead.org/users/willy/linux-dax 2018-08-26 11:48:42 -07:00
samples samples/bpf: all XDP samples should unload xdp/bpf prog on SIGTERM 2018-08-16 21:55:32 +02:00
scripts ANDROID: kbuild: Makefile.clean: make Kbuild and Makefile optional 2018-08-28 17:10:42 +05:30
security + Cleanups 2018-08-24 13:00:33 -07:00
sound Merge branch 'akpm' (patches from Andrew) 2018-08-23 19:20:12 -07:00
tools Merge branch 'ida-4.19' of git://git.infradead.org/users/willy/linux-dax 2018-08-26 11:48:42 -07:00
usr initramfs: move gen_initramfs_list.sh from scripts/ to usr/ 2018-08-22 23:21:44 +09:00
virt ARM: Support for Group0 interrupts in guests, Cache management 2018-08-22 13:52:44 -07:00
.clang-format clang-format: Set IndentWrappedFunctionNames false 2018-08-01 18:38:51 +02:00
.cocciconfig scripts: add Linux .cocciconfig for coccinelle 2016-07-22 12:13:39 +02:00
.get_maintainer.ignore
.gitattributes .gitattributes: set git diff driver for C source code files 2016-10-07 18:46:30 -07:00
.gitignore ANDROID: add script to fetch android kernel config fragments 2018-08-28 16:44:09 +05:30
.mailmap libnvdimm-for-4.19_misc 2018-08-25 18:13:10 -07:00
build.config.goldfish.arm ANDROID: build: add build server configs for goldfish 2018-08-28 17:10:42 +05:30
build.config.goldfish.arm64 ANDROID: build: add build server configs for goldfish 2018-08-28 17:10:42 +05:30
build.config.goldfish.mips ANDROID: build: add build server configs for goldfish 2018-08-28 17:10:42 +05:30
build.config.goldfish.mips64 ANDROID: build: add build server configs for goldfish 2018-08-28 17:10:42 +05:30
build.config.goldfish.x86 ANDROID: build: add build server configs for goldfish 2018-08-28 17:10:42 +05:30
build.config.goldfish.x86_64 ANDROID: build: add build server configs for goldfish 2018-08-28 17:10:42 +05:30
COPYING COPYING: use the new text with points to the license files 2018-03-23 12:41:45 -06:00
CREDITS 9p: remove Ron Minnich from MAINTAINERS 2018-08-17 16:20:26 -07:00
Kbuild Kbuild updates for v4.15 2017-11-17 17:45:29 -08:00
Kconfig kconfig: move the "Executable file formats" menu to fs/Kconfig.binfmt 2018-08-02 08:06:55 +09:00
MAINTAINERS libnvdimm-for-4.19_misc 2018-08-25 18:13:10 -07:00
Makefile ANDROID: Kbuild, LLVMLinux: allow overriding clang target triple 2018-08-28 17:10:42 +05:30
README Docs: Added a pointer to the formatted docs to README 2018-03-21 09:02:53 -06:00

Linux kernel
============

There are several guides for kernel developers and users. These guides can
be rendered in a number of formats, like HTML and PDF. Please read
Documentation/admin-guide/README.rst first.

In order to build the documentation, use ``make htmldocs`` or
``make pdfdocs``.  The formatted documentation can also be read online at:

    https://www.kernel.org/doc/html/latest/

There are various text files in the Documentation/ subdirectory,
several of them using the Restructured Text markup notation.
See Documentation/00-INDEX for a list of what is contained in each file.

Please read the Documentation/process/changes.rst file, as it contains the
requirements for building and running the kernel, and information about
the problems which may result by upgrading your kernel.