diff options
author | Dmitry Rokosov <ddrokosov@salutedevices.com> | 2023-11-23 10:19:44 +0300 |
---|---|---|
committer | Andrew Morton <akpm@linux-foundation.org> | 2023-12-10 16:51:54 -0800 |
commit | becf6529603589c9cb8cfda398a585c0c2e01aae (patch) | |
tree | 7905d2e5c451878f82ff16e52a052c75a911236d /mm/failslab.c | |
parent | 60433a9d038db006ca2f49e3c5f050dc46aaad3a (diff) | |
download | linux-stable-becf6529603589c9cb8cfda398a585c0c2e01aae.tar.gz linux-stable-becf6529603589c9cb8cfda398a585c0c2e01aae.tar.bz2 linux-stable-becf6529603589c9cb8cfda398a585c0c2e01aae.zip |
samples/cgroup: introduce memcg memory.events listener
This is a simple listener for memory events that handles counter changes
in runtime. It can be set up for a specific memory cgroup v2.
The output example:
=====
$ /tmp/memcg_event_listener test
Initialized MEMCG events with counters:
MEMCG events:
low: 0
high: 0
max: 0
oom: 0
oom_kill: 0
oom_group_kill: 0
Started monitoring memory events from '/sys/fs/cgroup/test/memory.events'...
Received event in /sys/fs/cgroup/test/memory.events:
*** 1 MEMCG oom_kill event, change counter 0 => 1
Received event in /sys/fs/cgroup/test/memory.events:
*** 1 MEMCG oom_kill event, change counter 1 => 2
Received event in /sys/fs/cgroup/test/memory.events:
*** 1 MEMCG oom_kill event, change counter 2 => 3
Received event in /sys/fs/cgroup/test/memory.events:
*** 1 MEMCG oom_kill event, change counter 3 => 4
Received event in /sys/fs/cgroup/test/memory.events:
*** 2 MEMCG max events, change counter 0 => 2
Received event in /sys/fs/cgroup/test/memory.events:
*** 8 MEMCG max events, change counter 2 => 10
*** 1 MEMCG oom event, change counter 0 => 1
Received event in /sys/fs/cgroup/test/memory.events:
*** 1 MEMCG oom_kill event, change counter 4 => 5
^CExiting memcg event listener...
=====
Link: https://lkml.kernel.org/r/20231123071945.25811-3-ddrokosov@salutedevices.com
Signed-off-by: Dmitry Rokosov <ddrokosov@salutedevices.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Michal Hocko <mhocko@kernel.org>
Cc: Muchun Song <muchun.song@linux.dev>
Cc: Roman Gushchin <roman.gushchin@linux.dev>
Cc: Shakeel Butt <shakeelb@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Diffstat (limited to 'mm/failslab.c')
0 files changed, 0 insertions, 0 deletions