linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] kvm: mmu: move the added page that exists in current lru list to its tail
@ 2023-03-17  6:49 Jianwen Jiang
  0 siblings, 0 replies; only message in thread
From: Jianwen Jiang @ 2023-03-17  6:49 UTC (permalink / raw)
  To: akpm; +Cc: linux-mm, linux-kernel, guoke, jiangjianwen

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



^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2023-03-17  6:50 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-17  6:49 [PATCH] kvm: mmu: move the added page that exists in current lru list to its tail Jianwen Jiang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).