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 0A2D9C433F4 for ; Tue, 30 Jun 2020 20:46:15 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id BF7262078D for ; Tue, 30 Jun 2020 20:46:14 +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="LziHOV4D" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org BF7262078D 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 24E746B0075; Tue, 30 Jun 2020 16:46:13 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 188EF6B007B; Tue, 30 Jun 2020 16:46:13 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 075446B007D; Tue, 30 Jun 2020 16:46:13 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0209.hostedemail.com [216.40.44.209]) by kanga.kvack.org (Postfix) with ESMTP id E3A626B0075 for ; Tue, 30 Jun 2020 16:46:12 -0400 (EDT) Received: from smtpin29.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id A38AF1EE6 for ; Tue, 30 Jun 2020 20:46:12 +0000 (UTC) X-FDA: 76987060584.29.cap54_0d0c83926e7a Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin29.hostedemail.com (Postfix) with ESMTP id 7DE1C18086CDA for ; Tue, 30 Jun 2020 20:46:12 +0000 (UTC) X-HE-Tag: cap54_0d0c83926e7a X-Filterd-Recvd-Size: 5793 Received: from us-smtp-delivery-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.61]) by imf46.hostedemail.com (Postfix) with ESMTP for ; Tue, 30 Jun 2020 20:46:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1593549971; 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=/aAL+YqVyNIr1/+0GkFqbZ5SrplCx8CkqqCzwc93fOY=; b=LziHOV4DWXPDNJym42T5WBVP4e7LZGxjo9SXoS0FI4m4nKrC39SNcrL28rp71Q+FG8HTCt X6oj79x2z2ejQpdwgopWpZenMQ1sEX851L3TG31oleE19nJ5rfQoQAOwLgrNaNEpPM66sf 89j6UfQnndWw4hw05Wc2KWozlaSo7QA= Received: from mail-qk1-f199.google.com (mail-qk1-f199.google.com [209.85.222.199]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-356-eJ_VB0p2PBaffDKNkk9o5A-1; Tue, 30 Jun 2020 16:46:08 -0400 X-MC-Unique: eJ_VB0p2PBaffDKNkk9o5A-1 Received: by mail-qk1-f199.google.com with SMTP id h4so14675337qkl.23 for ; Tue, 30 Jun 2020 13:46:08 -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=/aAL+YqVyNIr1/+0GkFqbZ5SrplCx8CkqqCzwc93fOY=; b=q7AJZjs5K+4cKYYOjAiw2OmnJIShfzlzpna7jU89f64wuXr/6+m4mJHwgu2taPR2yE 53geYDwRwQD9LXPGvpO7Bt2+1Z5MZaer+GfX2gGTrGE/+ji+X6hzSRfPlOa3pWcq/N5B 08AG2Pnl6136KKGBgA0yFXEJDKNAfnXUBGOTJsCxsZN/W3lqqiPvYMc8Zrj4zsQ4OXXc kz3AtDV193z41HT9c9weBxXU5vC1IWECZs4te6bYftV0wWUCGCI66vS2BD1OLgXFqK4p v854g4xatDjf7Ukr66val4DQ3gHTablWLqYd+l3YCzRSb0pWuJw+Yd9An6j1eD5TS0Ea THPQ== X-Gm-Message-State: AOAM533p7plU092cWSaTaizzeB3G6lECe8gtBqKntrs+0yDGAiLMDLYw cmPaaREiK0fC0gRsjqLbiSyQvk5HbhRTzTE5Ew9HzHmp+JDdNsu5yMO28IORLSkhzYqHe3Ll4zY rimoucHIoGVk= X-Received: by 2002:ac8:3777:: with SMTP id p52mr22305343qtb.31.1593549967245; Tue, 30 Jun 2020 13:46:07 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxA5Qn2mPg7zu4RqzhVdNMOn9tGWBHigOGJIoAnItfVkgeeGrQilw31yhmo4PQ8Uq4TNeoO9g== X-Received: by 2002:ac8:3777:: with SMTP id p52mr22305300qtb.31.1593549966760; Tue, 30 Jun 2020 13:46:06 -0700 (PDT) Received: from xz-x1.redhat.com ([2607:9880:19c0:32::2]) by smtp.gmail.com with ESMTPSA id q29sm1563919qtc.10.2020.06.30.13.46.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Jun 2020 13:46:06 -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 , Chris Zankel , Max Filippov , linux-xtensa@linux-xtensa.org Subject: [PATCH v4 24/26] mm/xtensa: Use general page fault accounting Date: Tue, 30 Jun 2020 16:46:04 -0400 Message-Id: <20200630204604.39640-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: 7DE1C18086CDA 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. Remove the PERF_COUNT_SW_PAGE_FAULTS_[MAJ|MIN] perf events because it's n= ow also done in handle_mm_fault(). Move the PERF_COUNT_SW_PAGE_FAULTS event higher before taking mmap_sem fo= r the fault, then it'll match with the rest of the archs. CC: Chris Zankel CC: Max Filippov CC: linux-xtensa@linux-xtensa.org Acked-by: Max Filippov Signed-off-by: Peter Xu --- arch/xtensa/mm/fault.c | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/arch/xtensa/mm/fault.c b/arch/xtensa/mm/fault.c index 6942de45f078..a05b53a22810 100644 --- a/arch/xtensa/mm/fault.c +++ b/arch/xtensa/mm/fault.c @@ -73,6 +73,9 @@ void do_page_fault(struct pt_regs *regs) =20 if (user_mode(regs)) flags |=3D FAULT_FLAG_USER; + + perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS, 1, regs, address); + retry: mmap_read_lock(mm); vma =3D find_vma(mm, address); @@ -108,7 +111,7 @@ 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, address, flags, NULL); + fault =3D handle_mm_fault(vma, address, flags, regs); =20 if (fault_signal_pending(fault, regs)) return; @@ -123,10 +126,6 @@ void do_page_fault(struct pt_regs *regs) BUG(); } if (flags & FAULT_FLAG_ALLOW_RETRY) { - if (fault & VM_FAULT_MAJOR) - current->maj_flt++; - else - current->min_flt++; if (fault & VM_FAULT_RETRY) { flags |=3D FAULT_FLAG_TRIED; =20 @@ -140,12 +139,6 @@ void do_page_fault(struct pt_regs *regs) } =20 mmap_read_unlock(mm); - perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS, 1, regs, address); - if (flags & VM_FAULT_MAJOR) - perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS_MAJ, 1, regs, address); - else - perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS_MIN, 1, regs, address); - return; =20 /* Something tried to access memory that isn't in our memory map.. --=20 2.26.2