diff options
| author | Vineet Gupta <vgupta@synopsys.com> | 2019-05-14 19:28:30 -0400 |
|---|---|---|
| committer | Vineet Gupta <vgupta@synopsys.com> | 2019-07-01 14:02:22 -0400 |
| commit | 926150db8558dca59617c8786c3f91c239290ee1 (patch) | |
| tree | 8d660572a26f911350adffca3bc37a3ba239f8f9 | |
| parent | 5e91bf5ce9b8740076f5283f1ec3a5b023950920 (diff) | |
ARC: mm: do_page_fault refactor #8: release mmap_sem sooner
In case of successful page fault handling, this patch releases mmap_sem
before updating the perf stat event for major/minor faults. So even
though the contention reduction is NOT super high, it is still an
improvement.
There's an additional code size improvement as we only have 2 up_read()
calls now.
Note to myself:
--------------
1. Given the way it is done, we are forced to move @bad_area label earlier
causing the various "goto bad_area" cases to hit perf stat code.
- PERF_COUNT_SW_PAGE_FAULTS is NOW updated for access errors which is what
arm/arm64 seem to be doing as well (with slightly different code)
- PERF_COUNT_SW_PAGE_FAULTS_{MAJ,MIN} must NOT be updated for the
error case which is guarded by now setting @fault initial value
to VM_FAULT_ERROR which serves both cases when handle_mm_fault()
returns error or is not called at all.
2. arm/arm64 use two homebrew fault flags VM_FAULT_BAD{MAP,MAPACCESS}
which I was inclined to add too but seems not needed for ARC
- given that we have everything is 1 function we can still use goto
- we setup si_code at the right place (arm* do that in the end)
- we init fault already to error value which guards entry into perf
stats event update
Cc: Peter Zijlstra <peterz@infradead.org>
Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
| -rw-r--r-- | arch/arc/mm/fault.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/arch/arc/mm/fault.c b/arch/arc/mm/fault.c index 6a78a2d776a9..e7df5ef3877a 100644 --- a/arch/arc/mm/fault.c +++ b/arch/arc/mm/fault.c | |||
| @@ -152,6 +152,9 @@ retry: | |||
| 152 | } | 152 | } |
| 153 | } | 153 | } |
| 154 | 154 | ||
| 155 | bad_area: | ||
| 156 | up_read(&mm->mmap_sem); | ||
| 157 | |||
| 155 | /* | 158 | /* |
| 156 | * Major/minor page fault accounting | 159 | * Major/minor page fault accounting |
| 157 | * (in case of retry we only land here once) | 160 | * (in case of retry we only land here once) |
| @@ -170,13 +173,9 @@ retry: | |||
| 170 | } | 173 | } |
| 171 | 174 | ||
| 172 | /* Normal return path: fault Handled Gracefully */ | 175 | /* Normal return path: fault Handled Gracefully */ |
| 173 | up_read(&mm->mmap_sem); | ||
| 174 | return; | 176 | return; |
| 175 | } | 177 | } |
| 176 | 178 | ||
| 177 | bad_area: | ||
| 178 | up_read(&mm->mmap_sem); | ||
| 179 | |||
| 180 | if (!user_mode(regs)) | 179 | if (!user_mode(regs)) |
| 181 | goto no_context; | 180 | goto no_context; |
| 182 | 181 | ||
