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-22165-1-git-send-email-aarcange@redhat.com
Showing the changes to include/linux (1 of 3 files). Show all
Unified · Split
| @@ -152,6 +152,7 @@ static inline bool is_huge_zero_pmd(pmd_t pmd) · 151 unmodified lines | ||
| 152 | 152 | } |
| 153 | 153 | |
| 154 | 154 | struct page *get_huge_zero_page(void); |
| 155 | +void put_huge_zero_page(void); | |
| 155 | 156 | |
| 156 | 157 | #else /* CONFIG_TRANSPARENT_HUGEPAGE */ |
| 157 | 158 | #define HPAGE_PMD_SHIFT ({ BUILD_BUG(); 0; }) |
| @@ -208,6 +209,10 @@ static inline bool is_huge_zero_page(struct page *page) · 50 unmodified lines | ||
| 208 | 209 | return false; |
| 209 | 210 | } |
| 210 | 211 | |
| 212 | +static inline void put_huge_zero_page(void) | |
| 213 | +{ | |
| 214 | + BUILD_BUG(); | |
| 215 | +} | |
| 211 | 216 | |
| 212 | 217 | static inline struct page *follow_devmap_pmd(struct vm_area_struct *vma, |
| 213 | 218 | unsigned long addr, pmd_t *pmd, int flags) |