Skip to content

Directed kmem charging

Shakeel Butt cgroups linux-fsdevel linux-mm lkml 8 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v8 Latest2 patches 6 repliesIn review
  2. v72 patches 8 repliesSuperseded
  3. v63 patches 12 repliesSuperseded
Earlier versions · 5
VersionPostedPatchesRepliesStatus
v52 patches1 replySuperseded
v42 patches1 replySuperseded
v32 patches5 repliesSuperseded
v23 patches14 repliesSuperseded
v13 patches1 replySuperseded

Patches in v8 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2fs: fsnotify: account fsnotify metadata to kmemcgfs/notify/dnotify/dnotify.c fs/notify/fanotify/fanotify.c fs/notify/fanotify/fanotify_user.c +9 more+123 -186 replies
2/2fs, mm: account buffer_head to kmemcgfs/buffer.c include/linux/memcontrol.h mm/memcontrol.c+38 -11 reply

Reviews trailers per patch

None of the 2 patches has a Reviewed-by or Acked-by of their own; the series has one for all of them.

PatchJohannes Weiner
SeriesA-b
1/2
2/2

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v8 thread

Cover letter [PATCH v8 0/2] Directed kmem charging

The Linux kernel's memory cgroup allows limiting the memory usage of the jobs running on the system to provide isolation between the jobs. All the kernel memory allocated in the context of the job and marked with __GFP_ACCOUNT will also be included in the memory usage and be limited by the job's limit.

The kernel memory can only be charged to the memcg of the process in whose context kernel memory was allocated. However there are cases where the allocated kernel memory should be charged to the memcg different from the current processes's memcg. This patch series contains two such concrete use-cases i.e. fsnotify and buffer_head.

The fsnotify event objects can consume a lot of system memory for large or unlimited queues if there is either no or slow listener. The events are allocated in the context of the event producer. However they should be charged to the event consumer. Similarly the buffer_head objects can be allocated in a memcg different from the memcg of the page for which buffer_head objects are being allocated.

To solve this issue, this patch series introduces mechanism to charge kernel memory to a given memcg. In case of fsnotify events, the memcg of the consumer can be used for charging and for buffer_head, the memcg of the page can be charged. For directed charging, the caller can use the scope API memalloc_[un]use_memcg() to specify the memcg to charge for all the __GFP_ACCOUNT allocations within the scope.

Shakeel Butt (2):
fs: fsnotify: account fsnotify metadata to kmemcg fs, mm: account buffer_head to kmemcg

 fs/buffer.c                          | 15 ++++++-
 fs/notify/dnotify/dnotify.c          |  5 ++-
 fs/notify/fanotify/fanotify.c        | 17 ++++++--
 fs/notify/fanotify/fanotify_user.c   |  5 ++-
 fs/notify/group.c                    |  4 ++
 fs/notify/inotify/inotify_fsnotify.c | 15 ++++++-
 fs/notify/inotify/inotify_user.c     |  5 ++-
 include/linux/fsnotify_backend.h     | 12 ++++--
 include/linux/memcontrol.h           | 14 +++++++
 include/linux/sched.h                |  3 ++
 include/linux/sched/mm.h             | 41 +++++++++++++++++++
 kernel/fork.c                        |  3 ++
 mm/memcontrol.c                      | 60 ++++++++++++++++++++++++++--
 13 files changed, 182 insertions(+), 17 deletions(-)
Signature · 1 line
2.18.0.rc2.346.g013aa6912e-goog