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.8 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 EA80CC433EA for ; Tue, 30 Jun 2020 20:45:55 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id A41BE20772 for ; Tue, 30 Jun 2020 20:45:55 +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="HYbKdRb+" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A41BE20772 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 13E496B005A; Tue, 30 Jun 2020 16:45:54 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 09F326B005D; Tue, 30 Jun 2020 16:45:54 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E5A436B005A; Tue, 30 Jun 2020 16:45:53 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0110.hostedemail.com [216.40.44.110]) by kanga.kvack.org (Postfix) with ESMTP id CD75A6B0037 for ; Tue, 30 Jun 2020 16:45:53 -0400 (EDT) Received: from smtpin03.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 94F2F8248068 for ; Tue, 30 Jun 2020 20:45:53 +0000 (UTC) X-FDA: 76987059786.03.blow29_4501e9826e7a Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin03.hostedemail.com (Postfix) with ESMTP id 6B3B128A4E9 for ; Tue, 30 Jun 2020 20:45:53 +0000 (UTC) X-HE-Tag: blow29_4501e9826e7a X-Filterd-Recvd-Size: 5328 Received: from us-smtp-delivery-1.mimecast.com (us-smtp-2.mimecast.com [207.211.31.81]) by imf16.hostedemail.com (Postfix) with ESMTP for ; Tue, 30 Jun 2020 20:45:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1593549952; 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; bh=mfudH1gu1GL1LZqxVEZK8L9MFfxsg/gHPxv1OKTQK3E=; b=HYbKdRb+2PgyIQPbdWg6PVXIyP8sY3hiuzqCoSA+qgdVOLsuTrZIYptvAtT14Ppph0pFys TkcHv7DGYHv/YkFoGBSxLn3mPC/z4RgOh9Y+G9a1f+lRip5OJbZhnHPmBzfsl3W6ieEmJX MGZWcwarbT+vHJqXL5IeXM0qOuH2FvI= Received: from mail-qv1-f70.google.com (mail-qv1-f70.google.com [209.85.219.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-459-J1iRvaK3PJOjkNJpJHqWdg-1; Tue, 30 Jun 2020 16:45:50 -0400 X-MC-Unique: J1iRvaK3PJOjkNJpJHqWdg-1 Received: by mail-qv1-f70.google.com with SMTP id v10so4463678qvm.17 for ; Tue, 30 Jun 2020 13:45:50 -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:mime-version :content-transfer-encoding; bh=mfudH1gu1GL1LZqxVEZK8L9MFfxsg/gHPxv1OKTQK3E=; b=GmduLneOrzkldkiakQV3C0Wb1TxvHkwymcFZCRc1lOlWda8Is7PKpPUnvsgQVFz2vi QsvpYljpNVT9owk0uZWVpe608BMCD1SO9dP2CMID9FeMAhM1gIeV0/wDujgi3YGgjxrE wGKp3K18RBdgoopu5RsDsW4erDzt8J3FTRsuNlRGYJnKQDiU09RiHKYyRUzgkV+dF6FS l71mw2hEkoGRaqyEnt34BxcXX/sFDpONmxQJcP4aVR/Riu0mMcWwxJC5ULMRaDHeeSHz Kv2lZBnbNSX6rE4LVz5JHO7hATad9Gpua+ud4aCVdi00bRYt5bYUKjnimaZBiJ8rHZKn lsEg== X-Gm-Message-State: AOAM533F2xKJDMXYfFjuLoDqErC3+uiaa4Nffp38cVVuuN+8mtGHYb1Q AqN7sdYnCU99zOeLmCN2njrb1HukwsdrrmpDknxnrddXKczssAcaDGEn9CKvsalEDF6hk/hk8Z1 nqLxop5BQY8M= X-Received: by 2002:a37:5c7:: with SMTP id 190mr21417905qkf.479.1593549948403; Tue, 30 Jun 2020 13:45:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyumlFzo2DUqNktzirguzAlyAPQFn8TaOIfLX5bHcMtCXo263dv1sp1iQI8Cs0ZPWsxzyNVig== X-Received: by 2002:a37:5c7:: with SMTP id 190mr21417870qkf.479.1593549948141; Tue, 30 Jun 2020 13:45:48 -0700 (PDT) Received: from xz-x1.redhat.com ([2607:9880:19c0:32::2]) by smtp.gmail.com with ESMTPSA id p63sm4107348qkc.80.2020.06.30.13.45.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Jun 2020 13:45:47 -0700 (PDT) From: Peter Xu To: linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: Andrew Morton , peterx@redhat.com, John Hubbard , Michael Ellerman , Gerald Schaefer , Andrea Arcangeli , Linus Torvalds , Will Deacon , Paul Walmsley , Palmer Dabbelt , Albert Ou , linux-riscv@lists.infradead.org Subject: [PATCH v4 17/26] mm/riscv: Use general page fault accounting Date: Tue, 30 Jun 2020 16:45:45 -0400 Message-Id: <20200630204545.39293-1-peterx@redhat.com> X-Mailer: git-send-email 2.26.2 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: 6B3B128A4E9 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam02 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 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 50a952a68433..e72cec09d55b 100644 --- a/arch/riscv/mm/fault.c +++ b/arch/riscv/mm/fault.c @@ -110,7 +110,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 @@ -128,21 +128,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