Re: [RFC PATCH] mm/damon: fix damos quota walk-position tracking

From: SJ Park

Date: Tue Aug 25 2026 - 10:07:17 EST


On Tue, 25 Aug 2026 20:46:16 +0800 Liew Rui Yan <aethernet65535@xxxxxxxxx> wrote:

> DAMOS uses charge_target_from/charge_addr_from to remember how far a
> quota-limited walk has progressed. The current implementation has two
> problems:
>
> 1. Once set, the cursor unconditionally skips and resets at the last
> region of the tracked target, so the last region can be skipped even
> when it has not been processed.

I don't fully understand this. Could you please clarify more? Maybe adding a
realistic example scenario would be helpful.

>
> 2. The cursor only advances when the quota becomes full. Regions that
> are filtered out do not move the cursor, and the scheme can remain
> stuck on the same regions.

I don't fully understand this, either. Could you pleae clarify more?

>
> Fix this by treating the fields as a rotating walk cursor:
>
> - Advance the cursor for every region walked while a quota is set,
> regardless of whether the region is applied or filtered out.
> - Remove the unconditional last-region reset.
> - Skip regions before the cursor, and rotate to the next valid target
> only after the current target has been fully walked.
> - Rename charge_{target,addr}_from to walk_{target,addr}_from and
> damos_skip_charged_region() to damos_skip_walked_region().

Because I don't understand the problem, I can't understand benefit of this
change. Again, more clarification would be helpful.

>
> Signed-off-by: Liew Rui Yan <aethernet65535@xxxxxxxxx>
> ---
> include/linux/damon.h | 6 +-
> mm/damon/core.c | 156 +++++++++++++++++++++++++++++-------------
> 2 files changed, 111 insertions(+), 51 deletions(-)

Quite amount of change. I will review the code after the high level
understanding is done.


Thanks,
SJ

[...]