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 3E7EBC433DF for ; Fri, 19 Jun 2020 16:07:07 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id DA5E121532 for ; Fri, 19 Jun 2020 16:07:06 +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="FmAyfUGx" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org DA5E121532 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 4B11E8D00B2; Fri, 19 Jun 2020 12:07:06 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 4619B8D00AD; Fri, 19 Jun 2020 12:07:06 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 350058D00B2; Fri, 19 Jun 2020 12:07:06 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0102.hostedemail.com [216.40.44.102]) by kanga.kvack.org (Postfix) with ESMTP id 1897A8D00AD for ; Fri, 19 Jun 2020 12:07:06 -0400 (EDT) Received: from smtpin02.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id C91E08248D51 for ; Fri, 19 Jun 2020 16:07:05 +0000 (UTC) X-FDA: 76946440410.02.trade29_1015bf126e1a Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin02.hostedemail.com (Postfix) with ESMTP id 9C0F020001E55EFD for ; Fri, 19 Jun 2020 16:06:06 +0000 (UTC) X-HE-Tag: trade29_1015bf126e1a X-Filterd-Recvd-Size: 5635 Received: from us-smtp-delivery-1.mimecast.com (us-smtp-1.mimecast.com [207.211.31.81]) by imf33.hostedemail.com (Postfix) with ESMTP for ; Fri, 19 Jun 2020 16:06:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1592582762; 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=lYOPBG0iFD9F9VjgENlAdm0PiHZqNHDJn1sXF2V/+vk=; b=FmAyfUGxEKyYicabTvOX9hXhE1BmJMBeD4/0q5ZYFaFNijNIegY0MkYsHo0oXs4IpXNCQg D98PHm/OWR53VUme+PfNu3sS11IP1c4Mdjheh11HcRQTfty91vGJMPpo0kXWXF6LPVibmX v5Fb1+phDDGY6Dv32upynfAQlnqHjuU= Received: from mail-qt1-f199.google.com (mail-qt1-f199.google.com [209.85.160.199]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-303-JMHK5trlNJCPS3j6VqhzPA-1; Fri, 19 Jun 2020 12:06:00 -0400 X-MC-Unique: JMHK5trlNJCPS3j6VqhzPA-1 Received: by mail-qt1-f199.google.com with SMTP id y5so7444219qtd.0 for ; Fri, 19 Jun 2020 09:06:00 -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=lYOPBG0iFD9F9VjgENlAdm0PiHZqNHDJn1sXF2V/+vk=; b=lOoAxYW7e2n+SzX/MfYf+xRxiqrF0BpPB9UQQC8E7WWwdY8xJxwxR+wXL0A1/3CghO ra98Fw444SkirtYBnK134jQ5pDxsfmv7VEL14O7vA7ZKbTvxL+uoyQ2Ruk1C5xdD9WOQ 607hBgAmmmfBvdvWad0scinTWi3+PnlytX60DSQOKsSCaZc2/JbqWpTEzovyczIPNvi+ Nhpx9s/nHbuA2Muz9vYFBfr931kc6ZY5bJMllR1n7yikfP62itkwtnuysNTRnUC0B3ay cx4SW6S86zVaDpO8bAciQSoFi5FX5ZzNO46nf6/etiEfW+8yPf34trnfaCvPIdQPzWTw 9KtA== X-Gm-Message-State: AOAM5301zOtTM6R3H+DlYbK41p53DmPDF/KA7Txp7JQ04SVXJAlV2s/N oQmx2ypmjKgm0DR/oYOsuTirlr5Nl0LWOEmbc9bxgHOGGqymuSjeIw/qoIZ5V147xfa+0l66N4B Ooyq8hmQCqfU= X-Received: by 2002:aed:29e6:: with SMTP id o93mr4023510qtd.135.1592582757407; Fri, 19 Jun 2020 09:05:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxxln6wPfL9eSCFZYzdRyC9ZdfjMa92r0xY4V7AGxdmExb5DyEte9R6BPboKGMNjvpqtx9bDA== X-Received: by 2002:aed:29e6:: with SMTP id o93mr4023464qtd.135.1592582756856; Fri, 19 Jun 2020 09:05:56 -0700 (PDT) Received: from xz-x1.redhat.com ([2607:9880:19c0:32::2]) by smtp.gmail.com with ESMTPSA id g11sm6412604qkk.123.2020.06.19.09.05.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Jun 2020 09:05:56 -0700 (PDT) From: Peter Xu To: linux-kernel@vger.kernel.org, linux-mm@kvack.org Cc: Gerald Schaefer , peterx@redhat.com, Andrew Morton , Andrea Arcangeli , Will Deacon , Michael Ellerman , Linus Torvalds , Geert Uytterhoeven , linux-m68k@lists.linux-m68k.org Subject: [PATCH 09/26] mm/m68k: Use general page fault accounting Date: Fri, 19 Jun 2020 12:05:21 -0400 Message-Id: <20200619160538.8641-10-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: 9C0F020001E55EFD X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam05 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: Geert Uytterhoeven CC: linux-m68k@lists.linux-m68k.org Signed-off-by: Peter Xu --- arch/m68k/mm/fault.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/arch/m68k/mm/fault.c b/arch/m68k/mm/fault.c index 2db38dfbc00c..983054d209bc 100644 --- a/arch/m68k/mm/fault.c +++ b/arch/m68k/mm/fault.c @@ -12,6 +12,7 @@ #include #include #include +#include =20 #include #include @@ -85,6 +86,8 @@ int do_page_fault(struct pt_regs *regs, unsigned long a= ddress, =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); =20 @@ -135,7 +138,7 @@ int do_page_fault(struct pt_regs *regs, unsigned long= address, * the fault. */ =20 - fault =3D handle_mm_fault(vma, address, flags, NULL); + fault =3D handle_mm_fault(vma, address, flags, regs); pr_debug("handle_mm_fault returns %x\n", fault); =20 if (fault_signal_pending(fault, regs)) @@ -151,16 +154,7 @@ int do_page_fault(struct pt_regs *regs, unsigned lon= g address, BUG(); } =20 - /* - * Major/minor page fault accounting is only done on the - * initial attempt. If we go through a retry, it is extremely - * likely that the page will be found in page cache at that point. - */ 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 --=20 2.26.2