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 DB820C433DF for ; Fri, 19 Jun 2020 16:14:13 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 94DAE21707 for ; Fri, 19 Jun 2020 16:14:13 +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="XAow0kmV" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 94DAE21707 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 3C55B8D00C5; Fri, 19 Jun 2020 12:14:13 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 375DE8D00AD; Fri, 19 Jun 2020 12:14:13 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 263E58D00C5; Fri, 19 Jun 2020 12:14:13 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0104.hostedemail.com [216.40.44.104]) by kanga.kvack.org (Postfix) with ESMTP id 0A2F88D00AD for ; Fri, 19 Jun 2020 12:14:13 -0400 (EDT) Received: from smtpin10.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id C1D7F181AC9CC for ; Fri, 19 Jun 2020 16:14:12 +0000 (UTC) X-FDA: 76946458344.10.songs36_4a13f6826e1a Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin10.hostedemail.com (Postfix) with ESMTP id 5691A13E08A for ; Fri, 19 Jun 2020 16:14:04 +0000 (UTC) X-HE-Tag: songs36_4a13f6826e1a X-Filterd-Recvd-Size: 5842 Received: from us-smtp-delivery-1.mimecast.com (us-smtp-1.mimecast.com [207.211.31.81]) by imf47.hostedemail.com (Postfix) with ESMTP for ; Fri, 19 Jun 2020 16:14:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1592583243; 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=nuO+Yb0GY5ATg//nVupU36tJbGPoBpffcxCpoCITILo=; b=XAow0kmVkFpyhDXW9pTMZl+x8U6Fmsh0q+PXz10qqgKISjIeylF2NHfSUJ1dZr/CgG7c4r FP3SsVWxvuQE57YUGf78wLc6I/uzXqzUuwmsT1aN87k61X2PjcRiYEfW9QQ9zJ4Cj4ZRwL LwvHCmI3CaqYzZXDUE5Ln7MI9/RtTn0= Received: from mail-qt1-f197.google.com (mail-qt1-f197.google.com [209.85.160.197]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-507-Yd0ivzz7NkiX-Za_5RWauQ-1; Fri, 19 Jun 2020 12:14:01 -0400 X-MC-Unique: Yd0ivzz7NkiX-Za_5RWauQ-1 Received: by mail-qt1-f197.google.com with SMTP id l19so7465158qtp.12 for ; Fri, 19 Jun 2020 09:14:01 -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=nuO+Yb0GY5ATg//nVupU36tJbGPoBpffcxCpoCITILo=; b=AP1Fy20/7cCuxHKShiNcyYfNyyLNG8BfABJetc19eZGQ5AIsooqvxvh2HvNSPadgJZ StPQZRoGPJwGiT/3y7RRLxjW/afXcIihk1U1oU5QhHAZ2Cq4iNTH9lctNSIFhX78cHF9 Pi8WV4hy8MiRUF0jxFVeZOmCj4WbV/6c7/YqbelMgSVMgepz44TjdoRjjaDlYngz3dLF ogyllH7wl8M65a6BHXAdNA9+cP9NY/GsAWSDdPIrYx4ryijliYZI9CaHIeR28bhzCFkH BLCr588feS5c8ccHA3TcVRH1Zc82U/g+K2VIQYp/+N2O8gVhofXy5vBdkjPRLTn5HEs+ OKTw== X-Gm-Message-State: AOAM531A+HeFhZFfeeW0MslnOlpdnY4fBEZt0lnAu+NYSxlcO9hkdkWL Zi/Vzo8ecBI0RAK3RYtQwcUXmaDPGoyfC6vy8rbEm049xtfQyAUmwGhmDOl+/Frq7HdqOLo3sgg 9ld3nU0cg/r8= X-Received: by 2002:a37:4a90:: with SMTP id x138mr4285142qka.74.1592583241033; Fri, 19 Jun 2020 09:14:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJywyVrKaOWk1ZbIHQBjTISBQH/HyM8FFN6FV+FgYS4h/6d6EkOdlZqisWhzLL/0kWu70yra1g== X-Received: by 2002:a37:4a90:: with SMTP id x138mr4285122qka.74.1592583240788; Fri, 19 Jun 2020 09:14:00 -0700 (PDT) Received: from xz-x1.redhat.com ([2607:9880:19c0:32::2]) by smtp.gmail.com with ESMTPSA id m26sm7588426qtm.73.2020.06.19.09.13.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Jun 2020 09:14:00 -0700 (PDT) From: Peter Xu To: linux-kernel@vger.kernel.org, linux-mm@kvack.org Cc: Peter Xu , Gerald Schaefer , Andrew Morton , Andrea Arcangeli , Will Deacon , Michael Ellerman , Linus Torvalds , Chris Zankel , Max Filippov , linux-xtensa@linux-xtensa.org Subject: [PATCH 24/26] mm/xtensa: Use general page fault accounting Date: Fri, 19 Jun 2020 12:13:58 -0400 Message-Id: <20200619161358.9956-1-peterx@redhat.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200619160538.8641-1-peterx@redhat.com> References: <20200619160538.8641-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: 5691A13E08A 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. 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 722ef3c98d60..9ef7331e37f8 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: down_read(&mm->mmap_sem); 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 up_read(&mm->mmap_sem); - 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