Revert "mm, hugetlbfs: introduce ->split() to vm_operations_struct"
authorYves-Alexis Perez <corsac@debian.org>
Sun, 7 Jan 2018 13:50:46 +0000 (14:50 +0100)
committerYves-Alexis Perez <corsac@debian.org>
Fri, 9 Feb 2018 12:58:52 +0000 (12:58 +0000)
This reverts commit cebe139e5712d6925a9b70f3769df6818b6c14dd, which was
commit 31383c6865a578834dd953d9dbc88e6b19fe3997 upstream. It introduces
an ABI break and the depending commits are not in 4.9.

Gbp-Pq: Topic debian
Gbp-Pq: Name revert-mm-hugetlbfs-introduce-split-to-vm_operations.patch

include/linux/mm.h
mm/hugetlb.c
mm/mmap.c

index d8946909a756a279cfb9a58ee0656786e0fe472a..d61d957b81ce123e94e6ab70229e4091871a3061 100644 (file)
@@ -348,7 +348,6 @@ struct fault_env {
 struct vm_operations_struct {
        void (*open)(struct vm_area_struct * area);
        void (*close)(struct vm_area_struct * area);
-       int (*split)(struct vm_area_struct * area, unsigned long addr);
        int (*mremap)(struct vm_area_struct * area);
        int (*fault)(struct vm_area_struct *vma, struct vm_fault *vmf);
        int (*pmd_fault)(struct vm_area_struct *, unsigned long address,
index 6ff65c40524326890bd088fa5ae052061ed16252..65c36acf8a6b5839ac7d74956dad63f73a523cd2 100644 (file)
@@ -3135,13 +3135,6 @@ static void hugetlb_vm_op_close(struct vm_area_struct *vma)
        }
 }
 
-static int hugetlb_vm_op_split(struct vm_area_struct *vma, unsigned long addr)
-{
-       if (addr & ~(huge_page_mask(hstate_vma(vma))))
-               return -EINVAL;
-       return 0;
-}
-
 /*
  * We cannot handle pagefaults against hugetlb pages at all.  They cause
  * handle_mm_fault() to try to instantiate regular-sized pages in the
@@ -3158,7 +3151,6 @@ const struct vm_operations_struct hugetlb_vm_ops = {
        .fault = hugetlb_vm_op_fault,
        .open = hugetlb_vm_op_open,
        .close = hugetlb_vm_op_close,
-       .split = hugetlb_vm_op_split,
 };
 
 static pte_t make_huge_pte(struct vm_area_struct *vma, struct page *page,
index 1cb67646307c6479f2871a0bea5abd1841226139..f4658f7cdb47c651561642c23de7ae0b77478459 100644 (file)
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -2546,11 +2546,9 @@ static int __split_vma(struct mm_struct *mm, struct vm_area_struct *vma,
        struct vm_area_struct *new;
        int err;
 
-       if (vma->vm_ops && vma->vm_ops->split) {
-               err = vma->vm_ops->split(vma, addr);
-               if (err)
-                       return err;
-       }
+       if (is_vm_hugetlb_page(vma) && (addr &
+                                       ~(huge_page_mask(hstate_vma(vma)))))
+               return -EINVAL;
 
        new = kmem_cache_alloc(vm_area_cachep, GFP_KERNEL);
        if (!new)