Commit 19d7c3ad authored by SeongJae Park's avatar SeongJae Park Committed by Andrew Morton
Browse files

samples: add a skeleton of a sample DAMON module for working set size estimation

Patch series "mm/damon: add sample modules".

Implement a proactive cold memory regions reclaiming logic of prcl sample
module using DAMOS.  The logic treats memory regions that not accessed at
all for five or more seconds as cold, and reclaim those as soon as found.


This patch (of 5):

Add a skeleton for a sample DAMON static module that can be used for
estimating working set size of a given process.  Note that it is a static
module since DAMON is not exporting symbols to loadable modules for now. 
It exposes two module parameters, namely 'pid' and 'enable'.  'pid' will
specify the process that the module will estimate the working set size of.
'enable' will receive whether to start or stop the estimation.  Because
this is just a skeleton, the parameters do nothing, though.  The
functionalities will be implemented by following commits.

Link: https://lkml.kernel.org/r/20241210215030.85675-1-sj@kernel.org
Link: https://lkml.kernel.org/r/20241210215030.85675-2-sj@kernel.org


Signed-off-by: default avatarSeongJae Park <sj@kernel.org>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
parent 08cc4c39
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -6330,6 +6330,7 @@ F: Documentation/mm/damon/
F:	include/linux/damon.h
F:	include/trace/events/damon.h
F:	mm/damon/
F:	samples/damon/
F:	tools/testing/selftests/damon/
DAVICOM FAST ETHERNET (DMFE) NETWORK DRIVER
+2 −0
Original line number Diff line number Diff line
@@ -293,6 +293,8 @@ config SAMPLE_CGROUP

source "samples/rust/Kconfig"

source "samples/damon/Kconfig"

endif # SAMPLES

config HAVE_SAMPLE_FTRACE_DIRECT
+1 −0
Original line number Diff line number Diff line
@@ -39,3 +39,4 @@ obj-$(CONFIG_SAMPLE_KMEMLEAK) += kmemleak/
obj-$(CONFIG_SAMPLE_CORESIGHT_SYSCFG)	+= coresight/
obj-$(CONFIG_SAMPLE_FPROBE)		+= fprobe/
obj-$(CONFIG_SAMPLES_RUST)		+= rust/
obj-$(CONFIG_SAMPLE_DAMON_WSSE)		+= damon/

samples/damon/Kconfig

0 → 100644
+17 −0
Original line number Diff line number Diff line
# SPDX-License-Identifier: GPL-2.0

menu "DAMON Samples"

config SAMPLE_DAMON_WSSE
	bool "DAMON sameple module for working set size estimation"
	depends on DAMON && DAMON_VADDR
	help
	  This builds DAMON sample module for working set size estimation.

	  The module receives a pid, monitor access to the virtual address
	  space of the process, estimate working set size of the process, and
	  repeatedly prints the size on the kernel log.

	  If unsure, say N.

endmenu

samples/damon/Makefile

0 → 100644
+3 −0
Original line number Diff line number Diff line
# SPDX-License-Identifier: GPL-2.0

obj-$(CONFIG_SAMPLE_DAMON_WSSE) += wsse.o
Loading