[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20231106140934.3f5d4960141562fe8da53906@linux-foundation.org>
Date: Mon, 6 Nov 2023 14:09:34 -0800
From: Andrew Morton <akpm@...ux-foundation.org>
To: Dmitry Rokosov <ddrokosov@...utedevices.com>
Cc: <hannes@...xchg.org>, <mhocko@...nel.org>,
<roman.gushchin@...ux.dev>, <shakeelb@...gle.com>,
<muchun.song@...ux.dev>, <kernel@...rdevices.ru>,
<rockosov@...il.com>, <cgroups@...r.kernel.org>,
<linux-mm@...ck.org>, <linux-kernel@...r.kernel.org>,
<bpf@...r.kernel.org>
Subject: Re: [PATCH v1] tools/cgroup: introduce cgroup v2 memory.events
listener
On Fri, 13 Oct 2023 21:41:07 +0300 Dmitry Rokosov <ddrokosov@...utedevices.com> wrote:
> 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/cgroup_v2_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
>
> ...
>
Looks nice to me.
Perhaps it should be under ./samples/?
I suggest adding a comment to __memory_events_show() reminding people
to update this code if new events are added.
Powered by blists - more mailing lists