OSDN Git Service

mm: multi-gen LRU: avoid futile retries
authorYu Zhao <yuzhao@google.com>
Mon, 13 Feb 2023 07:53:22 +0000 (00:53 -0700)
committerAndrew Morton <akpm@linux-foundation.org>
Fri, 17 Feb 2023 04:43:54 +0000 (20:43 -0800)
commit9f550d78b40da21b4da515db4c37d8d7b12aa1a6
tree5bcf8622f7d5220ef30141a840975482d5efe2bf
parent6f7d760e86fa84862d749e36ebd29abf31f4f883
mm: multi-gen LRU: avoid futile retries

Recall that the per-node memcg LRU has two generations and they alternate
when the last memcg (of a given node) is moved from one to the other.
Each generation is also sharded into multiple bins to improve scalability.
A reclaimer starts with a random bin (in the old generation) and, if it
fails, it will retry, i.e., to try the rest of the bins.

If a reclaimer fails with the last memcg, it should move this memcg to the
young generation first, which causes the generations to alternate, and
then retry.  Otherwise, the retries will be futile because all other bins
are empty.

Link: https://lkml.kernel.org/r/20230213075322.1416966-1-yuzhao@google.com
Fixes: e4dde56cd208 ("mm: multi-gen LRU: per-node lru_gen_folio lists")
Signed-off-by: Yu Zhao <yuzhao@google.com>
Reported-by: T.J. Mercier <tjmercier@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
mm/vmscan.c