Re: [PATCH] mm, memcg: Bypass high reclaim iteration for cgroup hierarchy root

From: Johannes Weiner
Date: Thu Apr 02 2020 - 11:18:57 EST


On Thu, Mar 12, 2020 at 04:41:37PM +0000, Chris Down wrote:
> The root of the hierarchy cannot have high set, so we will never reclaim
> based on it. This makes that clearer and avoids another entry.
>
> Signed-off-by: Chris Down <chris@xxxxxxxxxxxxxx>
> Cc: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
> Cc: Johannes Weiner <hannes@xxxxxxxxxxx>
> Cc: Tejun Heo <tj@xxxxxxxxxx>
> Cc: linux-mm@xxxxxxxxx
> Cc: cgroups@xxxxxxxxxxxxxxx
> Cc: linux-kernel@xxxxxxxxxxxxxxx
> Cc: kernel-team@xxxxxx

This makes sense, memory.high doesn't exist on the root.

And the mem_cgroup_is_root() check, a simple pointer comparison, is
cheaper than reading the page_counter atomic and memcg->high (which we
already know to be PAGE_COUNTER_MAX).

Acked-by: Johannes Weiner <hannes@xxxxxxxxxxx>