]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commitdiff
uprobe: use FOLL_SPLIT_PMD instead of FOLL_SPLIT
authorSong Liu <songliubraving@fb.com>
Mon, 23 Sep 2019 22:38:27 +0000 (15:38 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Tue, 24 Sep 2019 22:54:11 +0000 (15:54 -0700)
Use the newly added FOLL_SPLIT_PMD in uprobe.  This preserves the huge
page when the uprobe is enabled.  When the uprobe is disabled, newer
instances of the same application could still benefit from huge page.

For the next step, we will enable khugepaged to regroup the pmd, so that
existing instances of the application could also benefit from huge page
after the uprobe is disabled.

Link: http://lkml.kernel.org/r/20190815164525.1848545-5-songliubraving@fb.com
Signed-off-by: Song Liu <songliubraving@fb.com>
Acked-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Reviewed-by: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
Reviewed-by: Oleg Nesterov <oleg@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
kernel/events/uprobes.c

index 648f47553bffae552d47c934d5a99afa17725ea6..27b596f14463a397073d4541474fdaf1075e4c49 100644 (file)
@@ -155,7 +155,7 @@ static int __replace_page(struct vm_area_struct *vma, unsigned long addr,
 {
        struct mm_struct *mm = vma->vm_mm;
        struct page_vma_mapped_walk pvmw = {
-               .page = old_page,
+               .page = compound_head(old_page),
                .vma = vma,
                .address = addr,
        };
@@ -166,8 +166,6 @@ static int __replace_page(struct vm_area_struct *vma, unsigned long addr,
        mmu_notifier_range_init(&range, MMU_NOTIFY_CLEAR, 0, vma, mm, addr,
                                addr + PAGE_SIZE);
 
-       VM_BUG_ON_PAGE(PageTransHuge(old_page), old_page);
-
        if (new_page) {
                err = mem_cgroup_try_charge(new_page, vma->vm_mm, GFP_KERNEL,
                                            &memcg, false);
@@ -481,7 +479,7 @@ int uprobe_write_opcode(struct arch_uprobe *auprobe, struct mm_struct *mm,
 retry:
        /* Read the page with vaddr into memory */
        ret = get_user_pages_remote(NULL, mm, vaddr, 1,
-                       FOLL_FORCE | FOLL_SPLIT, &old_page, &vma, NULL);
+                       FOLL_FORCE | FOLL_SPLIT_PMD, &old_page, &vma, NULL);
        if (ret <= 0)
                return ret;