This set makes uprobe aware of THPs. Currently, when uprobe is attached to text on THP, the page is split by FOLL_SPLIT. As a result, uprobe eliminates the performance benefit of THP. This set makes uprobe THP-aware. Instead of FOLL_SPLIT, we only split PMD for uprobe. After all uprobes within the THP are removed, the PTEs are regrouped into huge PMD. Note that, with uprobes attached, the process runs with PTEs for the huge page. The performance benefit of THP is recovered _after_ all uprobes on the huge page are detached. This set (plus a few small debug patches) is also available at https://github.com/liu-song-6/linux/tree/uprobe-thp Song Liu (4): mm, thp: allow preallocate pgtable for split_huge_pmd_address() uprobe: use original page when all uprobes are removed uprobe: support huge page by only splitting the pmd uprobe: collapse THP pmd after removing all uprobes include/linux/huge_mm.h | 22 ++++++++- kernel/events/uprobes.c | 82 +++++++++++++++++++++++++------ mm/huge_memory.c | 104 ++++++++++++++++++++++++++++++++++++---- mm/rmap.c | 2 +- 4 files changed, 183 insertions(+), 27 deletions(-) -- 2.17.1