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 2C455C433E1 for ; Tue, 7 Jul 2020 22:50:54 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id E2E6820738 for ; Tue, 7 Jul 2020 22:50:53 +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="YIV8lRrA" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E2E6820738 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 2EE096B00B5; Tue, 7 Jul 2020 18:50:45 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 206BD6B00B7; Tue, 7 Jul 2020 18:50:45 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id ECF716B00B8; Tue, 7 Jul 2020 18:50:44 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0138.hostedemail.com [216.40.44.138]) by kanga.kvack.org (Postfix) with ESMTP id D01306B00B5 for ; Tue, 7 Jul 2020 18:50:44 -0400 (EDT) Received: from smtpin21.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 930F78248D52 for ; Tue, 7 Jul 2020 22:50:44 +0000 (UTC) X-FDA: 77012776008.21.month25_001126626eb8 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin21.hostedemail.com (Postfix) with ESMTP id 6FED1180442C2 for ; Tue, 7 Jul 2020 22:50:44 +0000 (UTC) X-HE-Tag: month25_001126626eb8 X-Filterd-Recvd-Size: 5836 Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) by imf18.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=1594162243; 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=8f5TTLJDyENYlbFehaNnbtlaq4/fY2SMNvjmVOggAGU=; b=YIV8lRrAxbwW6WjJ++ggcXwlAS0CnbckWgXhzbrSek0JukDj6uBHq7V+f8UKBfigNe1l7q JiAFl2SCcgKA5Y4jzfxVrbNhZab5MXTkHSBs97KC6qo08Y6/nMVhb+TZGCJLR5MQNMW//K 2816oWQW0QhTALBiGGp/jDppXOL8moo= Received: from mail-qv1-f70.google.com (mail-qv1-f70.google.com [209.85.219.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-259-ODuzfHgDM7eoI0ATGnvQBw-1; Tue, 07 Jul 2020 18:50:39 -0400 X-MC-Unique: ODuzfHgDM7eoI0ATGnvQBw-1 Received: by mail-qv1-f70.google.com with SMTP id m18so14962174qvt.8 for ; Tue, 07 Jul 2020 15:50:39 -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=8f5TTLJDyENYlbFehaNnbtlaq4/fY2SMNvjmVOggAGU=; b=WQ46MdwwZK+oPJ8XwO0LiQ/Yy59oqJQAjPKRKtnO+Qq+jsdEl5RxuwMxInP7i8PzgD jtX3G3G3oqwYnn1obOFFruzq33K4crNPXH36jbV0tIkUF0GTzMkMb+L6+l8UBEGrjlft MMbES+Z+JQ2eDkSj91pfmFitObDlcXyl4cF8A2Gf0bJvXwLT/Zj8EL1ArwREFXFE7i4j WUsvT2z7JOPtMduNoblqGs9vtVwXWIEOv6T67e7CTNEAbJllCSpM7DLT9Z2rSPTOQu7w uv7ltc7fQQC12Qls9dxM0kIfzoG/nyq9YV7BHmsRHhL0poCWPiZauAjJMxSpiVFOEw1i 7UsQ== X-Gm-Message-State: AOAM531Bg23TReJMROIE45jljNOJzGzfiTpXlCg3+e933V/p6VM9zD63 MNsIS85o3nXx7AGPhpNkKEoCoV0Q9564DGlCXW3wWsaffzEE5nz64ByDrVMxYA1GcWt4RPXCrxs eSftayh2pTOU= X-Received: by 2002:a05:6214:949:: with SMTP id dn9mr51711871qvb.116.1594162239229; Tue, 07 Jul 2020 15:50:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxYnZ/sBwn9kw3lX9BrDVhoNgmUHTzKr+RCjgXjVMxWi/R7wstbktVvXocMev9XoXXGqSRu1Q== X-Received: by 2002:a05:6214:949:: with SMTP id dn9mr51711848qvb.116.1594162238945; Tue, 07 Jul 2020 15:50:38 -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.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jul 2020 15:50:38 -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 , Geert Uytterhoeven , linux-m68k@lists.linux-m68k.org Subject: [PATCH v5 09/25] mm/m68k: Use general page fault accounting Date: Tue, 7 Jul 2020 18:50:05 -0400 Message-Id: <20200707225021.200906-10-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: 6FED1180442C2 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: 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 08b35a318ebe..795f483b1050 100644 --- a/arch/m68k/mm/fault.c +++ b/arch/m68k/mm/fault.c @@ -12,6 +12,7 @@ #include #include #include +#include =20 #include #include @@ -84,6 +85,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: mmap_read_lock(mm); =20 @@ -134,7 +137,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)) @@ -150,16 +153,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