Skip to content

mm/damon/modules: detect and use fresh status

SeongJae Park damon linux-mm lkml stable 3 versions – Applied

Status from this message: [merged mm-hotfixes-stable] mm-damon-stat-detect-and-use-fresh-enabled-value.patch removed from -mm tree

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v3 Latest3 patches 3 repliesApplied 3/3
  2. v2 RFC3 patches 4 repliesSuperseded
  3. v1 RFC1 patch 2 repliesSuperseded

Changes in v3 from the cover letter

- rfc v2: https://lore.kernel.org/[email protected]
- Set kdamond_pid set callbacks.
- Support multiple enabled parameters setup on boot commandline.
- Acknowledge the third patch was discovered by Sashiko.

Patches in v3 All 3 applied

#Subject and filesSizeRepliesApplied
1/3mm/damon/reclaim: detect and use fresh enabled and kdamond_pid valuesmm/damon/reclaim.c+55 -301 replyApplied
2/3mm/damon/lru_sort: detect and use fresh enabled and kdamond_pid valuesmm/damon/lru_sort.c+55 -301 replyApplied
3/3mm/damon/stat: detect and use fresh enabled valuemm/damon/stat.c+20 -101 replyApplied

Reviews trailers per patch

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

Read the v3 thread

Cover letter [PATCH v3 0/3] mm/damon/modules: detect and use fresh status

DAMON modules including DAMON_RECLAIM, DAMON_LRU_SORT and DAMON_STAT commonly expose the kdamond running status via their parameters. Under certain scenarios including wrong user inputs and memory allocation failures, those parameter values can be stale. It can confuse users. For DAMON_RECLAIM and DAMON_LRU_SORT, it even makes the kdamond unable to be restarted before the system reboot.

The problem comes from the fact that there are multiple events for the status changes and it is difficult to follow up all the scenarios. Fix the issue by detecting and using the status on demand, instead of using a cached status that is difficult to be updated.

Patches 1-3 fix the bugs in DAMON_RECLAIM, DAMON_LRU_SORT and DAMON_STAT in the order.

Changes from RFC v2.1
- rfc v2.1: https://lore.kernel.org/[email protected]
- Rebase to latest mm-new.
Changes from RFC v2
- rfc v2: https://lore.kernel.org/[email protected]
- Set kdamond_pid set callbacks.
- Support multiple enabled parameters setup on boot commandline.
- Acknowledge the third patch was discovered by Sashiko.
Changes from v2
- v2: https://lore.kernel.org/[email protected]
- Add RFC tag back, for sashiko review.
- Detect and use fresh status instead of trying to catch up all scenarios.
- Change Liew from the responsible author to a credit-deserved co-developer.
- Move authorship responsibility to SJ.
- Add DAMON_STAT fix.
- RFC of the fix was posted separately
(https://lore.kernel.org/[email protected]), and only commit message wordsmithing is added in this version.
Changes from RFC
- rfc: https://lore.kernel.org/[email protected]
- Remove RFC tag.
- Remove 'damon_thread_status' structure and damon_update_thread_status() (SJ pointed out this was too much extension of core API for a problem that can be fixed more simply).
- Add a fallback in damon_{lru_sort, reclaim}_turn() 'N' path. If damon_stop() fails but kdamond is not running, forcefully reset the parameters.
- Reset 'enabled' and 'kdamond_pid' when damon_commit_ctx() fails in damon_{lru_sort, reclaim}_apply_parameters() (kdamond will terminate eventually in this case).

SeongJae Park (3):
mm/damon/reclaim: detect and use fresh enabled and kdamond_pid values mm/damon/lru_sort: detect and use fresh enabled and kdamond_pid values mm/damon/stat: detect and use fresh enabled value

 mm/damon/lru_sort.c | 85 +++++++++++++++++++++++++++++----------------
 mm/damon/reclaim.c  | 85 +++++++++++++++++++++++++++++----------------
 mm/damon/stat.c     | 30 ++++++++++------
 3 files changed, 130 insertions(+), 70 deletions(-)

base-commit: a51b50e60d2dae1f66329f147bde8723e6b1031e

Signature · 1 line
2.47.3