From patchwork Tue Jul 7 22:50:13 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Xu X-Patchwork-Id: 11650417 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 81C25739 for ; Tue, 7 Jul 2020 22:51:09 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 4B9292077D for ; Tue, 7 Jul 2020 22:51:09 +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 4B9292077D 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) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 1DD956B00C5; Tue, 7 Jul 2020 18:50:58 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org 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-Original-To: linux-mm@kvack.org 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-Spam-Summary: 1,0,0,,d41d8cd98f00b204,peterx@redhat.com,,RULES_HIT:30054,0,RBL:207.211.31.120:@redhat.com:.lbl8.mailshell.net-62.18.0.100 66.10.201.10;04yrbewdoxjk6cwu15ac4kprrfu6fopden4xkbxqcprnz3kpsn5mcyxyhkk6wmu.5da8sgtg961wat5ijzhep1jbwui6wwx97qkr5sdm7fgj3pxz1sqbkzsddf3iaw6.6-lbl8.mailshell.net-223.238.255.100,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:ft,MSBL:0,DNSBL:none,Custom_rules:0:0:0,LFtime:25,LUA_SUMMARY:none 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 X-Rspamd-Queue-Id: 5A55F18002E33 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam05 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_fault(). 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 = handle_mm_fault(vma, addr, flags, NULL); + fault = handle_mm_fault(vma, addr, flags, regs); /* * 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(); } - /* - * 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 |= FAULT_FLAG_TRIED;