From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B390EC433E0 for ; Wed, 12 Aug 2020 01:38:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 88BEF20658 for ; Wed, 12 Aug 2020 01:38:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1597196310; bh=mHkVHFHeWFsmawykudstjd7qNctj4du/FsUM66dtPFs=; h=Date:From:To:Subject:In-Reply-To:Reply-To:List-ID:From; b=ZraNXAn37SjsqL/c5+TmMpMIP5srxVTNdRS9Tf//N+rQQX7IuH3pXItQ1hXf6qyJd b2RCeSbg2Nb8PDXyYh3kdUFTJuCXkkjEeV2NGh4JSMsZGyZVlj3BQ4nRGnN/8DU6jZ zgW9D6HR99BaNec2AYcpBn15pGt7f929r+0P1V8A= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726368AbgHLBia (ORCPT ); Tue, 11 Aug 2020 21:38:30 -0400 Received: from mail.kernel.org ([198.145.29.99]:40860 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726235AbgHLBia (ORCPT ); Tue, 11 Aug 2020 21:38:30 -0400 Received: from localhost.localdomain (c-73-231-172-41.hsd1.ca.comcast.net [73.231.172.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id DE601207DA; Wed, 12 Aug 2020 01:38:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1597196309; bh=mHkVHFHeWFsmawykudstjd7qNctj4du/FsUM66dtPFs=; h=Date:From:To:Subject:In-Reply-To:From; b=SGPe6Ma2NMtd0PzDXKVfQWYgcZ1XIvFXqlciGvapTi2B27witfBJy338qO5tA5b/I qn3WDX1erzPbWvi9Vd1MHoduaiPQxAgT1OAqlnjYeC+Mt1vFhaFp54Tcr4KnWi/ns6 1KztuJXigKbpVM9OKcnCubZljJiA0d555CepqW/M= Date: Tue, 11 Aug 2020 18:38:28 -0700 From: Andrew Morton To: akpm@linux-foundation.org, deller@gmx.de, James.Bottomley@HansenPartnership.com, linux-mm@kvack.org, mm-commits@vger.kernel.org, peterx@redhat.com, torvalds@linux-foundation.org Subject: [patch 155/165] mm/parisc: use general page fault accounting Message-ID: <20200812013828.d-JmWsstx%akpm@linux-foundation.org> In-Reply-To: <20200811182949.e12ae9a472e3b5e27e16ad6c@linux-foundation.org> User-Agent: s-nail v14.8.16 Sender: mm-commits-owner@vger.kernel.org Precedence: bulk Reply-To: linux-kernel@vger.kernel.org List-ID: X-Mailing-List: mm-commits@vger.kernel.org From: Peter Xu Subject: mm/parisc: use general page fault accounting 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. Add the missing PERF_COUNT_SW_PAGE_FAULTS perf events too. Note, the other two perf events (PERF_COUNT_SW_PAGE_FAULTS_[MAJ|MIN]) were done in handle_mm_fault(). Link: http://lkml.kernel.org/r/20200707225021.200906-16-peterx@redhat.com Signed-off-by: Peter Xu Cc: James E.J. Bottomley Cc: Helge Deller Signed-off-by: Andrew Morton --- arch/parisc/mm/fault.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) --- a/arch/parisc/mm/fault.c~mm-parisc-use-general-page-fault-accounting +++ a/arch/parisc/mm/fault.c @@ -18,6 +18,7 @@ #include #include #include +#include #include @@ -281,6 +282,7 @@ void do_page_fault(struct pt_regs *regs, acc_type = parisc_acctyp(code, regs->iir); if (acc_type & VM_WRITE) flags |= FAULT_FLAG_WRITE; + perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS, 1, regs, address); retry: mmap_read_lock(mm); vma = find_vma_prev(mm, address, &prev_vma); @@ -302,7 +304,7 @@ good_area: * fault. */ - fault = handle_mm_fault(vma, address, flags, NULL); + fault = handle_mm_fault(vma, address, flags, regs); if (fault_signal_pending(fault, regs)) return; @@ -323,10 +325,6 @@ good_area: BUG(); } if (flags & FAULT_FLAG_ALLOW_RETRY) { - if (fault & VM_FAULT_MAJOR) - current->maj_flt++; - else - current->min_flt++; if (fault & VM_FAULT_RETRY) { /* * No need to mmap_read_unlock(mm) as we would _