[RFC PATCH 0/7] mm/damon: define and use DAMON initialization check function

SeongJae Park posted 7 patches 2 weeks, 6 days ago
There is a newer version of this series
include/linux/damon.h |  1 +
mm/damon/core.c       | 10 ++++++++++
mm/damon/lru_sort.c   |  9 +++++++--
mm/damon/reclaim.c    |  9 +++++++--
mm/damon/stat.c       | 10 ++++++----
samples/damon/mtier.c | 11 +++++++----
samples/damon/prcl.c  | 11 +++++++----
samples/damon/wsse.c  | 15 +++++++++------
8 files changed, 54 insertions(+), 22 deletions(-)
[RFC PATCH 0/7] mm/damon: define and use DAMON initialization check function
Posted by SeongJae Park 2 weeks, 6 days ago
If DAMON is tried to be used by its API callers when it is not yet
successfully initialized, the callers could be crashed.  Such issues
actually happened and were fixed [1].  DAMON API callers are therefore
having their own hacks for seeing if it is safe to use DAMON or not.
Those built on an untreliable assumption that DAMON should be ready to
be used on module init time.  DAMON initialization could fail if
KMEM_CACHE() fails, though.  Also those are basically duplications that
make their maintenance difficult.

Make it reliable and easy to maintain, by implementing a new DAMON core
layer API function for seeing if DAMON is ready to be used or not, and
replacing the hacks of DAMON API callers with the new core layer
function.

[1] https://lore.kernel.org/20250909022238.2989-1-sj@kernel.org

SeongJae Park (7):
  mm/damon/core: implement damon_initialized() function
  mm/damon/stat: use damon_initialized()
  mm/damon/reclaim: use damon_initialized()
  mm/damon/lru_sort: use damon_initialized()
  samples/damon/wsse: use damon_initialized()
  samples/damon/prcl: use damon_initialized()
  samples/damon/mtier: use damon_initialized()

 include/linux/damon.h |  1 +
 mm/damon/core.c       | 10 ++++++++++
 mm/damon/lru_sort.c   |  9 +++++++--
 mm/damon/reclaim.c    |  9 +++++++--
 mm/damon/stat.c       | 10 ++++++----
 samples/damon/mtier.c | 11 +++++++----
 samples/damon/prcl.c  | 11 +++++++----
 samples/damon/wsse.c  | 15 +++++++++------
 8 files changed, 54 insertions(+), 22 deletions(-)


base-commit: f115189b48629e7a8aa707112190b7ccf9928d6b
-- 
2.39.5