Skip to content

Commit 6286229

Browse files
Hugh Dickinstorvalds
authored andcommitted
ksm: revert "use GET_KSM_PAGE_NOLOCK to get ksm page in remove_rmap_item_from_tree()"
This reverts commit 3e96b6a. 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.anvils Signed-off-by: Hugh Dickins <hughd@google.com> Cc: Miaohe Lin <linmiaohe@huawei.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent 7ed9d23 commit 6286229

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

mm/ksm.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -776,11 +776,12 @@ static void remove_rmap_item_from_tree(struct rmap_item *rmap_item)
776776
struct page *page;
777777

778778
stable_node = rmap_item->head;
779-
page = get_ksm_page(stable_node, GET_KSM_PAGE_NOLOCK);
779+
page = get_ksm_page(stable_node, GET_KSM_PAGE_LOCK);
780780
if (!page)
781781
goto out;
782782

783783
hlist_del(&rmap_item->hlist);
784+
unlock_page(page);
784785
put_page(page);
785786

786787
if (!hlist_empty(&stable_node->hlist))

0 commit comments

Comments
 (0)