linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: "zhaoyang.huang" <zhaoyang.huang@unisoc.com>
To: Andrew Morton <akpm@linux-foundation.org>,
	Yu Zhao <yuzhao@google.com>, <linux-mm@kvack.org>,
	<linux-kernel@vger.kernel.org>,
	Zhaoyang Huang <huangzhaoyang@gmail.com>, <steve.kang@unisoc.com>
Subject: [RFC PATCH] mm: keep LRU order by move unisolated folios to tail
Date: Mon, 22 Jul 2024 18:23:38 +0800	[thread overview]
Message-ID: <20240722102338.2567810-1-zhaoyang.huang@unisoc.com> (raw)

From: Zhaoyang Huang <zhaoyang.huang@unisoc.com>

Unlike legacy LRU management, MGLRU will switch to other zones or types
when current lrugen[gen][type][zone] scanning failed, which means skipped
folios could become available in next scan. This commit would like to
suggest to keep the LRU's order by moving unisolated folios to the tail
of LRU during the first 2 round scan to avoid potential livelock on the
unisolated ones.

Signed-off-by: Zhaoyang Huang <zhaoyang.huang@unisoc.com>
---
 mm/vmscan.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/mm/vmscan.c b/mm/vmscan.c
index 2e34de9cd0d4..cd1f38bb1d45 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -4397,7 +4397,10 @@ static int scan_folios(struct lruvec *lruvec, struct scan_control *sc,
 		}
 
 		if (skipped_zone) {
-			list_splice(&moved, head);
+			if (sc->priority > DEF_PRIORITY - 2)
+				list_splice_tail(&moved, head);
+			else
+				list_splice(&moved, head);
 			__count_zid_vm_events(PGSCAN_SKIP, zone, skipped_zone);
 			skipped += skipped_zone;
 		}
-- 
2.25.1



                 reply	other threads:[~2024-07-22 10:24 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240722102338.2567810-1-zhaoyang.huang@unisoc.com \
    --to=zhaoyang.huang@unisoc.com \
    --cc=akpm@linux-foundation.org \
    --cc=huangzhaoyang@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=steve.kang@unisoc.com \
    --cc=yuzhao@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox