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 9AB9DC433E1 for ; Fri, 26 Jun 2020 22:36:54 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 5F91520C09 for ; Fri, 26 Jun 2020 22:36:54 +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="UVlxA16R" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5F91520C09 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 52A596B0037; Fri, 26 Jun 2020 18:36:52 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 406DF6B0055; Fri, 26 Jun 2020 18:36:52 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 253946B0037; Fri, 26 Jun 2020 18:36:52 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0193.hostedemail.com [216.40.44.193]) by kanga.kvack.org (Postfix) with ESMTP id 0C2456B0033 for ; Fri, 26 Jun 2020 18:36:52 -0400 (EDT) Received: from smtpin13.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id C5465181ABE85 for ; Fri, 26 Jun 2020 22:36:51 +0000 (UTC) X-FDA: 76972824222.13.party60_4b0139226e59 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin13.hostedemail.com (Postfix) with ESMTP id 94C5818140B69 for ; Fri, 26 Jun 2020 22:36:51 +0000 (UTC) X-HE-Tag: party60_4b0139226e59 X-Filterd-Recvd-Size: 5842 Received: from us-smtp-delivery-1.mimecast.com (us-smtp-2.mimecast.com [207.211.31.81]) by imf49.hostedemail.com (Postfix) with ESMTP for ; Fri, 26 Jun 2020 22:36:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1593211010; 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=UVlxA16Rgc6m5b2g+GWjfVknbTyRpLVjYgth296/E6uWOfhRBunaz5I+s4EuzGGM92z4f9 UnaCGRombsxUdPx0zsqAtUCyKvb2f80GXNTv4jEkGtbjOc3QdyK9nW6F7I4/LVi5xmkOH7 /mXXERvwkZWtOjuRLxI3a06wKEgHYyY= 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-313-xTyweUHpP3i-Pijk9Sctyg-1; Fri, 26 Jun 2020 18:36:46 -0400 X-MC-Unique: xTyweUHpP3i-Pijk9Sctyg-1 Received: by mail-qk1-f200.google.com with SMTP id 204so7667244qki.20 for ; Fri, 26 Jun 2020 15:36:46 -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=OklX3u63nebwMrPBlcBGSQzJha2xLzKxFxyP3hAKPTL5KpA+YuAVnfWw/NVM2utM3T Esn0LcixKIHS5VBZ3FI0hkioggDgNTdeN0naL7nsS6u1rM+9d413uGpUX/myHGtOyz/E ymqnEwKABQRONDrF7o8PrlyWCjvfx7ZNn8XKqLKdB3eQ/sibc7/bHhwDTxsVlZ4HiJXP NrGomms4IcpnyKrFjuE5RUm2BuRdYpC6bWg+4h09S0ZzzJT2OOtAzKnAdrLLhvBGuG1J xKNYbKbB3Xtr46T49AulnrMnVbIztdaN32/ZrA2/t2p1CPdoGAxy1ALHa+M3jjAhmgIq zjpQ== X-Gm-Message-State: AOAM532LlM0OHzqY3eQ9Dh+ZgsWS3/G5oBlDcMsVnm64RiYZtw/G1hj1 ctOvad5mYVNeEM8JoTCqg7V7/GeTqde7w/ADo6Qzz6TTmJ9VWSdLi5DpzyYOauZf6fRZ/dXFFRt YK2D9hFQlzUA= X-Received: by 2002:a37:7902:: with SMTP id u2mr5018364qkc.53.1593211005446; Fri, 26 Jun 2020 15:36:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz4rHIJ+fZotKVVngfN/0wEgFoPpGcYIDEVRwjbxqvl3WnyNUGWXCN5el2iLD4ILApdcoxlJQ== X-Received: by 2002:a37:7902:: with SMTP id u2mr5018340qkc.53.1593211005229; Fri, 26 Jun 2020 15:36:45 -0700 (PDT) Received: from xz-x1.redhat.com ([2607:9880:19c0:32::2]) by smtp.gmail.com with ESMTPSA id v2sm9347394qtq.8.2020.06.26.15.36.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Jun 2020 15:36:44 -0700 (PDT) From: Peter Xu To: linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: Peter Xu , Andrew Morton , Linus Torvalds , Gerald Schaefer , Andrea Arcangeli , Will Deacon , Michael Ellerman , Chris Zankel , Max Filippov , linux-xtensa@linux-xtensa.org Subject: [PATCH 24/26] mm/xtensa: Use general page fault accounting Date: Fri, 26 Jun 2020 18:36:43 -0400 Message-Id: <20200626223643.200151-1-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: 94C5818140B69 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam03 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