DAMON development mailing list
 help / color / mirror / Atom feed
* [RFC PATCH v1.1 00/11] mm/damon: refactor damon_{start,stop,commit}() for simple error handling
@ 2026-07-05 16:01 SJ Park
  2026-07-05 16:01 ` [RFC PATCH v1.1 01/11] mm/damon/core: stop ctxs in damon_start() before returning an error SJ Park
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: SJ Park @ 2026-07-05 16:01 UTC (permalink / raw)
  Cc: SJ Park, Andrew Morton, damon, linux-kernel, linux-mm

damon_start() and damon_stop() could leave a few of requested DAMON
contexts running when they return an error.  damon_commit() failure
stops the DAMON context, but in an asynchronous way.  Callers should
stop the left-over DAMON contexts.  It is easy to make mistakes, and
indeed a few bugs from such mistakes were found and fixed.

Refactor the core API functions to guarantee contexts are completely
stopped under failures.  Remove the caller side error handlers that are
no longer needed due to the refactoring.

Patches Sequence
================

Patch 1 refactors damon_start() to ensure all contexts are stopped for
failures.  Patch 2 updates unnecessary damon_start() error handling from
mtier sample module.

Patch 3 refactors damon_stop() to always success.  Patches 4-6 updates
callers (damon_{sysfs,reclaim lru_sort}) to ignore the return value.
Patch 7 update damon_stop() return value to void.  Patch 8 simplifies
damon_stop() error handling in mtier sample module.

Patch 9 refactors damon_call() to return errors only after the context
is completely stopped.  Patches 10 and 11 remove unnecessary error
handlings from callers (wsse and prcl sample modules).

Changelog
=========

Changes from RFC v1
- RFC v1: https://lore.kernel.org/20260704181135.132956-1-sj@kernel.org
- Fix ABBA deadlock in damon_start().
- Wait instead of doing racy-stop in damon_call().

SJ Park (11):
  mm/damon/core: stop ctxs in damon_start() before returning an error
  samples/damon/mtier: do not stop first context for damon_start()
    failure
  mm/damon/core: make damon_stop() never fails
  mm/damon/sysfs: ignore damon_stop() return value
  mm/damon/reclaaim: ignore damon_stop() return value
  mm/damon/lru_sort: ignore damon_stop() return value
  mm/damon/core: change damon_stop() return type to void
  samples/damon/mtier: stop all contexts with single damon_stop() call
  mm/damon/core: wait ctx stop in damon_call() before reruning an error
  samples/damon/wsse: do not stop ctx for damon_call() failure
  samples/damon/prcl: do not stop DAMON for damon_call() failure

 include/linux/damon.h |  2 +-
 mm/damon/core.c       | 37 +++++++++++++++++++------------------
 mm/damon/lru_sort.c   |  6 ++++--
 mm/damon/reclaim.c    |  6 ++++--
 mm/damon/sysfs.c      |  3 ++-
 samples/damon/mtier.c |  5 +----
 samples/damon/prcl.c  |  4 +---
 samples/damon/wsse.c  |  4 +---
 8 files changed, 33 insertions(+), 34 deletions(-)


base-commit: abe5b65a9c676375c3f118d453037f2f9ebbb7ac
-- 
2.47.3

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2026-07-05 16:01 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-05 16:01 [RFC PATCH v1.1 00/11] mm/damon: refactor damon_{start,stop,commit}() for simple error handling SJ Park
2026-07-05 16:01 ` [RFC PATCH v1.1 01/11] mm/damon/core: stop ctxs in damon_start() before returning an error SJ Park
2026-07-05 16:01 ` [RFC PATCH v1.1 02/11] samples/damon/mtier: do not stop first context for damon_start() failure SJ Park
2026-07-05 16:01 ` [RFC PATCH v1.1 03/11] mm/damon/core: make damon_stop() never fails SJ Park
2026-07-05 16:01 ` [RFC PATCH v1.1 04/11] mm/damon/sysfs: ignore damon_stop() return value SJ Park
2026-07-05 16:01 ` [RFC PATCH v1.1 05/11] mm/damon/reclaaim: " SJ Park
2026-07-05 16:01 ` [RFC PATCH v1.1 06/11] mm/damon/lru_sort: " SJ Park
2026-07-05 16:01 ` [RFC PATCH v1.1 07/11] mm/damon/core: change damon_stop() return type to void SJ Park
2026-07-05 16:01 ` [RFC PATCH v1.1 08/11] samples/damon/mtier: stop all contexts with single damon_stop() call SJ Park
2026-07-05 16:01 ` [RFC PATCH v1.1 09/11] mm/damon/core: wait ctx stop in damon_call() before reruning an error SJ Park
2026-07-05 16:01 ` [RFC PATCH v1.1 10/11] samples/damon/wsse: do not stop ctx for damon_call() failure SJ Park
2026-07-05 16:01 ` [RFC PATCH v1.1 11/11] samples/damon/prcl: do not stop DAMON " SJ Park

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox