2024-06-04 04:22:57

by alexs

[permalink] [raw]
Subject: [PATCH 06/10] mm/ksm: remove page_stable_node

From: "Alex Shi (tencent)" <[email protected]>

Since folio_stable_node could replace page_stable_node now, the latter
function could be removed and save a bit context.

Signed-off-by: Alex Shi (tencent) <[email protected]>
---
mm/ksm.c | 9 ++-------
1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/mm/ksm.c b/mm/ksm.c
index f68779651841..24de562b64e1 100644
--- a/mm/ksm.c
+++ b/mm/ksm.c
@@ -1086,11 +1086,6 @@ static inline struct ksm_stable_node *folio_stable_node(struct folio *folio)
return folio_test_ksm(folio) ? folio_raw_mapping(folio) : NULL;
}

-static inline struct ksm_stable_node *page_stable_node(struct page *page)
-{
- return folio_stable_node(page_folio(page));
-}
-
static inline void folio_set_stable_node(struct folio *folio,
struct ksm_stable_node *stable_node)
{
@@ -2324,7 +2319,8 @@ static void cmp_and_merge_page(struct page *page, struct ksm_rmap_item *rmap_ite
bool max_page_sharing_bypass = false;
struct folio *folio, *kfolio;

- stable_node = page_stable_node(page);
+ folio = page_folio(page);
+ stable_node = folio_stable_node(folio);
if (stable_node) {
if (stable_node->head != &migrate_nodes &&
get_kpfn_nid(READ_ONCE(stable_node->kpfn)) !=
@@ -2345,7 +2341,6 @@ static void cmp_and_merge_page(struct page *page, struct ksm_rmap_item *rmap_ite
}

/* We first start with searching the page inside the stable tree */
- folio = page_folio(page);
kfolio = stable_tree_search(folio);
if (kfolio == folio && rmap_item->head == stable_node) {
folio_put(kfolio);
--
2.43.0