[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220914155142.bf388515a39fb45bae987231@linux-foundation.org>
Date: Wed, 14 Sep 2022 15:51:42 -0700
From: Andrew Morton <akpm@...ux-foundation.org>
To: Hongchen Zhang <zhanghongchen@...ngson.cn>
Cc: linux-mm@...ck.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] mm/vmscan: don't scan adjust too much if current is not
kswapd
On Wed, 14 Sep 2022 10:33:18 +0800 Hongchen Zhang <zhanghongchen@...ngson.cn> wrote:
> when a process falls into page fault and there is not enough free
> memory,it will do direct reclaim. At the same time,it is holding
> mmap_lock.So in case of multi-thread,it should exit from page fault
> ASAP.
> When reclaim memory,we do scan adjust between anon and file lru which
> may cost too much time and trigger hung task for other thread.So for a
> process which is not kswapd,it should just do a little scan adjust.
Well, that's a pretty nasty bug. Before diving into a possible fix,
can you please tell us more about how this happens? What sort of
machine, what sort of workload. Can you suggest why others are not
experiencing this?
> --- a/mm/vmscan.c
> +++ b/mm/vmscan.c
> @@ -3042,11 +3042,17 @@ static void shrink_lruvec(struct lruvec *lruvec, struct scan_control *sc)
> nr[lru] = targets[lru] * (100 - percentage) / 100;
> nr[lru] -= min(nr[lru], nr_scanned);
>
> + if (!current_is_kswapd())
> + nr[lru] = min(nr[lru], nr_to_reclaim);
> +
> lru += LRU_ACTIVE;
> nr_scanned = targets[lru] - nr[lru];
> nr[lru] = targets[lru] * (100 - percentage) / 100;
> nr[lru] -= min(nr[lru], nr_scanned);
>
> + if (!current_is_kswapd())
> + nr[lru] = min(nr[lru], nr_to_reclaim);
> +
> scan_adjusted = true;
> }
> blk_finish_plug(&plug);
It would be better if these additions had code comments explaining why
they're there. But let's more fully understand the problem before
altering your patch.
Powered by blists - more mailing lists