[RFC PATCH 0/4] mm/damon: allow NULL or unstarted damon_ctx parameter for damon_call()

From: SJ Park

Date: Wed Aug 12 2026 - 23:50:32 EST


Callers of damon_call() should validate the damon_ctx object parameter.
If it is NULL or never damon_start()-ed object, damon_call() could
dereference the NULL pointer or indefinitely hang. Ensuring all callers
doing the validation correctly has turned out to be difficult. Handle
the corner cases inside the core layer and remove callers' validations.

Patches 1 and 2 respectively allow passing NULL and not yet
damon_start()-ed ctx parameter to damon_call(). Patches 3 and 4 remove
the callers side validations in DMON_RECLAIM and DASMON_LRU_SORT,
respectively.

SJ Park (4):
mm/damon/core: handle NULL ctx parameter in damon_call()
mm/damon/core: set ctx->call_controls_obsolete in damon_new_ctx()
mm/damon/reclaim: remove unnecessary damon_call() param validation
mm/damon/lru_sort: remove unnecessary damon_call() param validation

mm/damon/core.c | 7 +++----
mm/damon/lru_sort.c | 8 --------
mm/damon/reclaim.c | 8 --------
3 files changed, 3 insertions(+), 20 deletions(-)


base-commit: c8520e181a2aaf85290d0447656de0df112dbbea
--
2.47.3