thp: keep huge zero page pinned until tlb flush
authorKirill A. Shutemov <[email protected]>
Thu, 28 Apr 2016 23:18:27 +0000 (16:18 -0700)
committerLinus Torvalds <[email protected]>
Fri, 29 Apr 2016 02:34:04 +0000 (19:34 -0700)
commitaa88b68c3b1dce8bc3fd54c8a7372a777ff265cd
tree98ad92a044b6a2f39a8fa4c1c24df001108bd1a8
parent66ee95d16a7f1b7b4f1dd74a2d81c6e19dc29a14
thp: keep huge zero page pinned until tlb flush

Andrea has found[1] a race condition on MMU-gather based TLB flush vs
split_huge_page() or shrinker which frees huge zero under us (patch 1/2
and 2/2 respectively).

With new THP refcounting, we don't need patch 1/2: mmu_gather keeps the
page pinned until flush is complete and the pin prevents the page from
being split under us.

We still need patch 2/2.  This is simplified version of Andrea's patch.
We don't need fancy encoding.

[1] http://lkml.kernel.org/r/1447938052[email protected]

Signed-off-by: Kirill A. Shutemov <[email protected]>
Reported-by: Andrea Arcangeli <[email protected]>
Reviewed-by: Andrea Arcangeli <[email protected]>
Cc: "Aneesh Kumar K.V" <[email protected]>
Cc: Mel Gorman <[email protected]>
Cc: Hugh Dickins <[email protected]>
Cc: Johannes Weiner <[email protected]>
Cc: Dave Hansen <[email protected]>
Cc: Vlastimil Babka <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
include/linux/huge_mm.h
mm/huge_memory.c
mm/swap.c