[PATCH v1 4/5] mm, shmem: add tmpfs memcg= option documentation
From: Mina Almasry <hidden>
Date: 2021-11-08 21:20:20
Also in:
cgroups, linux-fsdevel
Subsystem:
documentation, the rest · Maintainers:
Jonathan Corbet, Linus Torvalds
Signed-off-by: Mina Almasry <redacted> Cc: Michal Hocko <mhocko@suse.com> Cc: Theodore Ts'o <tytso@mit.edu> Cc: Greg Thelen <redacted> Cc: Shakeel Butt <redacted> Cc: Andrew Morton <akpm@linux-foundation.org> Cc: Hugh Dickins <hughd@google.com> Cc: Roman Gushchin <redacted> Cc: Johannes Weiner <hannes@cmpxchg.org> Cc: Hugh Dickins <hughd@google.com> Cc: Tejun Heo <tj@kernel.org> Cc: Vladimir Davydov <redacted> Cc: Muchun Song <redacted> Cc: riel@surriel.com Cc: linux-mm@kvack.org Cc: linux-fsdevel@vger.kernel.org Cc: cgroups@vger.kernel.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: --
2.34.0.rc0.344.g81b53c2807-goog