[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20230317064920.12700-1-jiangjianwen@uniontech.com>
Date: Fri, 17 Mar 2023 14:49:20 +0800
From: Jianwen Jiang <jiangjianwen@...ontech.com>
To: akpm@...ux-foundation.org
Cc: linux-mm@...ck.org, linux-kernel@...r.kernel.org,
guoke@...ontech.com, jiangjianwen@...ontech.com
Subject: [PATCH] kvm: mmu: move the added page that exists in current lru list to its tail
From: jevon jiang <jiangjianwen@...ontech.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@...ontech.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
Powered by blists - more mailing lists