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 61C5BC433E0 for ; Tue, 7 Jul 2020 22:51:08 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 241FA2077D for ; Tue, 7 Jul 2020 22:51:08 +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="HX0enkAR" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 241FA2077D 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 229446B00C3; Tue, 7 Jul 2020 18:50:58 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 1DD956B00C5; Tue, 7 Jul 2020 18:50:58 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id EADB16B00C6; Tue, 7 Jul 2020 18:50:57 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0081.hostedemail.com [216.40.44.81]) by kanga.kvack.org (Postfix) with ESMTP id C46366B00C3 for ; Tue, 7 Jul 2020 18:50:57 -0400 (EDT) Received: from smtpin12.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 878FF1EE6 for ; Tue, 7 Jul 2020 22:50:57 +0000 (UTC) X-FDA: 77012776554.12.color16_500714726eb8 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin12.hostedemail.com (Postfix) with ESMTP id 5A55F18002E33 for ; Tue, 7 Jul 2020 22:50:57 +0000 (UTC) X-HE-Tag: color16_500714726eb8 X-Filterd-Recvd-Size: 5652 Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) by imf09.hostedemail.com (Postfix) with ESMTP for ; Tue, 7 Jul 2020 22:50:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1594162256; 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=118ZuGBADe17DIOE5hd4LPbyDCcCNPIhXK0NF+I4+G0=; b=HX0enkAR0yDxMdka+3xuVQTrKTYoqGrtM0Gar7HLKEGZuQuPey2dShdBW9B9CpFt7u7/mB SELh1/ip4gOTgD5v8eWLjKNDblz9YhH1q7l0oB7ChC2168JFToxDkXX11kgytT3l21Nter DDUM7uVudKmkAHwLrLwYoqpgiPH25TU= Received: from mail-qk1-f198.google.com (mail-qk1-f198.google.com [209.85.222.198]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-353-OI41Of3ZMy2wNLI6ypRhog-1; Tue, 07 Jul 2020 18:50:52 -0400 X-MC-Unique: OI41Of3ZMy2wNLI6ypRhog-1 Received: by mail-qk1-f198.google.com with SMTP id u186so29689584qka.4 for ; Tue, 07 Jul 2020 15:50:52 -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=118ZuGBADe17DIOE5hd4LPbyDCcCNPIhXK0NF+I4+G0=; b=XEBdGMy96QQxNYS9BBefgnfOq0A2Jcl5g3KA02IPdZ7CgdparreOu5i7p4Uj8fPI1D w6GSTeh2x89eZaTwhhHB2oCRApEvoa5Nd6mbDdXEXuNLK9GTJa86BlmLkm5CBQwrQAvu V+C8SYyuR2aFZ5Y3QCazBbL+n1bRkdfbDzS2zxJZZ7yQvmFffhCiMep6NSXyyz517eYr CVIWtwbqsiptkPqT7hKpZK0sUeQ7FYtfsQykmPDRikU2OfPbP6eubpXSbOQcbWfRSFyv PJys51XTQtCyD23gMtjqzxw/cUMgw6WRrEbLFPFTLDw8+EV152dXIeGL9gt6t9ktqIpG J8lA== X-Gm-Message-State: AOAM532qkLRG/tGAYWdNW6u4w09l5RgpHGHcLeTV3WMeC4aTiZnESnVU Gxx8D4y9if/G0T8Aqih1cWetelj/umU4AU5Z+5xpHGTeB/C4hruLM2YpFOPO4tFcCMtHsK+upwn m9iOBReHcI70= X-Received: by 2002:a37:b141:: with SMTP id a62mr48028568qkf.201.1594162252350; Tue, 07 Jul 2020 15:50:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxK7Y2DUfTKdLNV2DO9bFAUkgaqmVbLuA9xFf6I5zpI0aGjlm1MfWvVmwIY/UB1dT9vqIFjlg== X-Received: by 2002:a37:b141:: with SMTP id a62mr48028550qkf.201.1594162252137; Tue, 07 Jul 2020 15:50:52 -0700 (PDT) Received: from xz-x1.redhat.com ([2607:9880:19c0:32::2]) by smtp.gmail.com with ESMTPSA id j16sm26267642qtp.92.2020.07.07.15.50.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jul 2020 15:50:51 -0700 (PDT) From: Peter Xu To: linux-kernel@vger.kernel.org, linux-mm@kvack.org Cc: Gerald Schaefer , Linus Torvalds , peterx@redhat.com, Andrew Morton , Will Deacon , Andrea Arcangeli , David Rientjes , John Hubbard , Michael Ellerman , Paul Walmsley , Palmer Dabbelt , Albert Ou , linux-riscv@lists.infradead.org, Pekka Enberg Subject: [PATCH v5 17/25] mm/riscv: Use general page fault accounting Date: Tue, 7 Jul 2020 18:50:13 -0400 Message-Id: <20200707225021.200906-18-peterx@redhat.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200707225021.200906-1-peterx@redhat.com> References: <20200707225021.200906-1-peterx@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=peterx@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=US-ASCII X-Rspamd-Queue-Id: 5A55F18002E33 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam05 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. CC: Paul Walmsley CC: Palmer Dabbelt CC: Albert Ou CC: linux-riscv@lists.infradead.org Reviewed-by: Pekka Enberg Signed-off-by: Peter Xu --- arch/riscv/mm/fault.c | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/arch/riscv/mm/fault.c b/arch/riscv/mm/fault.c index 30c1124d0fb6..716d64e36f83 100644 --- a/arch/riscv/mm/fault.c +++ b/arch/riscv/mm/fault.c @@ -109,7 +109,7 @@ asmlinkage void do_page_fault(struct pt_regs *regs) * make sure we exit gracefully rather than endlessly redo * the fault. */ - fault =3D handle_mm_fault(vma, addr, flags, NULL); + fault =3D handle_mm_fault(vma, addr, flags, regs); =20 /* * If we need to retry but a fatal signal is pending, handle the @@ -127,21 +127,7 @@ asmlinkage void do_page_fault(struct pt_regs *regs) 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) { - tsk->maj_flt++; - perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS_MAJ, - 1, regs, addr); - } else { - tsk->min_flt++; - perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS_MIN, - 1, regs, addr); - } if (fault & VM_FAULT_RETRY) { flags |=3D FAULT_FLAG_TRIED; =20 --=20 2.26.2