From: SeongJae Park <sj@kernel.org>
Cc: SeongJae Park <sj@kernel.org>,
damon@lists.linux.dev, linux-kernel@vger.kernel.org,
linux-mm@kvack.org
Subject: [RFC PATCH 0/9] mm/damon: replace most damon_callback usages in sysfs with new core functions
Date: Fri, 13 Dec 2024 13:52:57 -0800 [thread overview]
Message-ID: <20241213215306.54778-1-sj@kernel.org> (raw)
DAMON provides damon_callback API that notifies monitoring events and
allows safe access to damon_ctx internal data. Users can set and unset
callback functions for different monitoring events in damon_ctx. Then
DAMON worker thread (kdamond) calls back the functions on the events as
long as the function is set on the damon_ctx.
It is designed in such simple way because it was sufficient for usages
of DAMON at the early days. We also wanted to make it flexible so that
API client code can implement any required additional features on top of
damon_callback on their demands.
As expected, more sophisticated usages have invented. Online updates
of parameters or DAMOS auto-tuning inputs and retrieval of DAMOS
statistics and tried regions are notable such usages. Because
damon_callback doesn't provide any explict synchronization mechanism,
the user ABIs for exposing such functionalities are implemented in
asynchronous ways (DAMON_RECLAIM and DAMON_LRU_SORT}), or synchronous
ways (DAMON_SYSFS) with additional synchronization mechanisms that built
inside the ABI implementation, on top of damon_callback.
So damon_callback is working as expected. However, the additional
mechanisms built inside ABI on top of damon_callback beocming somewhat
too big and not easy to maintain. damon_callback is basically simple
enougy to use in not only correct but also wrong ways. The additional
mechanisms can be easier to maintain when implemented inside core logic.
Introduce two new DAMON core API, namely 'damon_call()' and
'damos_walk()'. The two functions support synchronous access to
- damon_ctx internal data including DAMON parameters and monitoring
results, and
- DAMOS-specific data such as regions that each DAMOS action is applied,
respectively.
And replace most of damon_callback usages from DAMON sysfs with the new
core API functions. Online DAMON parameters tuning feature is not
replaced in this series, since it has specific callback timing
assumptions that require more works.
Patch sequence
==============
First two patches removes unnecessary synchronization dependency of
clear_schemes_tried_regions command handling.
Third patch implements one of the new DAMON API, damon_call(). Three
patches replacing damon_callback usages in DAMON sysfs interface using
damon_call() follow.
Then, seventh patch introduces the other new DAMON API, damos_walk().
Eighth patch replaces two damon_callback usages in DAMON sysfs interface
using damos_walk(). The ninth patch finally cleans up code that no more
being used.
SeongJae Park (9):
mm/damon/sysfs-schemes: remove unnecessary schemes existence check in
damon_sysfs_schemes_clear_regions()
mm/damon/sysfs: handle clear_schemes_tried_regions from DAMON sysfs
context
mm/damon/core: implement damon_call()
mm/damon/sysfs: use damon_call() for update_schemes_stats
mm/damon/sysfs: use damon_call() for commit_schemes_quota_goals
mm/damon/sysfs: use damon_call() for update_schemes_effective_quotas
mm/damon/core: implement damos_walk()
mm/damon/sysfs: use damos_walk() for
update_schemes_tried_{bytes,regions}
mm/damon/sysfs: remove unused code for schemes tried regions update
include/linux/damon.h | 59 ++++++++++-
mm/damon/core.c | 220 +++++++++++++++++++++++++++++++++++++++
mm/damon/sysfs-common.h | 16 +--
mm/damon/sysfs-schemes.c | 206 ++++--------------------------------
mm/damon/sysfs.c | 187 +++++++++++++++------------------
5 files changed, 386 insertions(+), 302 deletions(-)
base-commit: e5c48d400cab89a0539ce822ba805f0ad4209e87
--
2.39.5
next reply other threads:[~2024-12-13 21:53 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-13 21:52 SeongJae Park [this message]
2024-12-13 21:52 ` [RFC PATCH 1/9] mm/damon/sysfs-schemes: remove unnecessary schemes existence check in damon_sysfs_schemes_clear_regions() SeongJae Park
2024-12-13 21:52 ` [RFC PATCH 2/9] mm/damon/sysfs: handle clear_schemes_tried_regions from DAMON sysfs context SeongJae Park
2024-12-13 21:53 ` [RFC PATCH 3/9] mm/damon/core: implement damon_call() SeongJae Park
2024-12-13 21:53 ` [RFC PATCH 4/9] mm/damon/sysfs: use damon_call() for update_schemes_stats SeongJae Park
2024-12-13 21:53 ` [RFC PATCH 5/9] mm/damon/sysfs: use damon_call() for commit_schemes_quota_goals SeongJae Park
2024-12-13 21:53 ` [RFC PATCH 6/9] mm/damon/sysfs: use damon_call() for update_schemes_effective_quotas SeongJae Park
2024-12-13 21:53 ` [RFC PATCH 7/9] mm/damon/core: implement damos_walk() SeongJae Park
2024-12-13 21:53 ` [RFC PATCH 8/9] mm/damon/sysfs: use damos_walk() for update_schemes_tried_{bytes,regions} SeongJae Park
2024-12-13 21:53 ` [RFC PATCH 9/9] mm/damon/sysfs: remove unused code for schemes tried regions update SeongJae Park
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20241213215306.54778-1-sj@kernel.org \
--to=sj@kernel.org \
--cc=damon@lists.linux.dev \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox