Skip to content

mm/damon: cleanup and refactoring code

SeongJae Park damon linux-mm lkml 2 versions – Applied

Status from this message: [merged mm-stable] mm-damon-sysfs-split-out-schemes-directory-implementation-to-separate-file.patch removed from -mm tree

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest12 patches 1 replyApplied 12/12
  2. v111 patches 0 repliesSuperseded

Changes in v2 from the cover letter

(https://lore.kernel.org/damon/[email protected]/):
- Add 10th patch, which splits schemes sysfs directory implementation

Patches in v2 All 12 applied

#Subject and filesSizeRepliesApplied
1/12mm/damon/core: split out DAMOS-charged region skip logic into a new functionmm/damon/core.c+65 -310 repliesApplied
2/12mm/damon/core: split damos application logic into a new functionmm/damon/core.c+39 -340 repliesApplied
3/12mm/damon/core: split out scheme stat update logic into a new functionmm/damon/core.c+11 -50 repliesApplied
4/12mm/damon/core: split out scheme quota adjustment logic into a new functionmm/damon/core.c+48 -430 repliesApplied
5/12mm/damon/sysfs: use damon_addr_range for regions' start and end valuesmm/damon/sysfs.c+11 -140 repliesApplied
6/12mm/damon/sysfs: remove parameters of damon_sysfs_region_alloc()mm/damon/sysfs.c+3 -110 repliesApplied
7/12mm/damon/sysfs: move sysfs_lock to common modulemm/damon/Makefile mm/damon/sysfs-common.c mm/damon/sysfs-common.h +1 more+24 -40 repliesApplied
8/12mm/damon/sysfs: move unsigned long range directory to common modulemm/damon/sysfs-common.c mm/damon/sysfs-common.h mm/damon/sysfs.c+109 -1000 repliesApplied
9/12mm/damon/sysfs: split out kdamond-independent schemes stats update logic into a new functionmm/damon/sysfs.c+21 -140 repliesApplied
10/12mm/damon/sysfs: split out schemes directory implementation to separate filemm/damon/Makefile mm/damon/sysfs-common.h mm/damon/sysfs-schemes.c +1 more+1045 -10190 repliesApplied
11/12mm/damon/modules: deduplicate init steps for DAMON context setupmm/damon/Makefile mm/damon/lru_sort.c mm/damon/modules-common.c +2 more+53 -300 repliesApplied
12/12mm/damon/{reclaim,lru_sort}: remove unnecessarily included headersmm/damon/lru_sort.c mm/damon/reclaim.c+0 -40 repliesApplied

Reviews trailers per patch

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

Read the v2 thread

Cover letter [PATCH v2 00/12] mm/damon: cleanup and refactoring code

Changes from v1
(https://lore.kernel.org/damon/[email protected]/):
- Add 10th patch, which splits schemes sysfs directory implementation

This patchset cleans up and refactors a range of DAMON code including the core, DAMON sysfs interface, and DAMON modules, for better readability and convenient future feature implementations.

In detail, this patchset splits unnecessarily long and complex functions in core into smaller functions (patches 1-4). Then, it cleans up the DAMON sysfs interface by using more type-safe code (patch 5) and removing unnecessary function parameters (patch 6). Further, it refactor the code by distributing the code into multiple files (patches 7-10). Last two patches (patches 11 and 12) deduplicates and remove unnecessary header inclusion in DAMON modules (reclaim and lru_sort).

Note that this initially posted as a part of a feature implementation RFC patchset[1], but separated into this patchset as the amount of the change is not small compared to the feature implementation change itself.

[1] https://lore.kernel.org/damon/[email protected]/

SeongJae Park (12):
mm/damon/core: split out DAMOS-charged region skip logic into a new
function
mm/damon/core: split damos application logic into a new function mm/damon/core: split out scheme stat update logic into a new function mm/damon/core: split out scheme quota adjustment logic into a new
function
mm/damon/sysfs: use damon_addr_range for regions' start and end values mm/damon/sysfs: remove parameters of damon_sysfs_region_alloc() mm/damon/sysfs: move sysfs_lock to common module mm/damon/sysfs: move unsigned long range directory to common module mm/damon/sysfs: split out kdamond-independent schemes stats update
logic into a new function
mm/damon/sysfs: split out schemes directory implementation to separate
file
mm/damon/modules: deduplicate init steps for DAMON context setup mm/damon/{reclaim,lru_sort}: remove unnecessarily included headers

 mm/damon/Makefile         |    6 +-
 mm/damon/core.c           |  262 +++++----
 mm/damon/lru_sort.c       |   19 +-
 mm/damon/modules-common.c |   42 ++
 mm/damon/modules-common.h |    3 +
 mm/damon/reclaim.c        |   19 +-
 mm/damon/sysfs-common.c   |  107 ++++
 mm/damon/sysfs-common.h   |   46 ++
 mm/damon/sysfs-schemes.c  | 1022 ++++++++++++++++++++++++++++++++
 mm/damon/sysfs.c          | 1152 +------------------------------------
 10 files changed, 1399 insertions(+), 1279 deletions(-)
 create mode 100644 mm/damon/modules-common.c
 create mode 100644 mm/damon/sysfs-common.c
 create mode 100644 mm/damon/sysfs-common.h
 create mode 100644 mm/damon/sysfs-schemes.c
Signature · 1 line
2.25.1