Commit 36ef159f authored by Qi Zheng's avatar Qi Zheng Committed by Linus Torvalds

mm: remove redundant check about FAULT_FLAG_ALLOW_RETRY bit

Since commit 4064b982 ("mm: allow VM_FAULT_RETRY for multiple
times") allowed VM_FAULT_RETRY for multiple times, the
FAULT_FLAG_ALLOW_RETRY bit of fault_flag will not be changed in the page
fault path, so the following check is no longer needed:

	flags & FAULT_FLAG_ALLOW_RETRY

So just remove it.

[akpm@linux-foundation.org: coding style fixes]

Link: https://lkml.kernel.org/r/20211110123358.36511-1-zhengqi.arch@bytedance.comSigned-off-by: default avatarQi Zheng <zhengqi.arch@bytedance.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: David Hildenbrand <david@redhat.com>
Cc: Kirill Shutemov <kirill@shutemov.name>
Cc: Peter Xu <peterx@redhat.com>
Cc: Muchun Song <songmuchun@bytedance.com>
Cc: Chengming Zhou <zhouchengming@bytedance.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 2c769ed7
...@@ -165,7 +165,6 @@ do_page_fault(unsigned long address, unsigned long mmcsr, ...@@ -165,7 +165,6 @@ do_page_fault(unsigned long address, unsigned long mmcsr,
BUG(); BUG();
} }
if (flags & FAULT_FLAG_ALLOW_RETRY) {
if (fault & VM_FAULT_RETRY) { if (fault & VM_FAULT_RETRY) {
flags |= FAULT_FLAG_TRIED; flags |= FAULT_FLAG_TRIED;
...@@ -176,7 +175,6 @@ do_page_fault(unsigned long address, unsigned long mmcsr, ...@@ -176,7 +175,6 @@ do_page_fault(unsigned long address, unsigned long mmcsr,
goto retry; goto retry;
} }
}
mmap_read_unlock(mm); mmap_read_unlock(mm);
......
...@@ -149,8 +149,7 @@ void do_page_fault(unsigned long address, struct pt_regs *regs) ...@@ -149,8 +149,7 @@ void do_page_fault(unsigned long address, struct pt_regs *regs)
/* /*
* Fault retry nuances, mmap_lock already relinquished by core mm * Fault retry nuances, mmap_lock already relinquished by core mm
*/ */
if (unlikely((fault & VM_FAULT_RETRY) && if (unlikely(fault & VM_FAULT_RETRY)) {
(flags & FAULT_FLAG_ALLOW_RETRY))) {
flags |= FAULT_FLAG_TRIED; flags |= FAULT_FLAG_TRIED;
goto retry; goto retry;
} }
......
...@@ -312,7 +312,7 @@ do_page_fault(unsigned long addr, unsigned int fsr, struct pt_regs *regs) ...@@ -312,7 +312,7 @@ do_page_fault(unsigned long addr, unsigned int fsr, struct pt_regs *regs)
return 0; return 0;
} }
if (!(fault & VM_FAULT_ERROR) && flags & FAULT_FLAG_ALLOW_RETRY) { if (!(fault & VM_FAULT_ERROR)) {
if (fault & VM_FAULT_RETRY) { if (fault & VM_FAULT_RETRY) {
flags |= FAULT_FLAG_TRIED; flags |= FAULT_FLAG_TRIED;
goto retry; goto retry;
......
...@@ -606,11 +606,9 @@ static int __kprobes do_page_fault(unsigned long far, unsigned int esr, ...@@ -606,11 +606,9 @@ static int __kprobes do_page_fault(unsigned long far, unsigned int esr,
} }
if (fault & VM_FAULT_RETRY) { if (fault & VM_FAULT_RETRY) {
if (mm_flags & FAULT_FLAG_ALLOW_RETRY) {
mm_flags |= FAULT_FLAG_TRIED; mm_flags |= FAULT_FLAG_TRIED;
goto retry; goto retry;
} }
}
mmap_read_unlock(mm); mmap_read_unlock(mm);
/* /*
......
...@@ -98,12 +98,10 @@ void do_page_fault(unsigned long address, long cause, struct pt_regs *regs) ...@@ -98,12 +98,10 @@ void do_page_fault(unsigned long address, long cause, struct pt_regs *regs)
/* The most common case -- we are done. */ /* The most common case -- we are done. */
if (likely(!(fault & VM_FAULT_ERROR))) { if (likely(!(fault & VM_FAULT_ERROR))) {
if (flags & FAULT_FLAG_ALLOW_RETRY) {
if (fault & VM_FAULT_RETRY) { if (fault & VM_FAULT_RETRY) {
flags |= FAULT_FLAG_TRIED; flags |= FAULT_FLAG_TRIED;
goto retry; goto retry;
} }
}
mmap_read_unlock(mm); mmap_read_unlock(mm);
return; return;
......
...@@ -156,7 +156,6 @@ ia64_do_page_fault (unsigned long address, unsigned long isr, struct pt_regs *re ...@@ -156,7 +156,6 @@ ia64_do_page_fault (unsigned long address, unsigned long isr, struct pt_regs *re
BUG(); BUG();
} }
if (flags & FAULT_FLAG_ALLOW_RETRY) {
if (fault & VM_FAULT_RETRY) { if (fault & VM_FAULT_RETRY) {
flags |= FAULT_FLAG_TRIED; flags |= FAULT_FLAG_TRIED;
...@@ -167,7 +166,6 @@ ia64_do_page_fault (unsigned long address, unsigned long isr, struct pt_regs *re ...@@ -167,7 +166,6 @@ ia64_do_page_fault (unsigned long address, unsigned long isr, struct pt_regs *re
goto retry; goto retry;
} }
}
mmap_read_unlock(mm); mmap_read_unlock(mm);
return; return;
......
...@@ -153,7 +153,6 @@ int do_page_fault(struct pt_regs *regs, unsigned long address, ...@@ -153,7 +153,6 @@ int do_page_fault(struct pt_regs *regs, unsigned long address,
BUG(); BUG();
} }
if (flags & FAULT_FLAG_ALLOW_RETRY) {
if (fault & VM_FAULT_RETRY) { if (fault & VM_FAULT_RETRY) {
flags |= FAULT_FLAG_TRIED; flags |= FAULT_FLAG_TRIED;
...@@ -165,7 +164,6 @@ int do_page_fault(struct pt_regs *regs, unsigned long address, ...@@ -165,7 +164,6 @@ int do_page_fault(struct pt_regs *regs, unsigned long address,
goto retry; goto retry;
} }
}
mmap_read_unlock(mm); mmap_read_unlock(mm);
return 0; return 0;
......
...@@ -232,7 +232,6 @@ void do_page_fault(struct pt_regs *regs, unsigned long address, ...@@ -232,7 +232,6 @@ void do_page_fault(struct pt_regs *regs, unsigned long address,
BUG(); BUG();
} }
if (flags & FAULT_FLAG_ALLOW_RETRY) {
if (fault & VM_FAULT_RETRY) { if (fault & VM_FAULT_RETRY) {
flags |= FAULT_FLAG_TRIED; flags |= FAULT_FLAG_TRIED;
...@@ -244,7 +243,6 @@ void do_page_fault(struct pt_regs *regs, unsigned long address, ...@@ -244,7 +243,6 @@ void do_page_fault(struct pt_regs *regs, unsigned long address,
goto retry; goto retry;
} }
}
mmap_read_unlock(mm); mmap_read_unlock(mm);
......
...@@ -171,7 +171,7 @@ static void __kprobes __do_page_fault(struct pt_regs *regs, unsigned long write, ...@@ -171,7 +171,7 @@ static void __kprobes __do_page_fault(struct pt_regs *regs, unsigned long write,
goto do_sigbus; goto do_sigbus;
BUG(); BUG();
} }
if (flags & FAULT_FLAG_ALLOW_RETRY) {
if (fault & VM_FAULT_RETRY) { if (fault & VM_FAULT_RETRY) {
flags |= FAULT_FLAG_TRIED; flags |= FAULT_FLAG_TRIED;
...@@ -183,7 +183,6 @@ static void __kprobes __do_page_fault(struct pt_regs *regs, unsigned long write, ...@@ -183,7 +183,6 @@ static void __kprobes __do_page_fault(struct pt_regs *regs, unsigned long write,
goto retry; goto retry;
} }
}
mmap_read_unlock(mm); mmap_read_unlock(mm);
return; return;
......
...@@ -230,7 +230,6 @@ void do_page_fault(unsigned long entry, unsigned long addr, ...@@ -230,7 +230,6 @@ void do_page_fault(unsigned long entry, unsigned long addr,
goto bad_area; goto bad_area;
} }
if (flags & FAULT_FLAG_ALLOW_RETRY) {
if (fault & VM_FAULT_RETRY) { if (fault & VM_FAULT_RETRY) {
flags |= FAULT_FLAG_TRIED; flags |= FAULT_FLAG_TRIED;
...@@ -240,7 +239,6 @@ void do_page_fault(unsigned long entry, unsigned long addr, ...@@ -240,7 +239,6 @@ void do_page_fault(unsigned long entry, unsigned long addr,
*/ */
goto retry; goto retry;
} }
}
mmap_read_unlock(mm); mmap_read_unlock(mm);
return; return;
......
...@@ -149,7 +149,6 @@ asmlinkage void do_page_fault(struct pt_regs *regs, unsigned long cause, ...@@ -149,7 +149,6 @@ asmlinkage void do_page_fault(struct pt_regs *regs, unsigned long cause,
BUG(); BUG();
} }
if (flags & FAULT_FLAG_ALLOW_RETRY) {
if (fault & VM_FAULT_RETRY) { if (fault & VM_FAULT_RETRY) {
flags |= FAULT_FLAG_TRIED; flags |= FAULT_FLAG_TRIED;
...@@ -161,7 +160,6 @@ asmlinkage void do_page_fault(struct pt_regs *regs, unsigned long cause, ...@@ -161,7 +160,6 @@ asmlinkage void do_page_fault(struct pt_regs *regs, unsigned long cause,
goto retry; goto retry;
} }
}
mmap_read_unlock(mm); mmap_read_unlock(mm);
return; return;
......
...@@ -177,7 +177,6 @@ asmlinkage void do_page_fault(struct pt_regs *regs, unsigned long address, ...@@ -177,7 +177,6 @@ asmlinkage void do_page_fault(struct pt_regs *regs, unsigned long address,
BUG(); BUG();
} }
if (flags & FAULT_FLAG_ALLOW_RETRY) {
/*RGD modeled on Cris */ /*RGD modeled on Cris */
if (fault & VM_FAULT_RETRY) { if (fault & VM_FAULT_RETRY) {
flags |= FAULT_FLAG_TRIED; flags |= FAULT_FLAG_TRIED;
...@@ -189,7 +188,6 @@ asmlinkage void do_page_fault(struct pt_regs *regs, unsigned long address, ...@@ -189,7 +188,6 @@ asmlinkage void do_page_fault(struct pt_regs *regs, unsigned long address,
goto retry; goto retry;
} }
}
mmap_read_unlock(mm); mmap_read_unlock(mm);
return; return;
......
...@@ -324,7 +324,6 @@ void do_page_fault(struct pt_regs *regs, unsigned long code, ...@@ -324,7 +324,6 @@ void do_page_fault(struct pt_regs *regs, unsigned long code,
goto bad_area; goto bad_area;
BUG(); BUG();
} }
if (flags & FAULT_FLAG_ALLOW_RETRY) {
if (fault & VM_FAULT_RETRY) { if (fault & VM_FAULT_RETRY) {
/* /*
* No need to mmap_read_unlock(mm) as we would * No need to mmap_read_unlock(mm) as we would
...@@ -334,7 +333,6 @@ void do_page_fault(struct pt_regs *regs, unsigned long code, ...@@ -334,7 +333,6 @@ void do_page_fault(struct pt_regs *regs, unsigned long code,
flags |= FAULT_FLAG_TRIED; flags |= FAULT_FLAG_TRIED;
goto retry; goto retry;
} }
}
mmap_read_unlock(mm); mmap_read_unlock(mm);
return; return;
......
...@@ -516,11 +516,9 @@ static int ___do_page_fault(struct pt_regs *regs, unsigned long address, ...@@ -516,11 +516,9 @@ static int ___do_page_fault(struct pt_regs *regs, unsigned long address,
* case. * case.
*/ */
if (unlikely(fault & VM_FAULT_RETRY)) { if (unlikely(fault & VM_FAULT_RETRY)) {
if (flags & FAULT_FLAG_ALLOW_RETRY) {
flags |= FAULT_FLAG_TRIED; flags |= FAULT_FLAG_TRIED;
goto retry; goto retry;
} }
}
mmap_read_unlock(current->mm); mmap_read_unlock(current->mm);
......
...@@ -330,7 +330,7 @@ asmlinkage void do_page_fault(struct pt_regs *regs) ...@@ -330,7 +330,7 @@ asmlinkage void do_page_fault(struct pt_regs *regs)
if (fault_signal_pending(fault, regs)) if (fault_signal_pending(fault, regs))
return; return;
if (unlikely((fault & VM_FAULT_RETRY) && (flags & FAULT_FLAG_ALLOW_RETRY))) { if (unlikely(fault & VM_FAULT_RETRY)) {
flags |= FAULT_FLAG_TRIED; flags |= FAULT_FLAG_TRIED;
/* /*
......
...@@ -452,12 +452,13 @@ static inline vm_fault_t do_exception(struct pt_regs *regs, int access) ...@@ -452,12 +452,13 @@ static inline vm_fault_t do_exception(struct pt_regs *regs, int access)
if (unlikely(fault & VM_FAULT_ERROR)) if (unlikely(fault & VM_FAULT_ERROR))
goto out_up; goto out_up;
if (flags & FAULT_FLAG_ALLOW_RETRY) {
if (fault & VM_FAULT_RETRY) { if (fault & VM_FAULT_RETRY) {
if (IS_ENABLED(CONFIG_PGSTE) && gmap && if (IS_ENABLED(CONFIG_PGSTE) && gmap &&
(flags & FAULT_FLAG_RETRY_NOWAIT)) { (flags & FAULT_FLAG_RETRY_NOWAIT)) {
/* FAULT_FLAG_RETRY_NOWAIT has been set, /*
* mmap_lock has not been released */ * FAULT_FLAG_RETRY_NOWAIT has been set, mmap_lock has
* not been released
*/
current->thread.gmap_pfault = 1; current->thread.gmap_pfault = 1;
fault = VM_FAULT_PFAULT; fault = VM_FAULT_PFAULT;
goto out_up; goto out_up;
...@@ -467,7 +468,6 @@ static inline vm_fault_t do_exception(struct pt_regs *regs, int access) ...@@ -467,7 +468,6 @@ static inline vm_fault_t do_exception(struct pt_regs *regs, int access)
mmap_read_lock(mm); mmap_read_lock(mm);
goto retry; goto retry;
} }
}
if (IS_ENABLED(CONFIG_PGSTE) && gmap) { if (IS_ENABLED(CONFIG_PGSTE) && gmap) {
address = __gmap_link(gmap, current->thread.gmap_addr, address = __gmap_link(gmap, current->thread.gmap_addr,
address); address);
......
...@@ -485,7 +485,6 @@ asmlinkage void __kprobes do_page_fault(struct pt_regs *regs, ...@@ -485,7 +485,6 @@ asmlinkage void __kprobes do_page_fault(struct pt_regs *regs,
if (mm_fault_error(regs, error_code, address, fault)) if (mm_fault_error(regs, error_code, address, fault))
return; return;
if (flags & FAULT_FLAG_ALLOW_RETRY) {
if (fault & VM_FAULT_RETRY) { if (fault & VM_FAULT_RETRY) {
flags |= FAULT_FLAG_TRIED; flags |= FAULT_FLAG_TRIED;
...@@ -496,7 +495,6 @@ asmlinkage void __kprobes do_page_fault(struct pt_regs *regs, ...@@ -496,7 +495,6 @@ asmlinkage void __kprobes do_page_fault(struct pt_regs *regs,
*/ */
goto retry; goto retry;
} }
}
mmap_read_unlock(mm); mmap_read_unlock(mm);
} }
...@@ -200,7 +200,6 @@ asmlinkage void do_sparc_fault(struct pt_regs *regs, int text_fault, int write, ...@@ -200,7 +200,6 @@ asmlinkage void do_sparc_fault(struct pt_regs *regs, int text_fault, int write,
BUG(); BUG();
} }
if (flags & FAULT_FLAG_ALLOW_RETRY) {
if (fault & VM_FAULT_RETRY) { if (fault & VM_FAULT_RETRY) {
flags |= FAULT_FLAG_TRIED; flags |= FAULT_FLAG_TRIED;
...@@ -211,7 +210,6 @@ asmlinkage void do_sparc_fault(struct pt_regs *regs, int text_fault, int write, ...@@ -211,7 +210,6 @@ asmlinkage void do_sparc_fault(struct pt_regs *regs, int text_fault, int write,
goto retry; goto retry;
} }
}
mmap_read_unlock(mm); mmap_read_unlock(mm);
return; return;
......
...@@ -437,7 +437,6 @@ asmlinkage void __kprobes do_sparc64_fault(struct pt_regs *regs) ...@@ -437,7 +437,6 @@ asmlinkage void __kprobes do_sparc64_fault(struct pt_regs *regs)
BUG(); BUG();
} }
if (flags & FAULT_FLAG_ALLOW_RETRY) {
if (fault & VM_FAULT_RETRY) { if (fault & VM_FAULT_RETRY) {
flags |= FAULT_FLAG_TRIED; flags |= FAULT_FLAG_TRIED;
...@@ -448,7 +447,6 @@ asmlinkage void __kprobes do_sparc64_fault(struct pt_regs *regs) ...@@ -448,7 +447,6 @@ asmlinkage void __kprobes do_sparc64_fault(struct pt_regs *regs)
goto retry; goto retry;
} }
}
mmap_read_unlock(mm); mmap_read_unlock(mm);
mm_rss = get_mm_rss(mm); mm_rss = get_mm_rss(mm);
......
...@@ -87,13 +87,11 @@ int handle_page_fault(unsigned long address, unsigned long ip, ...@@ -87,13 +87,11 @@ int handle_page_fault(unsigned long address, unsigned long ip,
} }
BUG(); BUG();
} }
if (flags & FAULT_FLAG_ALLOW_RETRY) {
if (fault & VM_FAULT_RETRY) { if (fault & VM_FAULT_RETRY) {
flags |= FAULT_FLAG_TRIED; flags |= FAULT_FLAG_TRIED;
goto retry; goto retry;
} }
}
pmd = pmd_off(mm, address); pmd = pmd_off(mm, address);
pte = pte_offset_kernel(pmd, address); pte = pte_offset_kernel(pmd, address);
......
...@@ -1413,8 +1413,7 @@ void do_user_addr_fault(struct pt_regs *regs, ...@@ -1413,8 +1413,7 @@ void do_user_addr_fault(struct pt_regs *regs,
* and if there is a fatal signal pending there is no guarantee * and if there is a fatal signal pending there is no guarantee
* that we made any progress. Handle this case first. * that we made any progress. Handle this case first.
*/ */
if (unlikely((fault & VM_FAULT_RETRY) && if (unlikely(fault & VM_FAULT_RETRY)) {
(flags & FAULT_FLAG_ALLOW_RETRY))) {
flags |= FAULT_FLAG_TRIED; flags |= FAULT_FLAG_TRIED;
goto retry; goto retry;
} }
......
...@@ -127,7 +127,7 @@ void do_page_fault(struct pt_regs *regs) ...@@ -127,7 +127,7 @@ void do_page_fault(struct pt_regs *regs)
goto do_sigbus; goto do_sigbus;
BUG(); BUG();
} }
if (flags & FAULT_FLAG_ALLOW_RETRY) {
if (fault & VM_FAULT_RETRY) { if (fault & VM_FAULT_RETRY) {
flags |= FAULT_FLAG_TRIED; flags |= FAULT_FLAG_TRIED;
...@@ -138,7 +138,6 @@ void do_page_fault(struct pt_regs *regs) ...@@ -138,7 +138,6 @@ void do_page_fault(struct pt_regs *regs)
goto retry; goto retry;
} }
}
mmap_read_unlock(mm); mmap_read_unlock(mm);
return; return;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment