Skip to content

mm/damon: hide kdamond and kdamond_lock from API callers

SeongJae Park damon linux-mm lkml 1 version Applied

Status from this message: [merged mm-stable] mm-damon-hide-kdamond-and-kdamond_lock-of-damon_ctx.patch removed from -mm tree

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest5 patches 0 repliesApplied 5/5

Patches in v1 All 5 applied

#Subject and filesSizeRepliesApplied
1/5mm/damon/core: implement damon_kdamond_pid()include/linux/damon.h mm/damon/core.c+18 -00 repliesApplied
2/5mm/damon/sysfs: use damon_kdamond_pid()mm/damon/sysfs.c+3 -40 repliesApplied
3/5mm/damon/lru_sort: use damon_kdamond_pid()mm/damon/lru_sort.c+3 -10 repliesApplied
4/5mm/damon/reclaim: use damon_kdamond_pid()mm/damon/reclaim.c+3 -10 repliesApplied
5/5mm/damon: hide kdamond and kdamond_lock of damon_ctxinclude/linux/damon.h+14 -150 repliesApplied

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/5] mm/damon: hide kdamond and kdamond_lock from API callers

'kdamond' and 'kdamond_lock' fields initially exposed to DAMON API callers for flexible synchronization and use cases. As DAMON API became somewhat complicated compared to the early days, Keeping those exposed could only encourage the API callers to invent more creative but complicated and difficult-to-debug use cases.

Fortunately DAMON API callers didn't invent that many creative use cases. There exist only two use cases of 'kdamond' and 'kdamond_lock'. Finding whether the kdamond is actively running, and getting the pid of the kdamond. For the first use case, a dedicated API function, namely 'damon_is_running()' is provided, and all DAMON API callers are using the function for the use case. Hence only the second use case is where the fields are directly being used by DAMON API callers.

To prevent future invention of complicated and erroneous use cases of the fields, hide the fields from the API callers. For that, provide new dedicated DAMON API functions for the remaining use case, namely damon_kdamond_pid(), migrate DAMON API callers to use the new function, and mark the fields as private fields.

SeongJae Park (5):
mm/damon/core: implement damon_kdamond_pid() mm/damon/sysfs: use damon_kdamond_pid() mm/damon/lru_sort: use damon_kdamond_pid() mm/damon/reclaim: use damon_kdamond_pid() mm/damon: hide kdamond and kdamond_lock of damon_ctx

 include/linux/damon.h | 30 +++++++++++++++---------------
 mm/damon/core.c       | 17 +++++++++++++++++
 mm/damon/lru_sort.c   |  4 +++-
 mm/damon/reclaim.c    |  4 +++-
 mm/damon/sysfs.c      |  7 +++----
 5 files changed, 41 insertions(+), 21 deletions(-)

base-commit: 1aebb6fcfd6a8da57a4eda7863d69e533c392ae0

Signature · 1 line
2.47.3