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

This reverts commit 20bf82a898b65c129af76deb96a1b415d3098a28.

Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Signed-off-by: Jan Kara <jack@suse.cz>
Link: https://patch.msgid.link/20250312073852.2123409-6-amir73il@gmail.com

authored by Amir Goldstein and committed by Jan Kara 4f4dc3a9 955fbe0e

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