Skip to content

Commit

Permalink
csky: Add faulthandler_disabled() check
Browse files Browse the repository at this point in the history
Similar to other architectures:
In addition to in_atomic, we also need pagefault_disabled() to
check.

Signed-off-by: Guo Ren <[email protected]>
  • Loading branch information
guoren83 committed Jan 12, 2021
1 parent 3e455cf commit 06f3f76
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions arch/csky/mm/fault.c
Original file line number Diff line number Diff line change
Expand Up @@ -143,12 +143,11 @@ asmlinkage void do_page_fault(struct pt_regs *regs)
return;
}

perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS, 1, regs, address);
/*
* If we're in an interrupt or have no user
* context, we must not take the fault..
*/
if (in_atomic() || !mm)
if (unlikely(faulthandler_disabled() || !mm))
goto bad_area_nosemaphore;

if (user_mode(regs))
Expand All @@ -157,6 +156,7 @@ asmlinkage void do_page_fault(struct pt_regs *regs)
if (is_write(regs))
flags |= FAULT_FLAG_WRITE;

perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS, 1, regs, address);
retry:
mmap_read_lock(mm);
vma = find_vma(mm, address);
Expand Down

0 comments on commit 06f3f76

Please sign in to comment.