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 0297EC433E4 for ; Tue, 7 Jul 2020 22:50:52 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id B9A3F2075B for ; Tue, 7 Jul 2020 22:50:51 +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="TsdoNLji" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B9A3F2075B 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 7800F6B00B3; Tue, 7 Jul 2020 18:50:44 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 709936B00B5; Tue, 7 Jul 2020 18:50:44 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 560F16B00B6; Tue, 7 Jul 2020 18:50:44 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0037.hostedemail.com [216.40.44.37]) by kanga.kvack.org (Postfix) with ESMTP id 2EFEF6B00B3 for ; Tue, 7 Jul 2020 18:50:44 -0400 (EDT) Received: from smtpin24.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id EF95F180AD806 for ; Tue, 7 Jul 2020 22:50:43 +0000 (UTC) X-FDA: 77012775966.24.month97_51059c926eb8 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin24.hostedemail.com (Postfix) with ESMTP id C59B51A4A5 for ; Tue, 7 Jul 2020 22:50:43 +0000 (UTC) X-HE-Tag: month97_51059c926eb8 X-Filterd-Recvd-Size: 5754 Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) by imf28.hostedemail.com (Postfix) with ESMTP for ; Tue, 7 Jul 2020 22:50:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1594162242; 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=ntPp8bHOPIXhq64ZYjMBP9tKw1Ahb/2+VdQMPS01kXM=; b=TsdoNLjiNUdU6RQcMUXSGOPyWtFSIb1rZFkOlK0S2Xj1pxat/r3X3jE36c4OQxJS1KhbuZ 2TFzVrqJqVM4+xDiXPJCe26yVK6zpUZB7MSyntpYRA9TPXiDu0gtADD4D431SbO4ScuwyO C9VHJq9kv1d6rD6vCyDzsoAgz+0T+Lo= Received: from mail-qt1-f198.google.com (mail-qt1-f198.google.com [209.85.160.198]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-488-3SOudHRBO4-duWNYTuKrYQ-1; Tue, 07 Jul 2020 18:50:41 -0400 X-MC-Unique: 3SOudHRBO4-duWNYTuKrYQ-1 Received: by mail-qt1-f198.google.com with SMTP id u93so31777472qtd.8 for ; Tue, 07 Jul 2020 15:50:41 -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=ntPp8bHOPIXhq64ZYjMBP9tKw1Ahb/2+VdQMPS01kXM=; b=nTx4FlbA9EbPXt539e8nS56OnlnLoAoWsM9P7UPEOyeUxLqt0GuTrtY4cDXxXgP5IE ftlNmPERbMeOjaVb+PaGgcWKt9wRMpasjPfPR6FZZ5yMDQfO4bc9WAhDSYzXc3UwPSDo N7V3ZPf73Hiy/RHETeQ4c0BeadbW0vITYJ56C8EbG475KgbWSCK0Mfo4PUXvczMOh65U IUQHFXJMbCcpOWmWgAn6XI4I5TcwNKGCu4jFRsqF1dNNdumKN6/6ifdDxhQrZs1rFovD zVRbYsdLnKdCyA+JJGcnAvIJo8c0q5HGPRvkEVw3Jv/Ip+9L0KcI1E1D3NOoI34fCSUw e6pg== X-Gm-Message-State: AOAM532UMtFnqujZChP96/trYZWF5bFvflt9Q8slN3hmqnksUOCN55DM I/IJE8Mody+xu+Q80JjQZr72giaXfV5mEQXjouJxIBV2/HUqNmKKWA4tN53HR/OLqvvJfHaF7k5 ApJ1ITRFP8+o= X-Received: by 2002:a0c:e847:: with SMTP id l7mr56120981qvo.232.1594162240774; Tue, 07 Jul 2020 15:50:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwgovnWtiF+oysXYM9UD0AGaq7GBiLXSMQKB1qC50sXyGAmTr2SdnjgqnzmgDoXm4SpeSq8Kg== X-Received: by 2002:a0c:e847:: with SMTP id l7mr56120955qvo.232.1594162240518; Tue, 07 Jul 2020 15:50:40 -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.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jul 2020 15:50:39 -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 , Michal Simek Subject: [PATCH v5 10/25] mm/microblaze: Use general page fault accounting Date: Tue, 7 Jul 2020 18:50:06 -0400 Message-Id: <20200707225021.200906-11-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: C59B51A4A5 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 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