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.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,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 37F0EC433E0 for ; Fri, 26 Jun 2020 22:32:00 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id F0A8820FC3 for ; Fri, 26 Jun 2020 22:31:59 +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="N2t3f4Ta" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org F0A8820FC3 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 93E376B0025; Fri, 26 Jun 2020 18:31:52 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 877766B0026; Fri, 26 Jun 2020 18:31:52 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6C4986B0027; Fri, 26 Jun 2020 18:31:52 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0194.hostedemail.com [216.40.44.194]) by kanga.kvack.org (Postfix) with ESMTP id 4DE476B0025 for ; Fri, 26 Jun 2020 18:31:52 -0400 (EDT) Received: from smtpin14.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 0FCB7181ABE85 for ; Fri, 26 Jun 2020 22:31:52 +0000 (UTC) X-FDA: 76972811664.14.cable72_5508c2a26e59 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin14.hostedemail.com (Postfix) with ESMTP id D808B18229818 for ; Fri, 26 Jun 2020 22:31:51 +0000 (UTC) X-HE-Tag: cable72_5508c2a26e59 X-Filterd-Recvd-Size: 5563 Received: from us-smtp-delivery-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.61]) by imf28.hostedemail.com (Postfix) with ESMTP for ; Fri, 26 Jun 2020 22:31:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1593210710; 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=3dqCpbomUjM3yzMbNQtQFnUhCIZ/IBDwpBGYZavg7bk=; b=N2t3f4TakFR9X45plQtJcQdLrMD7lSC7cCC2D0+2QVmJ+KfJQMv/gC7L4W6Kh2iaMSYs5p x8sRNMbucmJLUJtykA/YzJWgSxS+GR1vWOwN+J7AIkoehx/sCreKzcQ497NOJFO55BRwF3 3lDuf01hJbehjn+XBZuk5B0PaBjL+HY= Received: from mail-qt1-f199.google.com (mail-qt1-f199.google.com [209.85.160.199]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-390-a2yGjMf0M1mpRD79uRQtmg-1; Fri, 26 Jun 2020 18:31:49 -0400 X-MC-Unique: a2yGjMf0M1mpRD79uRQtmg-1 Received: by mail-qt1-f199.google.com with SMTP id c26so7518909qtq.6 for ; Fri, 26 Jun 2020 15:31: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=3dqCpbomUjM3yzMbNQtQFnUhCIZ/IBDwpBGYZavg7bk=; b=BKcgL8I+b4U1BhD3xdF4ZKgsU1zIdt6ty/ma7CNqWmmYhpLepOKq91zf1efqYmL+tW N2EW0d56dfTImQfLCx14VMkicy6F53HtUhV8wnp6V3ZfN/CewtzLoZ6cS27Vjav+jmOt h3jQ+YoEubjKpNKhiRQwCyTnENt98PPyM6+++c2G7VPmRa7WlGpYoH8OApFE2vA0X3Tr 5w9+W8zIQBh2mBb1tKoiivdE6lOug23F9vGkSJOPnXXpzg691x4N3y+U1Per+JFVFb/h rb8eeT/5fBfxDoU2np0UiGHXGYVwXQXkzXOPAAoQAcMZsyNGY7Zimtt8HdRF+us77gOE MdFA== X-Gm-Message-State: AOAM530n1zE63y6rexXknZ/LUE+3FgyR9C/S7tIMbOdbBxz5+d+14G6Q jxw18ve2iuaGMPUrvOuccugSR49cpNLNQyllsEt6XuxnuiVdKBX+j2uaTqGoBDu9jCXaaviPSnp QOiQBWIcmG9w= X-Received: by 2002:ac8:6602:: with SMTP id c2mr5104785qtp.243.1593210708568; Fri, 26 Jun 2020 15:31:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy0m9x4oS5jDycK5PNdBHwvU0YSY93jeQ2glDlce223GxZXy6nl10nE9BVmwmIuu4EVeSQu0g== X-Received: by 2002:ac8:6602:: with SMTP id c2mr5104766qtp.243.1593210708313; Fri, 26 Jun 2020 15:31:48 -0700 (PDT) Received: from xz-x1.redhat.com ([2607:9880:19c0:32::2]) by smtp.gmail.com with ESMTPSA id f203sm9903311qke.135.2020.06.26.15.31.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Jun 2020 15:31:47 -0700 (PDT) From: Peter Xu To: linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: Andrew Morton , Linus Torvalds , Gerald Schaefer , Andrea Arcangeli , Will Deacon , peterx@redhat.com, Michael Ellerman , Michal Simek Subject: [PATCH 10/26] mm/microblaze: Use general page fault accounting Date: Fri, 26 Jun 2020 18:31:14 -0400 Message-Id: <20200626223130.199227-11-peterx@redhat.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200626223130.199227-1-peterx@redhat.com> References: <20200626223130.199227-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: D808B18229818 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam04 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: Michal Simek Signed-off-by: Peter Xu --- arch/microblaze/mm/fault.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/arch/microblaze/mm/fault.c b/arch/microblaze/mm/fault.c index 9abfa5224386..3d58dbd227cd 100644 --- a/arch/microblaze/mm/fault.c +++ b/arch/microblaze/mm/fault.c @@ -28,6 +28,7 @@ #include #include #include +#include =20 #include #include @@ -122,6 +123,8 @@ void do_page_fault(struct pt_regs *regs, unsigned lon= g address, if (user_mode(regs)) flags |=3D FAULT_FLAG_USER; =20 + perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS, 1, regs, address); + /* When running in the kernel we expect faults to occur only to * addresses in user space. All other faults represent errors in the * kernel and should generate an OOPS. Unfortunately, in the case of a= n @@ -215,7 +218,7 @@ void do_page_fault(struct pt_regs *regs, unsigned lon= g address, * 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; @@ -231,10 +234,6 @@ void do_page_fault(struct pt_regs *regs, unsigned lo= ng address, } =20 if (flags & FAULT_FLAG_ALLOW_RETRY) { - if (unlikely(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