Re: [PATCH] mm: vmscan: fix extreme overreclaim and swap floods

From: Johannes Weiner
Date: Sat Nov 12 2022 - 09:23:45 EST


On Tue, Sep 20, 2022 at 02:12:17PM +0800, Hongchen Zhang wrote:
> On 2022/8/3 am 12:28, Johannes Weiner wrote:
> > @@ -2988,8 +2988,6 @@ static void shrink_lruvec(struct lruvec *lruvec, struct scan_control *sc)
> > nr_scanned = targets[lru] - nr[lru];
> > nr[lru] = targets[lru] * (100 - percentage) / 100;
> > nr[lru] -= min(nr[lru], nr_scanned);
> We should not just remove the following line because kswapd may also call
> this function and there is no side effect to do scan adjust for kswapd,so it
> may be better to change like this:
> + if (current_is_kswapd())
> scan_adjusted = true;
> > -
> > - scan_adjusted = true

There is no scan_adjusted after this patch.

If you're saying that kswapd should set proportional_reclaim
unconditionally, then no, it should not. Proportional reclaim is not
safe at lower priority levels, as the changelog outlines in detail.