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 28DEFC433DF for ; Fri, 19 Jun 2020 16:07:52 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id DB30B217D8 for ; Fri, 19 Jun 2020 16:07:51 +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="QPFjdK9Y" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org DB30B217D8 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 8D0DC8D00B9; Fri, 19 Jun 2020 12:07:51 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 880B98D00AD; Fri, 19 Jun 2020 12:07:51 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 76F0C8D00B9; Fri, 19 Jun 2020 12:07:51 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0070.hostedemail.com [216.40.44.70]) by kanga.kvack.org (Postfix) with ESMTP id 5A68A8D00AD for ; Fri, 19 Jun 2020 12:07:51 -0400 (EDT) Received: from smtpin19.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 1C99D8248D51 for ; Fri, 19 Jun 2020 16:07:51 +0000 (UTC) X-FDA: 76946442342.19.kiss31_37100ae26e1a Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin19.hostedemail.com (Postfix) with ESMTP id 49E422ACE2 for ; Fri, 19 Jun 2020 16:06:02 +0000 (UTC) X-HE-Tag: kiss31_37100ae26e1a X-Filterd-Recvd-Size: 5568 Received: from us-smtp-delivery-1.mimecast.com (us-smtp-2.mimecast.com [205.139.110.61]) by imf41.hostedemail.com (Postfix) with ESMTP for ; Fri, 19 Jun 2020 16:06:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1592582761; 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=3dqCpbomUjM3yzMbNQtQFnUhCIZ/IBDwpBGYZavg7bk=; b=QPFjdK9YfksQFF04jzkOnDoslgVju9IMYWHrPSahgWtAcni5NTuX0i3JXnL/BbaawhIP4P 0gL/1de5x3btGlIxFg4VgP+gnASWyXkaq7nRYJsffxFG3Xj0t2u0I0xSm7/6cRrDAgnMBS GYusxMqtR51xYBJx+N5pV6rzeE9QmCg= Received: from mail-qk1-f198.google.com (mail-qk1-f198.google.com [209.85.222.198]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-468-iHO0xmTgOI20Nu0vWs0--g-1; Fri, 19 Jun 2020 12:05:59 -0400 X-MC-Unique: iHO0xmTgOI20Nu0vWs0--g-1 Received: by mail-qk1-f198.google.com with SMTP id 205so7476429qkh.5 for ; Fri, 19 Jun 2020 09:05:59 -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=3dqCpbomUjM3yzMbNQtQFnUhCIZ/IBDwpBGYZavg7bk=; b=JYwkzOPk4iSotRASLIvyEUlNLq7njqAz81zGlX9PM3gdm+HixiVgndG8AgKo48hr2t T2XbhqODyPlYcxJLBPm07kIW+ubs+d4SnN1WPYsAU5enDiPljvzJWAwApjXEHTiB6r3B 3QZP92x3ZMYnZOc//fvGpiGwJ7tPScNmeUWWuhBng74dynHTKsmxEkgawE+pheFx8mU5 8pD50zOu3aRCeff1dRKaeh+AE3HLupS9dZjkqsVhi04h5J3W0PmgS+vbT4jIvCCg7J5R OIRTHA3k1nYFd/PnsNwEHZLr982YhY8v9vpO4GZk1+dMSkzJsfXpQETWA2GlrRr5uKum FTiA== X-Gm-Message-State: AOAM533OP2ZucOrycAiEjbDlmhRFnIuOJzlx+PSlaeHT6o8waoxWH85m /8yhzk7IZCWDVrTJRvCnUKHXjoox6hMtNjyPM5kEpzi7zl6MxCvQcMjZMtjXwJGg2vhqPvRtVFG jK5mstSxMIoU= X-Received: by 2002:a05:620a:10ad:: with SMTP id h13mr4366729qkk.373.1592582759112; Fri, 19 Jun 2020 09:05:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx3/0AzPGmc/mgScudox87Z+KKyBmz3uCW7RXHY47m0M7+4IoVxehRGqL+MdgH5iyR2bGppkA== X-Received: by 2002:a05:620a:10ad:: with SMTP id h13mr4366702qkk.373.1592582758840; Fri, 19 Jun 2020 09:05:58 -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.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Jun 2020 09:05:57 -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 , Michal Simek Subject: [PATCH 10/26] mm/microblaze: Use general page fault accounting Date: Fri, 19 Jun 2020 12:05:22 -0400 Message-Id: <20200619160538.8641-11-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: 49E422ACE2 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. 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: Michal Simek Signed-off-by: Peter Xu --- arch/microblaze/mm/fault.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/arch/microblaze/mm/fault.c b/arch/microblaze/mm/fault.c index 9abfa5224386..3d58dbd227cd 100644 --- a/arch/microblaze/mm/fault.c +++ b/arch/microblaze/mm/fault.c @@ -28,6 +28,7 @@ #include #include #include +#include =20 #include #include @@ -122,6 +123,8 @@ void do_page_fault(struct pt_regs *regs, unsigned lon= g address, if (user_mode(regs)) flags |=3D FAULT_FLAG_USER; =20 + perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS, 1, regs, address); + /* When running in the kernel we expect faults to occur only to * addresses in user space. All other faults represent errors in the * kernel and should generate an OOPS. Unfortunately, in the case of a= n @@ -215,7 +218,7 @@ void do_page_fault(struct pt_regs *regs, unsigned lon= g address, * 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; @@ -231,10 +234,6 @@ void do_page_fault(struct pt_regs *regs, unsigned lo= ng address, } =20 if (flags & FAULT_FLAG_ALLOW_RETRY) { - if (unlikely(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