linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] mm/ksm: optimize unstable_tree_search_insert()
@ 2024-05-08 11:35 Chengming Zhou
  2024-05-08 11:35 ` [PATCH 1/2] mm/ksm: re-search unstable tree when tree_rmap_item is stale Chengming Zhou
  2024-05-08 11:35 ` [PATCH 2/2] mm/ksm: flush out migrated rmap_item to insert our rmap_item Chengming Zhou
  0 siblings, 2 replies; 3+ messages in thread
From: Chengming Zhou @ 2024-05-08 11:35 UTC (permalink / raw)
  To: Andrew Morton, David Hildenbrand, Andrea Arcangeli,
	Stefan Roesch, Hugh Dickins
  Cc: linux-mm, linux-kernel, zhouchengming, Chengming Zhou

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@linux.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@linux.dev>



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-05-08 11:38 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-05-08 11:35 [PATCH 0/2] mm/ksm: optimize unstable_tree_search_insert() Chengming Zhou
2024-05-08 11:35 ` [PATCH 1/2] mm/ksm: re-search unstable tree when tree_rmap_item is stale Chengming Zhou
2024-05-08 11:35 ` [PATCH 2/2] mm/ksm: flush out migrated rmap_item to insert our rmap_item Chengming Zhou

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox