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=-9.5 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham 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 39538C433DF for ; Fri, 19 Jun 2020 16:15:49 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id E407C217A0 for ; Fri, 19 Jun 2020 16:15:48 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="AVqqfaqI" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E407C217A0 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id DAF548D00CB; Fri, 19 Jun 2020 12:15:47 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D86728D00AD; Fri, 19 Jun 2020 12:15:47 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C28628D00CB; Fri, 19 Jun 2020 12:15:47 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0147.hostedemail.com [216.40.44.147]) by kanga.kvack.org (Postfix) with ESMTP id 9AB9D8D00AD for ; Fri, 19 Jun 2020 12:15:47 -0400 (EDT) Received: from smtpin16.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 5F73A824556B for ; Fri, 19 Jun 2020 16:15:47 +0000 (UTC) X-FDA: 76946462334.16.spark29_1c00bb426e1a Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin16.hostedemail.com (Postfix) with ESMTP id 5A4DC100D9ACF for ; Fri, 19 Jun 2020 16:12:52 +0000 (UTC) X-HE-Tag: spark29_1c00bb426e1a X-Filterd-Recvd-Size: 5720 Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) by imf19.hostedemail.com (Postfix) with ESMTP for ; Fri, 19 Jun 2020 16:12:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1592583171; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ewTqBfexdBAI6q+mW9BG6/0EyFw+GuUSZgL1KkcFzfA=; b=AVqqfaqI8puY8Vc7hq4KQe5/auQ8bNUjBgGJXwIB2gjqkeAiVy2LpbHafSNx/W6Ej8Rl7D PKYb+rPeUNqLPbnDMdqFvB8Nc7wmFRkm8rkpoJodC3ugmUczHIB0qhiXG+lKKTXsk5s2q2 UQLq1KnTpD/jwL/HJ7sUKVFgUGWmBE8= Received: from mail-qk1-f200.google.com (mail-qk1-f200.google.com [209.85.222.200]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-495-YRIKSF6WPLafUBHNO3UaIA-1; Fri, 19 Jun 2020 12:12:49 -0400 X-MC-Unique: YRIKSF6WPLafUBHNO3UaIA-1 Received: by mail-qk1-f200.google.com with SMTP id u186so1032164qka.4 for ; Fri, 19 Jun 2020 09:12:49 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ewTqBfexdBAI6q+mW9BG6/0EyFw+GuUSZgL1KkcFzfA=; b=FEWuTi1L0XrYsNiVEcMCexc9kmLWtt0zzX7Zbas0L7O2SJ1d77tZ0BEn9Tv0u3d5uo g6KyuecMowIldxCA3cVj6Ee6IYAwbWbJpBiQJ4mEXwq45BFd3Wc+6VfzEQMtCZw9UoBr ZGwm1SPNHZy9a0g/RN3Cr+UrY5bgILG2FGvKbwAr1qFbht1gtmps52lpyw2JuE43jMX0 C314s9geka67OTD9nETaxBKtVC5q9YJUueN/bZW9X042RxNkzBPHM6jvy8osx9nsFIB7 RWARNiS66p72OPIWRIRPS6obj5Y9NFe7JnNtx+JpGpZvvpMutaYEqYNFH2/LVTgBijwZ a+ng== X-Gm-Message-State: AOAM530ENBh315puv9z5COZQel+yYOfBrkxdNprgpWpuWLSFO7fWIgzl JrEofT0GDJeVdD3FChSavyyKoRO2g4MIY3+p6MlmJNx7sa1shKLnxei4/MOa0Ek/mpPgkUIrYoQ Hk8jEkYGpg8A= X-Received: by 2002:a37:e87:: with SMTP id 129mr4114920qko.499.1592583169281; Fri, 19 Jun 2020 09:12:49 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwvSVp3DvCUxxCHnzJ36+YGsZtjQWrVVS6joe8rh/iaYG3kK43rnoX9nmcA1Z4z7yyGo8LoFg== X-Received: by 2002:a37:e87:: with SMTP id 129mr4114895qko.499.1592583169012; Fri, 19 Jun 2020 09:12:49 -0700 (PDT) Received: from xz-x1.redhat.com ([2607:9880:19c0:32::2]) by smtp.gmail.com with ESMTPSA id w204sm6713249qka.41.2020.06.19.09.12.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Jun 2020 09:12:48 -0700 (PDT) From: Peter Xu To: linux-kernel@vger.kernel.org, linux-mm@kvack.org Cc: Peter Xu , Gerald Schaefer , Andrew Morton , Andrea Arcangeli , Will Deacon , Michael Ellerman , Linus Torvalds , Ley Foon Tan Subject: [PATCH 13/26] mm/nios2: Use general page fault accounting Date: Fri, 19 Jun 2020 12:12:46 -0400 Message-Id: <20200619161246.9347-1-peterx@redhat.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200619160538.8641-1-peterx@redhat.com> References: <20200619160538.8641-1-peterx@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=US-ASCII X-Rspamd-Queue-Id: 5A4DC100D9ACF X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam01 Content-Transfer-Encoding: quoted-printable X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Use the general page fault accounting by passing regs into handle_mm_faul= t(). 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 oth= er two perf events (PERF_COUNT_SW_PAGE_FAULTS_[MAJ|MIN]) were done in handle_mm_= fault(). CC: Ley Foon Tan Signed-off-by: Peter Xu --- arch/nios2/mm/fault.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/arch/nios2/mm/fault.c b/arch/nios2/mm/fault.c index 88abf297c759..823e7d0a9e97 100644 --- a/arch/nios2/mm/fault.c +++ b/arch/nios2/mm/fault.c @@ -24,6 +24,7 @@ #include #include #include +#include =20 #include #include @@ -83,6 +84,8 @@ asmlinkage void do_page_fault(struct pt_regs *regs, uns= igned long cause, if (user_mode(regs)) flags |=3D FAULT_FLAG_USER; =20 + perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS, 1, regs, address); + if (!down_read_trylock(&mm->mmap_sem)) { if (!user_mode(regs) && !search_exception_tables(regs->ea)) goto bad_area_nosemaphore; @@ -131,7 +134,7 @@ asmlinkage void do_page_fault(struct pt_regs *regs, u= nsigned long cause, * make sure we exit gracefully rather than endlessly redo * the fault. */ - fault =3D handle_mm_fault(vma, address, flags, NULL); + fault =3D handle_mm_fault(vma, address, flags, regs); =20 if (fault_signal_pending(fault, regs)) return; @@ -146,16 +149,7 @@ asmlinkage void do_page_fault(struct pt_regs *regs, = unsigned long cause, BUG(); } =20 - /* - * Major/minor page fault accounting is only done on the - * initial attempt. If we go through a retry, it is extremely - * likely that the page will be found in page cache at that point. - */ if (flags & FAULT_FLAG_ALLOW_RETRY) { - if (fault & VM_FAULT_MAJOR) - current->maj_flt++; - else - current->min_flt++; if (fault & VM_FAULT_RETRY) { flags |=3D FAULT_FLAG_TRIED; =20 --=20 2.26.2