[PATCH 0/4] thp: fix few MADV_DONTNEED races

From: Kirill A. Shutemov
Date: Thu Mar 02 2017 - 10:13:54 EST


For MADV_DONTNEED to work properly with huge pages, it's critical to not clear
pmd intermittently unless you hold down_write(mmap_sem). Otherwise
MADV_DONTNEED can miss the THP which can lead to userspace breakage.

See example of such race in commit message of patch 2/4.

All these races are found by code inspection. I haven't seen them triggered.
I don't think it's worth to apply them to stable@.

Kirill A. Shutemov (4):
thp: reduce indentation level in change_huge_pmd()
thp: fix MADV_DONTNEED vs. numa balancing race
thp: fix MADV_DONTNEED vs. MADV_FREE race
thp: fix MADV_DONTNEED vs clear soft dirty race

fs/proc/task_mmu.c | 9 +++++-
mm/huge_memory.c | 86 ++++++++++++++++++++++++++++++++++++------------------
2 files changed, 66 insertions(+), 29 deletions(-)

--
2.11.0