Skip to content

Commit

Permalink
samples: introduce new samples subdir for cgroup
Browse files Browse the repository at this point in the history
Patch series "samples: introduce cgroup events listeners", v3.

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 memcg 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.


This patch (of 3):

Move the cgroup_event_listener for cgroup v1 to the samples directory. 
This suggestion was proposed by Andrew Morton during the discussion [1].

Link: https://lore.kernel.org/all/[email protected]/ [1]
Link: https://lkml.kernel.org/r/[email protected]
Link: https://lkml.kernel.org/r/[email protected]
Signed-off-by: Dmitry Rokosov <[email protected]>
Cc: Johannes Weiner <[email protected]>
Cc: Michal Hocko <[email protected]>
Cc: Muchun Song <[email protected]>
Cc: Roman Gushchin <[email protected]>
Cc: Shakeel Butt <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
  • Loading branch information
rockosov authored and akpm00 committed Dec 11, 2023
1 parent ebc20dc commit 60433a9
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 11 deletions.
1 change: 1 addition & 0 deletions MAINTAINERS
Original file line number Diff line number Diff line change
Expand Up @@ -5339,6 +5339,7 @@ L: [email protected]
S: Maintained
F: mm/memcontrol.c
F: mm/swap_cgroup.c
F: samples/cgroup/*
F: tools/testing/selftests/cgroup/memcg_protection.m
F: tools/testing/selftests/cgroup/test_hugetlb_memcg.c
F: tools/testing/selftests/cgroup/test_kmem.c
Expand Down
6 changes: 6 additions & 0 deletions samples/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,12 @@ config SAMPLE_KMEMLEAK
Build a sample program which have explicitly leaks memory to test
kmemleak

config SAMPLE_CGROUP
bool "Build cgroup sample code"
depends on CGROUPS && CC_CAN_LINK && HEADERS_INSTALL
help
Build samples that demonstrate the usage of the cgroup API.

source "samples/rust/Kconfig"

endif # SAMPLES
Expand Down
1 change: 1 addition & 0 deletions samples/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

subdir-$(CONFIG_SAMPLE_AUXDISPLAY) += auxdisplay
subdir-$(CONFIG_SAMPLE_ANDROID_BINDERFS) += binderfs
subdir-$(CONFIG_SAMPLE_CGROUP) += cgroup
obj-$(CONFIG_SAMPLE_CONFIGFS) += configfs/
obj-$(CONFIG_SAMPLE_CONNECTOR) += connector/
obj-$(CONFIG_SAMPLE_FANOTIFY_ERROR) += fanotify/
Expand Down
5 changes: 5 additions & 0 deletions samples/cgroup/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# SPDX-License-Identifier: GPL-2.0

userprogs-always-y += cgroup_event_listener

userccflags += -I usr/include
File renamed without changes.
11 changes: 0 additions & 11 deletions tools/cgroup/Makefile

This file was deleted.

0 comments on commit 60433a9

Please sign in to comment.