Skip to content

Commit

Permalink
Revert "mm: don't allow huge faults for files with pre content watches"
Browse files Browse the repository at this point in the history
This reverts commit 20bf82a.

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
  • Loading branch information
Amir Goldstein authored and Jan Kara committed Mar 13, 2025
1 parent 955fbe0 commit 4f4dc3a
Showing 1 changed file with 0 additions and 19 deletions.
19 changes: 0 additions & 19 deletions mm/memory.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@
#include <linux/ptrace.h>
#include <linux/vmalloc.h>
#include <linux/sched/sysctl.h>
#include <linux/fsnotify.h>

#include <trace/events/kmem.h>

Expand Down Expand Up @@ -5750,17 +5749,8 @@ static vm_fault_t do_numa_page(struct vm_fault *vmf)
static inline vm_fault_t create_huge_pmd(struct vm_fault *vmf)
{
struct vm_area_struct *vma = vmf->vma;

if (vma_is_anonymous(vma))
return do_huge_pmd_anonymous_page(vmf);
/*
* Currently we just emit PAGE_SIZE for our fault events, so don't allow
* a huge fault if we have a pre content watch on this file. This would
* be trivial to support, but there would need to be tests to ensure
* this works properly and those don't exist currently.
*/
if (unlikely(FMODE_FSNOTIFY_HSM(vma->vm_file->f_mode)))
return VM_FAULT_FALLBACK;
if (vma->vm_ops->huge_fault)
return vma->vm_ops->huge_fault(vmf, PMD_ORDER);
return VM_FAULT_FALLBACK;
Expand All @@ -5784,9 +5774,6 @@ static inline vm_fault_t wp_huge_pmd(struct vm_fault *vmf)
}

if (vma->vm_flags & (VM_SHARED | VM_MAYSHARE)) {
/* See comment in create_huge_pmd. */
if (unlikely(FMODE_FSNOTIFY_HSM(vma->vm_file->f_mode)))
goto split;
if (vma->vm_ops->huge_fault) {
ret = vma->vm_ops->huge_fault(vmf, PMD_ORDER);
if (!(ret & VM_FAULT_FALLBACK))
Expand All @@ -5809,9 +5796,6 @@ static vm_fault_t create_huge_pud(struct vm_fault *vmf)
/* No support for anonymous transparent PUD pages yet */
if (vma_is_anonymous(vma))
return VM_FAULT_FALLBACK;
/* See comment in create_huge_pmd. */
if (unlikely(FMODE_FSNOTIFY_HSM(vma->vm_file->f_mode)))
return VM_FAULT_FALLBACK;
if (vma->vm_ops->huge_fault)
return vma->vm_ops->huge_fault(vmf, PUD_ORDER);
#endif /* CONFIG_TRANSPARENT_HUGEPAGE */
Expand All @@ -5829,9 +5813,6 @@ static vm_fault_t wp_huge_pud(struct vm_fault *vmf, pud_t orig_pud)
if (vma_is_anonymous(vma))
goto split;
if (vma->vm_flags & (VM_SHARED | VM_MAYSHARE)) {
/* See comment in create_huge_pmd. */
if (unlikely(FMODE_FSNOTIFY_HSM(vma->vm_file->f_mode)))
goto split;
if (vma->vm_ops->huge_fault) {
ret = vma->vm_ops->huge_fault(vmf, PUD_ORDER);
if (!(ret & VM_FAULT_FALLBACK))
Expand Down

0 comments on commit 4f4dc3a

Please sign in to comment.