Commit 62862290 authored by Hugh Dickins's avatar Hugh Dickins Committed by Linus Torvalds

ksm: revert "use GET_KSM_PAGE_NOLOCK to get ksm page in remove_rmap_item_from_tree()"

This reverts commit 3e96b6a2.  General
Protection Fault in rmap_walk_ksm() under memory pressure:
remove_rmap_item_from_tree() needs to take page lock, of course.

Link: https://lkml.kernel.org/r/alpine.LSU.2.11.2105092253500.1127@eggly.anvilsSigned-off-by: default avatarHugh Dickins <hughd@google.com>
Cc: Miaohe Lin <linmiaohe@huawei.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 7ed9d238
...@@ -776,11 +776,12 @@ static void remove_rmap_item_from_tree(struct rmap_item *rmap_item) ...@@ -776,11 +776,12 @@ static void remove_rmap_item_from_tree(struct rmap_item *rmap_item)
struct page *page; struct page *page;
stable_node = rmap_item->head; stable_node = rmap_item->head;
page = get_ksm_page(stable_node, GET_KSM_PAGE_NOLOCK); page = get_ksm_page(stable_node, GET_KSM_PAGE_LOCK);
if (!page) if (!page)
goto out; goto out;
hlist_del(&rmap_item->hlist); hlist_del(&rmap_item->hlist);
unlock_page(page);
put_page(page); put_page(page);
if (!hlist_empty(&stable_node->hlist)) if (!hlist_empty(&stable_node->hlist))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment