linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Jianwen Jiang <jiangjianwen@uniontech.com>
To: akpm@linux-foundation.org
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	guoke@uniontech.com, jiangjianwen@uniontech.com
Subject: [PATCH] kvm: mmu: move the added page that exists in current lru list to its tail
Date: Fri, 17 Mar 2023 14:49:20 +0800	[thread overview]
Message-ID: <20230317064920.12700-1-jiangjianwen@uniontech.com> (raw)

From: jevon jiang <jiangjianwen@uniontech.com>

If the added page existing in current lru list, it's better to move that
page to the end of that list. This modification can prolong the lifecycle
of activated page and decrease I/O requirements while memory is limited.

Signed-off-by: jevon jiang <jiangjianwen@uniontech.com>
---
 mm/list_lru.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/mm/list_lru.c b/mm/list_lru.c
index a05e5bef3b40..9562e7aea535 100644
--- a/mm/list_lru.c
+++ b/mm/list_lru.c
@@ -124,7 +124,11 @@ bool list_lru_add(struct list_lru *lru, struct list_head *item)
 	struct list_lru_one *l;
 
 	spin_lock(&nlru->lock);
-	if (list_empty(item)) {
+	if (!list_empty(item)) {
+		l = list_lru_from_kmem(lru, nid, item, NULL);
+		list_del_init(item);
+		list_add_tail(item, &l->list);
+	} else {
 		l = list_lru_from_kmem(lru, nid, item, &memcg);
 		list_add_tail(item, &l->list);
 		/* Set shrinker bit if the first element was added */
-- 
2.34.1



                 reply	other threads:[~2023-03-17  6:50 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=20230317064920.12700-1-jiangjianwen@uniontech.com \
    --to=jiangjianwen@uniontech.com \
    --cc=akpm@linux-foundation.org \
    --cc=guoke@uniontech.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    /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