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 7B35EC433DF for ; Fri, 26 Jun 2020 22:36:35 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 36062208C7 for ; Fri, 26 Jun 2020 22:36:35 +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="T7unZ8cr" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 36062208C7 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 D9FD36B0023; Fri, 26 Jun 2020 18:36:34 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D4F9C6B0024; Fri, 26 Jun 2020 18:36:34 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C40466B0025; Fri, 26 Jun 2020 18:36:34 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0043.hostedemail.com [216.40.44.43]) by kanga.kvack.org (Postfix) with ESMTP id A95C06B0023 for ; Fri, 26 Jun 2020 18:36:34 -0400 (EDT) Received: from smtpin16.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 71D2D180AD82F for ; Fri, 26 Jun 2020 22:36:34 +0000 (UTC) X-FDA: 76972823508.16.mist94_541173f26e59 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin16.hostedemail.com (Postfix) with ESMTP id DAAC0100E690C for ; Fri, 26 Jun 2020 22:36:30 +0000 (UTC) X-HE-Tag: mist94_541173f26e59 X-Filterd-Recvd-Size: 5388 Received: from us-smtp-delivery-1.mimecast.com (us-smtp-2.mimecast.com [207.211.31.81]) by imf43.hostedemail.com (Postfix) with ESMTP for ; Fri, 26 Jun 2020 22:36:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1593210989; 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=8WnWhn2O9ddpmgT5q7yGLFrwE17K5+WMrtUB+3cLWEw=; b=T7unZ8crXjlXkOLJjRlwWXLhK4sVC4mMsiS+GQOg4tMp0gSFEANCbkpADolvYsPLlJFnKX 1L0flzovH8yx0RACUIma5EKGlZNzR2UPHRRC9scTFs6xvMHUfameCihystnaNKOWdYCVJw pVFFkpzgQ0XukG/kCTveXT1hu0HKkbE= Received: from mail-qk1-f197.google.com (mail-qk1-f197.google.com [209.85.222.197]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-475-g4iSnMxRODSeDV7vzRJ1Rg-1; Fri, 26 Jun 2020 18:36:28 -0400 X-MC-Unique: g4iSnMxRODSeDV7vzRJ1Rg-1 Received: by mail-qk1-f197.google.com with SMTP id a205so7654293qkc.16 for ; Fri, 26 Jun 2020 15:36:28 -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=8WnWhn2O9ddpmgT5q7yGLFrwE17K5+WMrtUB+3cLWEw=; b=KMsr2zQBL4/4ziM6b49ZaxXj9AIcWI+EG8ZohOSFNSqnv6I+EG3fX7W6+V/9AJSUcV dN7JS4/MO38/j7FnPVc9Ic3vG5znZID6j4kkZME3fqcLmBZzuQKJtnnm5/awCtfM8UoM uvSW9AYDJpLnrH6hT8GNq7vLjzcIqkLPBKe77WrLx/akG2eKg5BJtwDtSfMPR3sIERpL WA74YaJGfVF39pHkDZvDvulVMuIj9KPkmZvS+nQrrchOux1kc70RX2qovRW/Hkp/Jfyj 1UybNRvTXRCGRfQzeXKELKRx2o41cqZYwcvpSvhXCySLo9UE0twV77Jz/RRSdDVFEiuC 0K4A== X-Gm-Message-State: AOAM533fJaIfbiYFoP4vI5Xrsti4ByOlFruY183tf5JOK1JouiBupRGO 2MZ+sI5w3LWtTRvgQrkcBnEE4PBfF/V6DUvjHjOj/LZBaDcivrIz5+qONglAjbacvHE1sAhpGbC J1nR7oFiePOE= X-Received: by 2002:a05:620a:994:: with SMTP id x20mr2758444qkx.367.1593210987669; Fri, 26 Jun 2020 15:36:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyF7mXzjX2GYCldg8rpVKH+R/6CyjRUZNLT2pL9QW2hEVm9X8g93t+Jx2O/OTIhETTp/0bRvw== X-Received: by 2002:a05:620a:994:: with SMTP id x20mr2758423qkx.367.1593210987471; Fri, 26 Jun 2020 15:36:27 -0700 (PDT) Received: from xz-x1.redhat.com ([2607:9880:19c0:32::2]) by smtp.gmail.com with ESMTPSA id t9sm9463853qke.68.2020.06.26.15.36.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Jun 2020 15:36:26 -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 , Paul Walmsley , Palmer Dabbelt , Albert Ou , linux-riscv@lists.infradead.org Subject: [PATCH 17/26] mm/riscv: Use general page fault accounting Date: Fri, 26 Jun 2020 18:36:25 -0400 Message-Id: <20200626223625.199813-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: DAAC0100E690C 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. CC: Paul Walmsley CC: Palmer Dabbelt CC: Albert Ou CC: linux-riscv@lists.infradead.org Signed-off-by: Peter Xu --- arch/riscv/mm/fault.c | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/arch/riscv/mm/fault.c b/arch/riscv/mm/fault.c index 677ee1bb11ac..e796ba02b572 100644 --- a/arch/riscv/mm/fault.c +++ b/arch/riscv/mm/fault.c @@ -110,7 +110,7 @@ asmlinkage 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, addr, flags, NULL); + fault =3D handle_mm_fault(vma, addr, flags, regs); =20 /* * If we need to retry but a fatal signal is pending, handle the @@ -128,21 +128,7 @@ asmlinkage void do_page_fault(struct pt_regs *regs) 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) { - tsk->maj_flt++; - perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS_MAJ, - 1, regs, addr); - } else { - tsk->min_flt++; - perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS_MIN, - 1, regs, addr); - } if (fault & VM_FAULT_RETRY) { flags |=3D FAULT_FLAG_TRIED; =20 --=20 2.26.2