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,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 DCB85C433E6 for ; Tue, 30 Jun 2020 20:45:44 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id A05D220772 for ; Tue, 30 Jun 2020 20:45:44 +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="bCSxtIVh" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A05D220772 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 50C0B6B002C; Tue, 30 Jun 2020 16:45:44 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 4BC6C6B002D; Tue, 30 Jun 2020 16:45:44 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3863C6B002E; Tue, 30 Jun 2020 16:45:44 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0076.hostedemail.com [216.40.44.76]) by kanga.kvack.org (Postfix) with ESMTP id 2314F6B002C for ; Tue, 30 Jun 2020 16:45:44 -0400 (EDT) Received: from smtpin16.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id E3F391EF1 for ; Tue, 30 Jun 2020 20:45:43 +0000 (UTC) X-FDA: 76987059366.16.van03_5303d5326e7a Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin16.hostedemail.com (Postfix) with ESMTP id B3462100E6903 for ; Tue, 30 Jun 2020 20:45:43 +0000 (UTC) X-HE-Tag: van03_5303d5326e7a X-Filterd-Recvd-Size: 5664 Received: from us-smtp-delivery-1.mimecast.com (us-smtp-2.mimecast.com [207.211.31.81]) by imf31.hostedemail.com (Postfix) with ESMTP for ; Tue, 30 Jun 2020 20:45:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1593549942; 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; bh=/OgQ3igxRFmWHn0+Y9XrBgGWT5Mzg0+fUW3Zyepd27I=; b=bCSxtIVhLgVKj6buRe0jK+zN9k/yRU6UMlQYJGA7nzpIpQHxXJiHlgrOy2Ukvz/u8DBEJu hkR9A+ExCFyc3lnKi6IaDPW3RazYV4AZsuXM2sl43XphcOlrSo/Z2F+3JDNI8LDH9TkT06 P37WZhiNurRYsRLagTpiWAECU1QKJ/I= 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-173-AqmSgo0lPtqz8HLVlElLuA-1; Tue, 30 Jun 2020 16:45:41 -0400 X-MC-Unique: AqmSgo0lPtqz8HLVlElLuA-1 Received: by mail-qv1-f70.google.com with SMTP id j18so14680224qvk.1 for ; Tue, 30 Jun 2020 13:45:41 -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:mime-version :content-transfer-encoding; bh=/OgQ3igxRFmWHn0+Y9XrBgGWT5Mzg0+fUW3Zyepd27I=; b=rdwqXWvImX+L8Lj1w12e7gvPdbAcczBPPZoKOd9Gpwt4Dw3bHPDDvwiUtYRT9Iv0MK 3YvOqApTQQC5BQGonSN89WlNbB3Vi9nuTlN0iOtRL6RS3ZjKK8OVIUrxofqbwILLPU4G mIi3dn6ugGaV7DbnKG4h/OOJc2Z2pCH+hSNlBE8XodeTbf7ozxyLn7v8eGxHZ4y4dW5C WJiT+Pn7jhZv2hDOvJnvLnXLABhD17HEwC51IxXn0sRHaX2tCcbyYHiOBkooE/7vu+aJ U2EFc13c2immlf+PiT3XyaxLERzQhxnpTgkVH4BI0Lnt7YemNi14i4dYjxE3w3JCxe4x /UEw== X-Gm-Message-State: AOAM533TppTxJGYg1qO9dLQQ8KrQKZFOLEt9mHiXeHb7nm4CXofADX0O 6jpTrJ2CJphRDK8EuOc81MCyRNhpZrGlVREOjux9zGghC3pMVqsWF+ZCil79Z9J/sv9RgNYtcEY vg8dTZEhfM2Y= X-Received: by 2002:ac8:7512:: with SMTP id u18mr21565594qtq.85.1593549939139; Tue, 30 Jun 2020 13:45:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzrq8y45uqCywGIm4yWqg1FVgQgY7p5Y/VuWHOhbRuiBWgzglNEydMONNKVfrJW9amJ/IMJxw== X-Received: by 2002:ac8:7512:: with SMTP id u18mr21565511qtq.85.1593549937837; Tue, 30 Jun 2020 13:45:37 -0700 (PDT) Received: from xz-x1.redhat.com ([2607:9880:19c0:32::2]) by smtp.gmail.com with ESMTPSA id a15sm3767215qkl.129.2020.06.30.13.45.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Jun 2020 13:45:37 -0700 (PDT) From: Peter Xu To: linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: Andrew Morton , peterx@redhat.com, John Hubbard , Michael Ellerman , Gerald Schaefer , Andrea Arcangeli , Linus Torvalds , Will Deacon , Ley Foon Tan Subject: [PATCH v4 13/26] mm/nios2: Use general page fault accounting Date: Tue, 30 Jun 2020 16:45:35 -0400 Message-Id: <20200630204535.39101-1-peterx@redhat.com> X-Mailer: git-send-email 2.26.2 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: B3462100E6903 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam01 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: Ley Foon Tan Signed-off-by: Peter Xu --- arch/nios2/mm/fault.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/arch/nios2/mm/fault.c b/arch/nios2/mm/fault.c index 86beb9a2698e..9476feecf512 100644 --- a/arch/nios2/mm/fault.c +++ b/arch/nios2/mm/fault.c @@ -24,6 +24,7 @@ #include #include #include +#include =20 #include #include @@ -83,6 +84,8 @@ asmlinkage void do_page_fault(struct pt_regs *regs, uns= igned long cause, if (user_mode(regs)) flags |=3D FAULT_FLAG_USER; =20 + perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS, 1, regs, address); + if (!mmap_read_trylock(mm)) { if (!user_mode(regs) && !search_exception_tables(regs->ea)) goto bad_area_nosemaphore; @@ -131,7 +134,7 @@ asmlinkage void do_page_fault(struct pt_regs *regs, u= nsigned long cause, * 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; @@ -146,16 +149,7 @@ asmlinkage void do_page_fault(struct pt_regs *regs, = unsigned long cause, 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