[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240508-b4-ksm-unstable-insert-v1-0-631cdbc2b77f@linux.dev>
Date: Wed, 08 May 2024 19:35:40 +0800
From: Chengming Zhou <chengming.zhou@...ux.dev>
To: Andrew Morton <akpm@...ux-foundation.org>,
David Hildenbrand <david@...hat.com>,
Andrea Arcangeli <aarcange@...hat.com>, Stefan Roesch <shr@...kernel.io>,
Hugh Dickins <hughd@...gle.com>
Cc: linux-mm@...ck.org, linux-kernel@...r.kernel.org,
zhouchengming@...edance.com, Chengming Zhou <chengming.zhou@...ux.dev>
Subject: [PATCH 0/2] mm/ksm: optimize unstable_tree_search_insert()
We use unstable_tree_search_insert() to find matched page or insert our
rmap_item into the unstable tree if no matched found.
Now it may return NULL too early in which cases we can do better:
1. get_mergeable_page() return NULL: which means tree_rmap_item is stale.
2. tree_page is migrated to another node and !ksm_merge_across_nodes.
In both cases, we can just remove the staled or migrated one out of the
unstable tree, so our rmap_item can be inserted successfully. The code
flow becomes clearer and may increase the merge possibility too.
Thanks for review and comments!
Signed-off-by: Chengming Zhou <chengming.zhou@...ux.dev>
---
Chengming Zhou (2):
mm/ksm: re-search unstable tree when tree_rmap_item is stale
mm/ksm: flush out migrated rmap_item to insert our rmap_item
mm/ksm.c | 31 +++++++++++++++++++------------
1 file changed, 19 insertions(+), 12 deletions(-)
---
base-commit: fb0f40125feec3de7ef4524600ac83946207117e
change-id: 20240508-b4-ksm-unstable-insert-0329446317e1
Best regards,
--
Chengming Zhou <chengming.zhou@...ux.dev>
Powered by blists - more mailing lists