Re: [PATCH mm-unstable v1 2/4] mm: increment gen # before restarting traversal
From: Johannes Weiner
Date: Thu Jul 25 2024 - 16:53:46 EST
On Wed, Jul 24, 2024 at 07:02:12PM +0000, Kinsey Ho wrote:
> The generation number in struct mem_cgroup_reclaim_iter should be
> incremented on every round-trip. Currently, it is possible for a
> concurrent reclaimer to jump in at the end of the hierarchy, causing a
> traversal restart (resetting the iteration position) without
> incrementing the generation number.
>
> Move the traversal restart such that the generation number is
> incremented before the restart.
>
> Signed-off-by: Kinsey Ho <kinseyho@xxxxxxxxxx>
The consequence of resetting the position without bumping the
generation would be that another ongoing mem_cgroup_iter() could walk
the tree twice, which is undesirable. It would be good to spell that
out in the changelog.
Otherwise, looks good to me.
Acked-by: Johannes Weiner <hannes@xxxxxxxxxxx>