Received: by 2002:a05:6358:53a8:b0:117:f937:c515 with SMTP id z40csp4646925rwe; Mon, 17 Apr 2023 16:30:30 -0700 (PDT) X-Google-Smtp-Source: AKy350YJZxTZKzhACwivHbIsX29TTrr+baXCTuSQkZQMAR7SWqx7yKMtaP5lpjINu5BJKRYAcT45 X-Received: by 2002:a05:6a00:1785:b0:63c:6485:d5e5 with SMTP id s5-20020a056a00178500b0063c6485d5e5mr7303505pfg.22.1681774230045; Mon, 17 Apr 2023 16:30:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681774230; cv=none; d=google.com; s=arc-20160816; b=soYR1iYa8Z0N63X1Q3IXZbKwD8ipsMZxofroREU6ya+S9dyJKTaZ5UVahSoFfwjEAU ZdYyZ5N5ei5seMuoWM8Vg/fuooOOl3g8iRyOMt3o8rLok11v9l4Dog8ivuIrYwdWRrje LQZMyo2jbR1zOxFW5uLhK8QuFbYX+SaDsjaAvJl+5sPDxAOfn9oBhQy1xYA8a2YvDJgk CkrF+g3+6/devogX++fqP4HwqIwqIWRDnCiA8qFU0+X8HX5jWTd6ANzH/STeSA7Tmg5b bicWph82i/hHbKg8AciG8beXcVgF0OJzzMlT1Q2+1kpEJ54+H0CrTxNrw9S/bKgRkv50 ym0w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=P7sqT2MMNV6p6hOax3PoPR+0asBKqco8uuNCkq2LhVM=; b=tjIqmQZbwg4Wv7yv3RchPpf458urt86y83+Awv5ZSSe7dXQrYVsVp/SG6zdP8Y17ee WKY4DGH8y2sND+61e4EKyLWRe0IMY6BsCR46slxZc+vwPnvD2sWAHVHxMeQbL2vjJkfF 4bZMcCV5x90RNbNSweG+/fgF215BdGDQ8CzYI2WqFS7Rzkuym3s2pKukhKqERw47yEz5 md/Th/cji1JopgaTeSAQ89S50AVpmcSrPbppa0/sNjpT+vOg8oGD/dm6Mll8pyYm0O+5 8ItsfLk9N1kmZGXMl9cLU9nSKmuV26buL4/Wdgv2F8PdRhyA6gnfBxMsJp/fh0SmeqJ3 OMAA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20221208 header.b=XFhs4lbT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h70-20020a638349000000b0051baf3f1b34si4252675pge.423.2023.04.17.16.30.15; Mon, 17 Apr 2023 16:30:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20221208 header.b=XFhs4lbT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229745AbjDQXR7 (ORCPT + 99 others); Mon, 17 Apr 2023 19:17:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49910 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229619AbjDQXR6 (ORCPT ); Mon, 17 Apr 2023 19:17:58 -0400 Received: from mail-yw1-x112a.google.com (mail-yw1-x112a.google.com [IPv6:2607:f8b0:4864:20::112a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A8D3140FA for ; Mon, 17 Apr 2023 16:17:57 -0700 (PDT) Received: by mail-yw1-x112a.google.com with SMTP id 00721157ae682-54c0c86a436so555951327b3.6 for ; Mon, 17 Apr 2023 16:17:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1681773477; x=1684365477; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=P7sqT2MMNV6p6hOax3PoPR+0asBKqco8uuNCkq2LhVM=; b=XFhs4lbTpFBkCbCXvQgW2oHC5DWbyjcxDrzxy6sUo++VgawktEiOJALIBFGSjXar1u dIP4YXahmH0tn11zBHVHQ49Gp5gjfovqSQ/Sz1gsKEM7ENStkLmat84xQhyzk0E88z50 0G24fj2YYeJlDbHkj7M5Omk8UDuV1lh1rjciHXC7oCkk7DuhQSXgoQ4z8lwa0B5zUixJ jggcH6zEHhkXFQeV3F2WvY8OTOqzB5LmfqR9ziz8WoltWMPovWPFQ9mFxaSQW1r4ERtN JuWxZtlaxKp4zLLDCTFB4zcF4pDUnhcLmVMwck67DGOsH0gdPGuUQ+eu/ljmq6Q9hB+7 9LUw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681773477; x=1684365477; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=P7sqT2MMNV6p6hOax3PoPR+0asBKqco8uuNCkq2LhVM=; b=D0MlhrfGoaecrASx9Zued3XjsKTKQTosGQjMtILMdGqm/G9lFUDteP9nIg7scQlitP O4KJT+VokDLhGrbEPSASe2EzPyf6X2fWEJ1UpHECzeVPESNzpheNw6CezKKSEsBTd2mS FI02WsHLsXWteJlSjFTbjmRlphPxfO6HoxJq5wLAqNLwnMNdpDI9hTYFMd90eFcYFqcA S0ms6F5GU2jgninbMJG9ZyItoGdK0+Rf6YIxAKvelcW1vNhsD1kPzEOrQl5nAHe2TkbA VNxMXRz/+/IN2juOzDqrwFktD0sMVTdRFzWgQCdPx/7Sod7O+LsKBo5neQeSMhCv5Am5 z4yQ== X-Gm-Message-State: AAQBX9duwyohMKvMu4/N3gwWejdM5deEqOQqfXQhxLdvXXS3fljeFmU3 CjFT3bK4Tle+WXtPzY80NFjez1dvyUZlEwXaPeaO5Q== X-Received: by 2002:a81:4415:0:b0:54f:9e1b:971c with SMTP id r21-20020a814415000000b0054f9e1b971cmr10701230ywa.1.1681773476678; Mon, 17 Apr 2023 16:17:56 -0700 (PDT) MIME-Version: 1.0 References: <20230415000818.1955007-1-surenb@google.com> In-Reply-To: From: Suren Baghdasaryan Date: Mon, 17 Apr 2023 16:17:45 -0700 Message-ID: Subject: Re: [PATCH v2 1/1] mm: do not increment pgfault stats when page fault handler retries To: Matthew Wilcox Cc: Peter Xu , akpm@linux-foundation.org, hannes@cmpxchg.org, mhocko@suse.com, josef@toxicpanda.com, jack@suse.cz, ldufour@linux.ibm.com, laurent.dufour@fr.ibm.com, michel@lespinasse.org, liam.howlett@oracle.com, jglisse@google.com, vbabka@suse.cz, minchan@google.com, dave@stgolabs.net, punit.agrawal@bytedance.com, lstoakes@gmail.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org, kernel-team@android.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-17.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Apr 17, 2023 at 3:52=E2=80=AFPM Matthew Wilcox wrote: > > On Mon, Apr 17, 2023 at 03:40:33PM -0400, Peter Xu wrote: > > > /* > > > - * We don't do accounting for some specific faults: > > > - * > > > - * - Unsuccessful faults (e.g. when the address wasn't valid). T= hat > > > - * includes arch_vma_access_permitted() failing before reaching= here. > > > - * So this is not a "this many hardware page faults" counter. = We > > > - * should use the hw profiling for that. > > > - * > > > - * - Incomplete faults (VM_FAULT_RETRY). They will only be count= ed > > > - * once they're completed. > > > + * Do not account for incomplete faults (VM_FAULT_RETRY). They wi= ll be > > > + * counted upon completion. > > > */ > > > - if (ret & (VM_FAULT_ERROR | VM_FAULT_RETRY)) > > > + if (ret & VM_FAULT_RETRY) > > > + return; > > > + > > > + /* Register both successful and failed faults in PGFAULT counters= . */ > > > + count_vm_event(PGFAULT); > > > + count_memcg_event_mm(mm, PGFAULT); > > > > Is there reason on why vm events accountings need to be explicitly > > different from perf events right below on handling ERROR? > > I think so. ERROR is quite different from RETRY. If we are, for > example, handling a SIGSEGV (perhaps a GC language?) that should be > accounted. If we can't handle a page fault right now, and need to > retry within the kernel, that should not be accounted. IIUC, the question was about the differences in vm vs perf accounting for errors, not the difference between ERROR and RETRY cases. Matthew, are you answering the right question or did I misunderstand your answer? >