* [PATCH v4 23/26] mm/x86: Use general page fault accounting
@ 2020-06-30 20:46 Peter Xu
2020-07-01 15:35 ` Dave Hansen
0 siblings, 1 reply; 3+ messages in thread
From: Peter Xu @ 2020-06-30 20:46 UTC (permalink / raw)
To: linux-mm, linux-kernel
Cc: Andrew Morton, peterx, John Hubbard, Michael Ellerman,
Gerald Schaefer, Andrea Arcangeli, Linus Torvalds, Will Deacon,
Dave Hansen, Andy Lutomirski, Peter Zijlstra, Thomas Gleixner,
Ingo Molnar, Borislav Petkov, x86, H . Peter Anvin
Use the general page fault accounting by passing regs into handle_mm_fault().
CC: Dave Hansen <dave.hansen@linux.intel.com>
CC: Andy Lutomirski <luto@kernel.org>
CC: Peter Zijlstra <peterz@infradead.org>
CC: Thomas Gleixner <tglx@linutronix.de>
CC: Ingo Molnar <mingo@redhat.com>
CC: Borislav Petkov <bp@alien8.de>
CC: x86@kernel.org
CC: H. Peter Anvin <hpa@zytor.com>
Signed-off-by: Peter Xu <peterx@redhat.com>
---
arch/x86/mm/fault.c | 17 ++---------------
1 file changed, 2 insertions(+), 15 deletions(-)
diff --git a/arch/x86/mm/fault.c b/arch/x86/mm/fault.c
index fe3ca00eb121..9ac80bb87781 100644
--- a/arch/x86/mm/fault.c
+++ b/arch/x86/mm/fault.c
@@ -1140,7 +1140,7 @@ void do_user_addr_fault(struct pt_regs *regs,
struct vm_area_struct *vma;
struct task_struct *tsk;
struct mm_struct *mm;
- vm_fault_t fault, major = 0;
+ vm_fault_t fault;
unsigned int flags = FAULT_FLAG_DEFAULT;
tsk = current;
@@ -1292,8 +1292,7 @@ void do_user_addr_fault(struct pt_regs *regs,
* userland). The return to userland is identified whenever
* FAULT_FLAG_USER|FAULT_FLAG_KILLABLE are both set in flags.
*/
- fault = handle_mm_fault(vma, address, flags, NULL);
- major |= fault & VM_FAULT_MAJOR;
+ fault = handle_mm_fault(vma, address, flags, regs);
/* Quick path to respond to signals */
if (fault_signal_pending(fault, regs)) {
@@ -1320,18 +1319,6 @@ void do_user_addr_fault(struct pt_regs *regs,
return;
}
- /*
- * Major/minor page fault accounting. If any of the events
- * returned VM_FAULT_MAJOR, we account it as a major fault.
- */
- if (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);
- }
-
check_v8086_mode(regs, address, tsk);
}
NOKPROBE_SYMBOL(do_user_addr_fault);
--
2.26.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v4 23/26] mm/x86: Use general page fault accounting
2020-06-30 20:46 [PATCH v4 23/26] mm/x86: Use general page fault accounting Peter Xu
@ 2020-07-01 15:35 ` Dave Hansen
2020-07-03 0:46 ` Peter Xu
0 siblings, 1 reply; 3+ messages in thread
From: Dave Hansen @ 2020-07-01 15:35 UTC (permalink / raw)
To: Peter Xu, linux-mm, linux-kernel
Cc: Andrew Morton, John Hubbard, Michael Ellerman, Gerald Schaefer,
Andrea Arcangeli, Linus Torvalds, Will Deacon, Dave Hansen,
Andy Lutomirski, Peter Zijlstra, Thomas Gleixner, Ingo Molnar,
Borislav Petkov, x86, H . Peter Anvin
On 6/30/20 1:46 PM, Peter Xu wrote:
> Use the general page fault accounting by passing regs into handle_mm_fault().
...
> - /*
> - * Major/minor page fault accounting. If any of the events
> - * returned VM_FAULT_MAJOR, we account it as a major fault.
> - */
> - if (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);
> - }
> -
> check_v8086_mode(regs, address, tsk);
> }
I did a quick grep and it wasn't obvious to me how
PERF_COUNT_SW_PAGE_FAULTS_MIN/MAJ get bumped in the handle_mm_fault() path.
Are you sure they get set?
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v4 23/26] mm/x86: Use general page fault accounting
2020-07-01 15:35 ` Dave Hansen
@ 2020-07-03 0:46 ` Peter Xu
0 siblings, 0 replies; 3+ messages in thread
From: Peter Xu @ 2020-07-03 0:46 UTC (permalink / raw)
To: Dave Hansen
Cc: linux-mm, linux-kernel, Andrew Morton, John Hubbard,
Michael Ellerman, Gerald Schaefer, Andrea Arcangeli,
Linus Torvalds, Will Deacon, Dave Hansen, Andy Lutomirski,
Peter Zijlstra, Thomas Gleixner, Ingo Molnar, Borislav Petkov,
x86, H . Peter Anvin
Hi, Dave,
On Wed, Jul 01, 2020 at 08:35:40AM -0700, Dave Hansen wrote:
> On 6/30/20 1:46 PM, Peter Xu wrote:
> > Use the general page fault accounting by passing regs into handle_mm_fault().
> ...
> > - /*
> > - * Major/minor page fault accounting. If any of the events
> > - * returned VM_FAULT_MAJOR, we account it as a major fault.
> > - */
> > - if (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);
> > - }
> > -
> > check_v8086_mode(regs, address, tsk);
> > }
>
> I did a quick grep and it wasn't obvious to me how
> PERF_COUNT_SW_PAGE_FAULTS_MIN/MAJ get bumped in the handle_mm_fault() path.
>
> Are you sure they get set?
Sorry for missing the context. This patch is based on the 1st patch of the
same series:
https://lore.kernel.org/lkml/20200630204504.38516-1-peterx@redhat.com/
Both of them are set there.
Thanks,
--
Peter Xu
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-07-03 0:46 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-30 20:46 [PATCH v4 23/26] mm/x86: Use general page fault accounting Peter Xu
2020-07-01 15:35 ` Dave Hansen
2020-07-03 0:46 ` 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).