Patch "mm, hugetlbfs: introduce ->split() to vm_operations_struct" has been added to the 4.14-stable tree
Subsystems (5)
This is a note to let you know that I've just added the patch titled
mm, hugetlbfs: introduce ->split() to vm_operations_struct
to the 4.14-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
The filename of the patch is:
mm-hugetlbfs-introduce-split-to-vm_operations_struct.patch
and it can be found in the queue-4.14 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.
Quoted 1 line
From
31383c6865a578834dd953d9dbc88e6b19fe3997Mon Sep 17 00:00:00 2001
From: Dan Williams <[email protected]>
Date: Wed, 29 Nov 2017 16:10:28 -0800
Subject: mm, hugetlbfs: introduce ->split() to vm_operations_struct
From: Dan Williams <[email protected]>
commit 31383c6865a578834dd953d9dbc88e6b19fe3997 upstream.
Patch series "device-dax: fix unaligned munmap handling"
When device-dax is operating in huge-page mode we want it to behave like hugetlbfs and fail attempts to split vmas into unaligned ranges. It would be messy to teach the munmap path about device-dax alignment constraints in the same (hstate) way that hugetlbfs communicates this constraint. Instead, these patches introduce a new ->split() vm operation.
This patch (of 2):
The device-dax interface has similar constraints as hugetlbfs in that it requires the munmap path to unmap in huge page aligned units. Rather than add more custom vma handling code in __split_vma() introduce a new vm operation to perform this vma specific check.
--- include/linux/mm.h | 1 + mm/hugetlb.c | 8 ++++++++ mm/mmap.c | 8 +++++--- 3 files changed, 14 insertions(+), 3 deletions(-)
include/linux/mm.h +1 -0
@@ -367,6 +367,7 @@ enum page_entry_size {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_fault *vmf);int (*huge_fault)(struct vm_fault *vmf,enum page_entry_size pe_size);
mm/hugetlb.c +8 -0
@@ -3125,6 +3125,13 @@ static void hugetlb_vm_op_close(struct v } } +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
@@ -3141,6 +3148,7 @@ const struct vm_operations_struct hugetl .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,
mm/mmap.c +5 -3
@@ -2540,9 +2540,11 @@ int __split_vma(struct mm_struct *mm, ststruct vm_area_struct *new;int err; -if (is_vm_hugetlb_page (vma) && (addr & - ~(huge_page_mask (hstate_vma (vma))))) -return -EINVAL ; +if (vma->vm_ops && vma->vm_ops->split) { + err = vma->vm_ops->split (vma, addr); +if (err) +return err; + } new =kmem_cache_alloc (vm_area_cachep,GFP_KERNEL );if (!new)
Patches currently in stable-queue which might be from [email protected] are
queue-4.14/mm-hugetlbfs-introduce-split-to-vm_operations_struct.patch queue-4.14/ib-core-disable-memory-registration-of-filesystem-dax-vmas.patch queue-4.14/mm-introduce-get_user_pages_longterm.patch queue-4.14/mm-fail-get_vaddr_frames-for-filesystem-dax-mappings.patch queue-4.14/device-dax-implement-split-to-catch-invalid-munmap-attempts.patch queue-4.14/v4l2-disable-filesystem-dax-mapping-support.patch queue-4.14/mm-fix-device-dax-pud-write-faults-triggered-by-get_user_pages.patch queue-4.14/mm-madvise.c-fix-madvise-infinite-loop-under-special-circumstances.patch