]> git.baikalelectronics.ru Git - kernel.git/commitdiff
ksm: use GET_KSM_PAGE_NOLOCK to get ksm page in remove_rmap_item_from_tree()
authorMiaohe Lin <linmiaohe@huawei.com>
Wed, 5 May 2021 01:37:39 +0000 (18:37 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Wed, 5 May 2021 18:27:24 +0000 (11:27 -0700)
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/20210330140228.45635-3-linmiaohe@huawei.com
Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
Cc: Hugh Dickins <hughd@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
mm/ksm.c

index 7b6bc10365963f0b0d09e1fac5d5651a61c6d2cf..31dcbd4d3ac9e5b44f5eb768cd932b268d67c5a1 100644 (file)
--- a/mm/ksm.c
+++ b/mm/ksm.c
@@ -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))