lkml.org 
[lkml]   [2024]   [May]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Subject[PATCH 0/2] mm/ksm: optimize unstable_tree_search_insert()
Date
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>


\
 
 \ /
  Last update: 2024-05-08 13:38    [W:0.026 / U:2.152 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site