* [PATCH 03/26] mm/arc: Use general page fault accounting [not found] <20200626223130.199227-1-peterx@redhat.com> @ 2020-06-26 22:31 ` Peter Xu 0 siblings, 0 replies; 2+ messages in thread From: Peter Xu @ 2020-06-26 22:31 UTC (permalink / raw) To: linux-mm, linux-kernel Cc: Andrea Arcangeli, Linus Torvalds, peterx, Vineet Gupta, Michael Ellerman, Andrew Morton, linux-snps-arc, Will Deacon, Gerald Schaefer Use the general page fault accounting by passing regs into handle_mm_fault(). It naturally solve the issue of multiple page fault accounting when page fault retry happened. Fix PERF_COUNT_SW_PAGE_FAULTS perf event manually for page fault retries, by moving it before taking mmap_sem. CC: Vineet Gupta <vgupta@synopsys.com> CC: linux-snps-arc@lists.infradead.org Signed-off-by: Peter Xu <peterx@redhat.com> --- arch/arc/mm/fault.c | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/arch/arc/mm/fault.c b/arch/arc/mm/fault.c index 34380139e7a2..68e6849cf086 100644 --- a/arch/arc/mm/fault.c +++ b/arch/arc/mm/fault.c @@ -106,6 +106,7 @@ void do_page_fault(unsigned long address, struct pt_regs *regs) if (write) flags |= FAULT_FLAG_WRITE; + perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS, 1, regs, address); retry: down_read(&mm->mmap_sem); @@ -131,7 +132,7 @@ void do_page_fault(unsigned long address, struct pt_regs *regs) goto bad_area; } - fault = handle_mm_fault(vma, address, flags, NULL); + fault = handle_mm_fault(vma, address, flags, regs); /* Quick path to respond to signals */ if (fault_signal_pending(fault, regs)) { @@ -156,22 +157,9 @@ void do_page_fault(unsigned long address, struct pt_regs *regs) * Major/minor page fault accounting * (in case of retry we only land here once) */ - perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS, 1, regs, address); - - if (likely(!(fault & VM_FAULT_ERROR))) { - if (fault & VM_FAULT_MAJOR) { - tsk->maj_flt++; - perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS_MAJ, 1, - regs, address); - } else { - tsk->min_flt++; - perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS_MIN, 1, - regs, address); - } - + if (likely(!(fault & VM_FAULT_ERROR))) /* Normal return path: fault Handled Gracefully */ return; - } if (!user_mode(regs)) goto no_context; -- 2.26.2 _______________________________________________ linux-snps-arc mailing list linux-snps-arc@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-snps-arc ^ permalink raw reply related [flat|nested] 2+ messages in thread
[parent not found: <20200619160538.8641-1-peterx@redhat.com>]
* [PATCH 03/26] mm/arc: Use general page fault accounting [not found] <20200619160538.8641-1-peterx@redhat.com> @ 2020-06-19 16:05 ` Peter Xu 0 siblings, 0 replies; 2+ messages in thread From: Peter Xu @ 2020-06-19 16:05 UTC (permalink / raw) To: linux-kernel, linux-mm Cc: Andrea Arcangeli, Michael Ellerman, peterx, Linus Torvalds, Vineet Gupta, Andrew Morton, linux-snps-arc, Will Deacon, Gerald Schaefer Use the general page fault accounting by passing regs into handle_mm_fault(). It naturally solve the issue of multiple page fault accounting when page fault retry happened. Fix PERF_COUNT_SW_PAGE_FAULTS perf event manually for page fault retries, by moving it before taking mmap_sem. CC: Vineet Gupta <vgupta@synopsys.com> CC: linux-snps-arc@lists.infradead.org Signed-off-by: Peter Xu <peterx@redhat.com> --- arch/arc/mm/fault.c | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/arch/arc/mm/fault.c b/arch/arc/mm/fault.c index 34380139e7a2..68e6849cf086 100644 --- a/arch/arc/mm/fault.c +++ b/arch/arc/mm/fault.c @@ -106,6 +106,7 @@ void do_page_fault(unsigned long address, struct pt_regs *regs) if (write) flags |= FAULT_FLAG_WRITE; + perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS, 1, regs, address); retry: down_read(&mm->mmap_sem); @@ -131,7 +132,7 @@ void do_page_fault(unsigned long address, struct pt_regs *regs) goto bad_area; } - fault = handle_mm_fault(vma, address, flags, NULL); + fault = handle_mm_fault(vma, address, flags, regs); /* Quick path to respond to signals */ if (fault_signal_pending(fault, regs)) { @@ -156,22 +157,9 @@ void do_page_fault(unsigned long address, struct pt_regs *regs) * Major/minor page fault accounting * (in case of retry we only land here once) */ - perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS, 1, regs, address); - - if (likely(!(fault & VM_FAULT_ERROR))) { - if (fault & VM_FAULT_MAJOR) { - tsk->maj_flt++; - perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS_MAJ, 1, - regs, address); - } else { - tsk->min_flt++; - perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS_MIN, 1, - regs, address); - } - + if (likely(!(fault & VM_FAULT_ERROR))) /* Normal return path: fault Handled Gracefully */ return; - } if (!user_mode(regs)) goto no_context; -- 2.26.2 _______________________________________________ linux-snps-arc mailing list linux-snps-arc@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-snps-arc ^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-06-26 22:33 UTC | newest] Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- [not found] <20200626223130.199227-1-peterx@redhat.com> 2020-06-26 22:31 ` [PATCH 03/26] mm/arc: Use general page fault accounting Peter Xu [not found] <20200619160538.8641-1-peterx@redhat.com> 2020-06-19 16:05 ` Peter Xu
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).