Re: [PATCH v3 2/4] mm/damon/ops-common: atomically test and clear young on ptes and pmds

From: Yu Zhao
Date: Fri Jun 02 2023 - 12:35:50 EST


On Fri, Jun 2, 2023 at 3:30 AM 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: 3f49584b262c ("mm/damon: implement primitives for the virtual memory address spaces").

Just to double check: was "Cc: stable@xxxxxxxxxxxxxxx" overlooked or
deemed unnecessary?

> Signed-off-by: Ryan Roberts <ryan.roberts@xxxxxxx>
> Reviewed-by: Zi Yan <ziy@xxxxxxxxxx>
> Reviewed-by: SeongJae Park <sj@xxxxxxxxxx>
> Reviewed-by: Mike Rapoport (IBM) <rppt@xxxxxxxxxx>