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,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 55AFCC433E3 for ; Tue, 30 Jun 2020 20:45:36 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 14CC720772 for ; Tue, 30 Jun 2020 20:45:36 +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="UVkmoYqh" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 14CC720772 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 3ADFE6B0029; Tue, 30 Jun 2020 16:45:35 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 387906B002A; Tue, 30 Jun 2020 16:45:35 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 24D206B002B; Tue, 30 Jun 2020 16:45:35 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0050.hostedemail.com [216.40.44.50]) by kanga.kvack.org (Postfix) with ESMTP id 098776B0029 for ; Tue, 30 Jun 2020 16:45:35 -0400 (EDT) Received: from smtpin28.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id C489B8248068 for ; Tue, 30 Jun 2020 20:45:34 +0000 (UTC) X-FDA: 76987058988.28.shade94_020535326e7a Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin28.hostedemail.com (Postfix) with ESMTP id 9F20F6C2F for ; Tue, 30 Jun 2020 20:45:34 +0000 (UTC) X-HE-Tag: shade94_020535326e7a X-Filterd-Recvd-Size: 5521 Received: from us-smtp-delivery-1.mimecast.com (us-smtp-2.mimecast.com [207.211.31.81]) by imf50.hostedemail.com (Postfix) with ESMTP for ; Tue, 30 Jun 2020 20:45:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1593549933; 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=ntPp8bHOPIXhq64ZYjMBP9tKw1Ahb/2+VdQMPS01kXM=; b=UVkmoYqhnDWYDMJaipnqrJYY9TuoG4fSlVy3ulHlF5sq2M/mmBjUJ3agTVmf74EotUHeaK zk1Eq67tLS1JvXpB6qkD37lFm6qsIh2EzgkUZJnuurbK+vZBOPPOMzZEZiodaHqOD2+y72 RlOc1m6QMgtQbsPoiIh9M0lu2cGvr8U= 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-251-JmuY0scrNO2oBMcV1_5Z5g-1; Tue, 30 Jun 2020 16:45:31 -0400 X-MC-Unique: JmuY0scrNO2oBMcV1_5Z5g-1 Received: by mail-qk1-f200.google.com with SMTP id f79so9370312qke.9 for ; Tue, 30 Jun 2020 13:45:31 -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=ntPp8bHOPIXhq64ZYjMBP9tKw1Ahb/2+VdQMPS01kXM=; b=q+JA7duucO1mb75Oopch1OSK87Mx4Iqiw30FAquXOCEX+/1O0Al2gOasBeqpFXwJSy 3AEcnQ4nOvecbAqVNqkeGqtudCktsOv9NhR/FX4zUIIymhjIgicys3cxitiPuLcRzGmb jqwBZerd0g1m8xatlKWXv9o7F5ZLqqmaiIBWcqQ+CPF9e28Yf/ykjvgJg8ms5hHXbnRr +7O12XwRirrB+qn/n4GFX1MSCu0FcphZJbVAJLytjkFf0IysoQhZ3p+mNXlmnBhr3a7n dCRU5sznyaU0LkwCt42H44GAdAtYFTwZdIY0czs4avNwEhsYplaGgKayMsDUPMmQQd07 NUGw== X-Gm-Message-State: AOAM533+5K82M6WDNHUT78m/p1CGr9DhIG4A6xISgbj4qaslNws7YRky f/VA81CGdltwFKbqKGk+dqPN8EUnykzk3OtFTtSAdDh37fVKjcNzP22480d7Sf1fFx/4pdDhacT e0JR95j8Ralo= X-Received: by 2002:a37:de19:: with SMTP id h25mr18441909qkj.354.1593549930600; Tue, 30 Jun 2020 13:45:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwwUQDPyUuSg/1KIgpJ4dyImwv9wjGn6EtkG5kne0m0m1PAimwPyxdFpEe1G1QOHO4oZVoDAg== X-Received: by 2002:a37:de19:: with SMTP id h25mr18441858qkj.354.1593549929950; Tue, 30 Jun 2020 13:45:29 -0700 (PDT) Received: from xz-x1.redhat.com ([2607:9880:19c0:32::2]) by smtp.gmail.com with ESMTPSA id r7sm3769108qtm.66.2020.06.30.13.45.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Jun 2020 13:45:29 -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 , Michal Simek Subject: [PATCH v4 10/26] mm/microblaze: Use general page fault accounting Date: Tue, 30 Jun 2020 16:45:27 -0400 Message-Id: <20200630204527.38955-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: 9F20F6C2F 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: 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 1a3d4c4ca28b..b3fed2cecf84 100644 --- a/arch/microblaze/mm/fault.c +++ b/arch/microblaze/mm/fault.c @@ -28,6 +28,7 @@ #include #include #include +#include =20 #include #include @@ -121,6 +122,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 @@ -214,7 +217,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; @@ -230,10 +233,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