History

Revert "mm: don't allow huge faults for files with pre content watches"

This reverts commit 20bf82a898b65c129af76deb96a1b415d3098a28.

Amir Goldstein committed 1 year ago

Commit 4f4dc3a1 parent 955fbe01 file · +0 −19Browse files

Unified · Split

mm/memory.c+0−19
@@ -76,7 +76,6 @@ · 75 unmodified lines
76#include <linux/ptrace.h>76#include <linux/ptrace.h>
77#include <linux/vmalloc.h>77#include <linux/vmalloc.h>
78#include <linux/sched/sysctl.h>78#include <linux/sched/sysctl.h>
79#include <linux/fsnotify.h>
80 79
81#include <trace/events/kmem.h>80#include <trace/events/kmem.h>
82 81
@@ -5750,17 +5749,8 @@ out_map: · 5667 unmodified lines
5750static inline vm_fault_t create_huge_pmd(struct vm_fault *vmf)5749static inline vm_fault_t create_huge_pmd(struct vm_fault *vmf)
5751{5750{
5752 struct vm_area_struct *vma = vmf->vma;5751 struct vm_area_struct *vma = vmf->vma;
5753
5754 if (vma_is_anonymous(vma))5752 if (vma_is_anonymous(vma))
5755 return do_huge_pmd_anonymous_page(vmf);5753 return do_huge_pmd_anonymous_page(vmf);
5756 /*
5757 * Currently we just emit PAGE_SIZE for our fault events, so don't allow
5758 * a huge fault if we have a pre content watch on this file. This would
5759 * be trivial to support, but there would need to be tests to ensure
5760 * this works properly and those don't exist currently.
5761 */
5762 if (unlikely(FMODE_FSNOTIFY_HSM(vma->vm_file->f_mode)))
5763 return VM_FAULT_FALLBACK;
5764 if (vma->vm_ops->huge_fault)5754 if (vma->vm_ops->huge_fault)
5765 return vma->vm_ops->huge_fault(vmf, PMD_ORDER);5755 return vma->vm_ops->huge_fault(vmf, PMD_ORDER);
5766 return VM_FAULT_FALLBACK;5756 return VM_FAULT_FALLBACK;
@@ -5784,9 +5774,6 @@ static inline vm_fault_t wp_huge_pmd(struct vm_fault *vmf) · 17 unmodified lines
5784 }5774 }
5785 5775
5786 if (vma->vm_flags & (VM_SHARED | VM_MAYSHARE)) {5776 if (vma->vm_flags & (VM_SHARED | VM_MAYSHARE)) {
5787 /* See comment in create_huge_pmd. */
5788 if (unlikely(FMODE_FSNOTIFY_HSM(vma->vm_file->f_mode)))
5789 goto split;
5790 if (vma->vm_ops->huge_fault) {5777 if (vma->vm_ops->huge_fault) {
5791 ret = vma->vm_ops->huge_fault(vmf, PMD_ORDER);5778 ret = vma->vm_ops->huge_fault(vmf, PMD_ORDER);
5792 if (!(ret & VM_FAULT_FALLBACK))5779 if (!(ret & VM_FAULT_FALLBACK))
@@ -5809,9 +5796,6 @@ static vm_fault_t create_huge_pud(struct vm_fault *vmf) · 16 unmodified lines
5809 /* No support for anonymous transparent PUD pages yet */5796 /* No support for anonymous transparent PUD pages yet */
5810 if (vma_is_anonymous(vma))5797 if (vma_is_anonymous(vma))
5811 return VM_FAULT_FALLBACK;5798 return VM_FAULT_FALLBACK;
5812 /* See comment in create_huge_pmd. */
5813 if (unlikely(FMODE_FSNOTIFY_HSM(vma->vm_file->f_mode)))
5814 return VM_FAULT_FALLBACK;
5815 if (vma->vm_ops->huge_fault)5799 if (vma->vm_ops->huge_fault)
5816 return vma->vm_ops->huge_fault(vmf, PUD_ORDER);5800 return vma->vm_ops->huge_fault(vmf, PUD_ORDER);
5817#endif /* CONFIG_TRANSPARENT_HUGEPAGE */5801#endif /* CONFIG_TRANSPARENT_HUGEPAGE */
@@ -5829,9 +5813,6 @@ static vm_fault_t wp_huge_pud(struct vm_fault *vmf, pud_t orig_pud) · 11 unmodified lines
5829 if (vma_is_anonymous(vma))5813 if (vma_is_anonymous(vma))
5830 goto split;5814 goto split;
5831 if (vma->vm_flags & (VM_SHARED | VM_MAYSHARE)) {5815 if (vma->vm_flags & (VM_SHARED | VM_MAYSHARE)) {
5832 /* See comment in create_huge_pmd. */
5833 if (unlikely(FMODE_FSNOTIFY_HSM(vma->vm_file->f_mode)))
5834 goto split;
5835 if (vma->vm_ops->huge_fault) {5816 if (vma->vm_ops->huge_fault) {
5836 ret = vma->vm_ops->huge_fault(vmf, PUD_ORDER);5817 ret = vma->vm_ops->huge_fault(vmf, PUD_ORDER);
5837 if (!(ret & VM_FAULT_FALLBACK))5818 if (!(ret & VM_FAULT_FALLBACK))