Re: [PATCH v1] tools/cgroup: introduce cgroup v2 memory.events listener

From: Dmitry Rokosov
Date: Wed Nov 01 2023 - 14:07:53 EST


Hello Michal,

Thank you for the feedback!

On Wed, Nov 01, 2023 at 04:56:47PM +0100, Michal Koutný wrote:
> Hi.
>
> I think the tools/cgroup/cgroup_event_listener.c was useful in the past
> to demonstrate the non-traditional API of cgroup.event_control with FDs
> passing left and right.
>
>
> On Fri, Oct 13, 2023 at 09:41:07PM +0300, Dmitry Rokosov <ddrokosov@xxxxxxxxxxxxxxxxx> 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.
>
> Event files on v2 are based on more standard poll or inotify APIs so
> they don't need such a (cgroup specific) demo. Additionally, the demo
> program lists individual events, so it'd be a maintenance burden to keep
> them in sync with the kernel implementation.

>From my perspective, eventfd serves as the standard mechanism as well.
Therefore, when incorporating the cgroup v1 event listener test into my
project, I initially turned to the tools example, which proved to be
immensely beneficial. Conversely, the cgroup v2 inotify example can
solely be found within the kernel selftests. Although the prevalence of
inotify makes this somewhat understandable, having an additional example
would provide supplementary documentation, which is often invaluable to
developers operating in userspace. Of course, there are maintenance
expenses associated with this approach, as you rightly pointed out.
However, I am willing to undertake the responsibility of maintaining
this example if necessary.

--
Thank you,
Dmitry