Skip to content

Commit

Permalink
ksm: use GET_KSM_PAGE_NOLOCK to get ksm page in remove_rmap_item_from…
Browse files Browse the repository at this point in the history
…_tree()

It's unnecessary to lock the page when get ksm page if we're going to
remove the rmap item as page migration is irrelevant in this case.  Use
GET_KSM_PAGE_NOLOCK instead to save some page lock cycles.

Link: https://lkml.kernel.org/r/[email protected]
Signed-off-by: Miaohe Lin <[email protected]>
Cc: Hugh Dickins <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
MiaoheLin authored and torvalds committed May 5, 2021
1 parent a08e1e1 commit 3e96b6a
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions mm/ksm.c
Original file line number Diff line number Diff line change
Expand Up @@ -778,12 +778,11 @@ static void remove_rmap_item_from_tree(struct rmap_item *rmap_item)
struct page *page;

stable_node = rmap_item->head;
page = get_ksm_page(stable_node, GET_KSM_PAGE_LOCK);
page = get_ksm_page(stable_node, GET_KSM_PAGE_NOLOCK);
if (!page)
goto out;

hlist_del(&rmap_item->hlist);
unlock_page(page);
put_page(page);

if (!hlist_empty(&stable_node->hlist))
Expand Down

0 comments on commit 3e96b6a

Please sign in to comment.