Re: [PATCH v29 04/13] mm/idle_page_tracking: Make PG_idle reusable

From: Shah, Amit
Date: Fri Jun 11 2021 - 08:55:49 EST


On Thu, 2021-05-20 at 07:56 +0000, SeongJae Park wrote:
> From: SeongJae Park <sjpark@xxxxxxxxx>
>
> PG_idle and PG_young allow the two PTE Accessed bit users, Idle Page
> Tracking and the reclaim logic concurrently work while don't interfere

... while not interfering with ...

> each other. That is, when they need to clear the Accessed bit, they set
> PG_young to represent the previous state of the bit, respectively. And
> when they need to read the bit, if the bit is cleared, they further read
> the PG_young to know whether the other has cleared the bit meanwhile or
> not.
>
> We could add another page flag and extend the mechanism to use the flag
> if we need to add another concurrent PTE Accessed bit user subsystem.
> However, the space is limited. Meanwhile, if the new subsystem is
> mutually exclusive with IDLE_PAGE_TRACKING or interfering with it is not
> a real problem, it would be ok to simply reuse the PG_idle flag.
> However, it's impossible because the flags are dependent on
> IDLE_PAGE_TRACKING.

For better readability, I suggest:

For yet another user of the PTE Accessed bit, we could add another page
flag, or extend the mechanism to use the flags. For the DAMON usecase,
however, we don't need to do that just yet. IDLE_PAGE_TRACKING and
DAMON are mutually exclusive, so there's only ever going to be one user
of the current set of flags.

In this commit, we split out the CONFIG options to allow for the use of
PG_young and PG_idle outside of idle page tracking.

>
> To allow such reuse of the flags, this commit separates the PG_young and
> PG_idle flag logic from IDLE_PAGE_TRACKING and introduces new kernel
> config, 'PAGE_IDLE_FLAG'. Hence, a new subsystem would be able to reuse
> PG_idle without depending on IDLE_PAGE_TRACKING.
>
> In the next commit, DAMON's reference implementation of the virtual
> memory address space monitoring primitives will use it.

[...]

Cheers,

Amit



Amazon Development Center Germany GmbH
Krausenstr. 38
10117 Berlin
Geschaeftsfuehrung: Christian Schlaeger, Jonathan Weiss
Eingetragen am Amtsgericht Charlottenburg unter HRB 149173 B
Sitz: Berlin
Ust-ID: DE 289 237 879