Re: [PATCH v2 2/5] mm: damon must atomically clear young on ptes and pmds

From: Ryan Roberts
Date: Fri May 19 2023 - 04:54:06 EST


On 18/05/2023 18:13, SeongJae Park wrote:
> Hi Ryan,
>
>
> Nit. For consistency of DAMON commits subjects, I'd prefer something like
> "mm/damon/ops-common: atomically test and clear young on ptes and pmds".
>
> On Thu, 18 May 2023 12:07:24 +0100 Ryan Roberts <ryan.roberts@xxxxxxx> wrote:
>
>> It is racy to non-atomically read a pte, then clear the young bit, then
>> write it back as this could discard dirty information. Further, it is
>> bad practice to directly set a pte entry within a table. Instead
>> clearing young must go through the arch-provided helper,
>> ptep_test_and_clear_young() to ensure it is modified atomically and to
>> give the arch code visibility and allow it to check (and potentially
>> modify) the operation.
>>
>> Fixes: 46c3a0accdc4 ("mm/damon/vaddr: separate commonly usable functions")
>
> Nit. The commit is only for refactoring. The original code camde from commit
> 3f49584b262c ("mm/damon: implement primitives for the virtual memory address
> spaces").
>
>> Signed-off-by: Ryan Roberts <ryan.roberts@xxxxxxx>
>> Reviewed-by: Zi Yan <ziy@xxxxxxxxxx>
>
> Other than above nits,
>
> Reviewed-by: SeongJae Park <sj@xxxxxxxxxx>

Thanks for the reviews! I'll fix the nits you raised for v3.

>
>
> Thanks,
> SJ
>