[PATCH v2 3/4] mm, shmem: add tmpfs memcg= option documentation
DORMANTno replies
From: Mina Almasry <hidden>
Date: 2021-11-10 21:20:05
Also in:
linux-fsdevel, linux-mm
Subsystem:
documentation, the rest · Maintainers:
Jonathan Corbet, Linus Torvalds
Signed-off-by: Mina Almasry <redacted> Cc: Michal Hocko <mhocko-IBi9RG/b67k@public.gmane.org> Cc: Theodore Ts'o <redacted> Cc: Greg Thelen <redacted> Cc: Shakeel Butt <redacted> Cc: Andrew Morton <akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org> Cc: Hugh Dickins <redacted> Cc: Roman Gushchin <redacted> Cc: Dave Chinner <redacted> Cc: Johannes Weiner <redacted> Cc: Hugh Dickins <redacted> Cc: Tejun Heo <redacted> Cc: Vladimir Davydov <redacted> Cc: Muchun Song <redacted> Cc: riel-ebMLmSuQjDVBDgjK7y7TUQ@public.gmane.org Cc: linux-mm-Bw31MaZKKs3YtjvyW6yDsg@public.gmane.org Cc: linux-fsdevel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org Cc: cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org --- Documentation/filesystems/tmpfs.rst | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)
diff --git a/Documentation/filesystems/tmpfs.rst b/Documentation/filesystems/tmpfs.rst
index 0408c245785e3..1ab04e8fa9222 100644
--- a/Documentation/filesystems/tmpfs.rst
+++ b/Documentation/filesystems/tmpfs.rst@@ -137,6 +137,23 @@ mount options. It can be added later, when the tmpfs is already mounted on MountPoint, by 'mount -o remount,mpol=Policy:NodeList MountPoint'. +If CONFIG_MEMCG is enabled, tmpfs has a mount option to specify the memory +cgroup to be charged for page allocations. + +memcg=/sys/fs/cgroup/unified/test/: data page allocations are charged to +cgroup /sys/fs/cgroup/unified/test/. + +When charging memory to the remote memcg (memcg specified with memcg=) and +hitting the limit, the oom-killer will be invoked and will attempt to kill +a process in the remote memcg. If no such processes are found, the remote +charging process gets an ENOMEM. If the remote charging process is in the +pagefault path, it gets killed. + +Only processes that have access to /sys/fs/cgroup/unified/test/cgroup.procs can +mount a tmpfs with memcg=/sys/fs/cgroup/unified/test. Thus, a process is able +to charge memory to a cgroup only if it itself is able to enter that cgroup. + + To specify the initial root directory you can use the following mount options: