mbox series

[v2,0/3] samples: introduce cgroup events listeners

Message ID 20231110082045.19407-1-ddrokosov@salutedevices.com (mailing list archive)
Headers show
Series samples: introduce cgroup events listeners | expand

Message

Dmitry Rokosov Nov. 10, 2023, 8:20 a.m. UTC
To begin with, this patch series relocates the cgroup example code to
the samples/cgroup directory, which is the appropriate location for such
code snippets.

Furthermore, a new cgroup v2 events listener is introduced. This
listener is a simple yet effective tool for monitoring memory events and
managing counter changes during runtime.

Additionally, as per Andrew Morton's suggestion, a helpful reminder
comment is included in the memcontrol implementation. This comment
serves to ensure that the samples code is updated whenever new events
are added.

Changes v2 since v1 at [1]:
    - create new samples subdir - cgroup
    - move cgroup_event_listener for cgroup v1 to samples/cgroup
    - add a reminder comment to memcontrol implementation

Links:
    [1] - https://lore.kernel.org/all/20231013184107.28734-1-ddrokosov@salutedevices.com/

Dmitry Rokosov (3):
  samples: introduce new samples subdir for cgroup
  samples/cgroup: introduce cgroup v2 memory.events listener
  mm: memcg: add reminder comment for the memcg v2 events

 MAINTAINERS                                   |   1 +
 mm/memcontrol.c                               |   4 +
 samples/Kconfig                               |   6 +
 samples/Makefile                              |   1 +
 samples/cgroup/Makefile                       |   5 +
 .../cgroup/cgroup_event_listener.c            |   0
 samples/cgroup/cgroup_v2_event_listener.c     | 330 ++++++++++++++++++
 tools/cgroup/Makefile                         |  11 -
 8 files changed, 347 insertions(+), 11 deletions(-)
 create mode 100644 samples/cgroup/Makefile
 rename {tools => samples}/cgroup/cgroup_event_listener.c (100%)
 create mode 100644 samples/cgroup/cgroup_v2_event_listener.c
 delete mode 100644 tools/cgroup/Makefile

Comments

Andrew Morton Nov. 10, 2023, 4:59 p.m. UTC | #1
On Fri, 10 Nov 2023 11:20:42 +0300 Dmitry Rokosov <ddrokosov@salutedevices.com> wrote:

> To begin with, this patch series relocates the cgroup example code to
> the samples/cgroup directory, which is the appropriate location for such
> code snippets.
> 
> Furthermore, a new cgroup v2 events listener is introduced. This
> listener is a simple yet effective tool for monitoring memory events and
> managing counter changes during runtime.

Is this correctly named?  It's a memcg event listener. 
"cgroup_v2_event_listener" implies that it will display events for
other/all cgroup v2 controllers.
Dmitry Rokosov Nov. 11, 2023, 1:39 p.m. UTC | #2
Hello Andrew,

On Fri, Nov 10, 2023 at 08:59:52AM -0800, Andrew Morton wrote:
> On Fri, 10 Nov 2023 11:20:42 +0300 Dmitry Rokosov <ddrokosov@salutedevices.com> wrote:
> 
> > To begin with, this patch series relocates the cgroup example code to
> > the samples/cgroup directory, which is the appropriate location for such
> > code snippets.
> > 
> > Furthermore, a new cgroup v2 events listener is introduced. This
> > listener is a simple yet effective tool for monitoring memory events and
> > managing counter changes during runtime.
> 
> Is this correctly named?  It's a memcg event listener. 
> "cgroup_v2_event_listener" implies that it will display events for
> other/all cgroup v2 controllers.

Yes, you are totally correct. The previous cgroup event listener was
applicable for any cgroup event that uses the eventfd API. But my sample
is only usable for memcg. I'll rename it. Thank you for your suggestion.