Re: [PATCH v5 1/4] memcg: introduce per-memcg reclaim interface
From: Michal Hocko
Date: Tue Apr 26 2022 - 04:23:16 EST
On Mon 25-04-22 12:31:51, Yosry Ahmed wrote:
> On Mon, Apr 25, 2022 at 12:15 PM David Rientjes <rientjes@xxxxxxxxxx> wrote:
> > "can over or under reclaim from the target cgroup" begs the question of
> > how much more memory the kernel can decide to reclaim :) I think it's
> > assumed that it's minimal and that matches the current implementation that
> > rounds up to SWAP_CLUSTER_MAX, though, so looks good.
> > Thanks Yosry!
> I think it could be more complex than this. Some functions that get
> called during reclaim only use the nr_to_reclaim parameter to check if
> they need one more iteration, but not to limit the actual reclaimed
> pages per say. For example, nr_to_reclaim is not even passed to
> shrink_slab() or mem_cgroup_soft_limit_reclaim(), so they have no way
> to know that they should stop if nr_to_reclaim was already satisfied.
> I think the general assumption is that each of these calls normally
> does not reclaim a huge number of pages, so like you said, the kernel
> should not over-reclaim too much. However, I don't think there are
> guarantees about this.
There are no guarantees indeed and it si definitely good to be explicit
about that so that userspace tools expect that and consider that in
the imeplementation. Sure we do not want to go overboard and huge excess
should be considered a bug. I am not sure we do agree on the notion of
"huge" so let's see.