--- x/mm/memory.c +++ y/mm/memory.c @@ -5808,6 +5808,7 @@ vm_fault_t handle_mm_fault(struct vm_are /* If the fault handler drops the mmap_lock, vma may be freed */ struct mm_struct *mm = vma->vm_mm; vm_fault_t ret; + bool droppable; __set_current_state(TASK_RUNNING); @@ -5831,6 +5832,7 @@ vm_fault_t handle_mm_fault(struct vm_are lru_gen_enter_fault(vma); + droppable = !!(vma->vm_flags & VM_DROPPABLE); if (unlikely(is_vm_hugetlb_page(vma))) ret = hugetlb_fault(vma->vm_mm, vma, address, flags); else @@ -5839,7 +5841,7 @@ vm_fault_t handle_mm_fault(struct vm_are lru_gen_exit_fault(); /* If the mapping is droppable, then errors due to OOM aren't fatal. */ - if (vma->vm_flags & VM_DROPPABLE) + if (droppable) ret &= ~VM_FAULT_OOM; if (flags & FAULT_FLAG_USER) {