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 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 16494C77B75 for ; Tue, 18 Apr 2023 14:54:17 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 37AA66B0071; Tue, 18 Apr 2023 10:54:17 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 32A6B6B0072; Tue, 18 Apr 2023 10:54:17 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1F2228E0001; Tue, 18 Apr 2023 10:54:17 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 0FE916B0071 for ; Tue, 18 Apr 2023 10:54:17 -0400 (EDT) Received: from smtpin24.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 9A748C0324 for ; Tue, 18 Apr 2023 14:54:16 +0000 (UTC) X-FDA: 80694807312.24.934D6FF Received: from mail-yb1-f176.google.com (mail-yb1-f176.google.com [209.85.219.176]) by imf21.hostedemail.com (Postfix) with ESMTP id CBAE41C0020 for ; Tue, 18 Apr 2023 14:54:13 +0000 (UTC) Authentication-Results: imf21.hostedemail.com; dkim=pass header.d=google.com header.s=20221208 header.b=V6daXsKy; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf21.hostedemail.com: domain of surenb@google.com designates 209.85.219.176 as permitted sender) smtp.mailfrom=surenb@google.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1681829653; h=from:from:sender: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:dkim-signature; bh=EfhwMvTdF+nxW4QIbzDKMW7E7O/7EuCgSfJoT4ktJKk=; b=gucsg8e4F1Bs6CNBwgpchyWExEuKFSCv8aunEp1ul58G1uomR0bG5xzXntQ6o17SqgGVEF 8LrlOlJVJfHVzCvmfBo1+C9C8m5qrsxXvmpLn0sGGbgTSKsH7p02ZEultG8HxCygcvH+uw TbAmdlvzBosVzU6/rq0VJ3Rl+aJcFeI= ARC-Authentication-Results: i=1; imf21.hostedemail.com; dkim=pass header.d=google.com header.s=20221208 header.b=V6daXsKy; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf21.hostedemail.com: domain of surenb@google.com designates 209.85.219.176 as permitted sender) smtp.mailfrom=surenb@google.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1681829653; a=rsa-sha256; cv=none; b=lNqiHJw5kzHfzfMnQdPH2UE7F+0LSKrcOwxAgLtji4k3K8q97I54/aEgPHV5Jmx5Eo6dQ+ 1RxgGKfneuDfF+nKn+vsy1oVWjd39JgEZ9CdJe6x5Uw2CMMgBu0m8owGQTjLUa0JgeE35J fOtFYhRM449Vt+3MC+7NIx2Xmq34DTM= Received: by mail-yb1-f176.google.com with SMTP id j15so8302786ybl.10 for ; Tue, 18 Apr 2023 07:54:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1681829653; x=1684421653; 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=EfhwMvTdF+nxW4QIbzDKMW7E7O/7EuCgSfJoT4ktJKk=; b=V6daXsKy1PWZRcniSnjOMJGA+yng2Oy491YMI3OFPQGoQBhf81M+e6ihsqqDWd1xxv l3PU44fgRj6U8tOVtSQ8riMlwu1AHyEI3QvtZOiDSRERUbIJZgBuPobs5NqywDwEeTk7 8O1x9yAlV0Ng3D7bY0KuYrTW7faDUJAOGBpJpsvsXl580kGvh7aH7dTZ3iVpswpSfrlJ A3E/u4sSyT6IAdHEsP7Y07TgbPMz2CAzZ0PQiDYF0CTY1JqVU5FvlGlE6TSmcP+eg3vD /VcOle5QjG2sGkhO274MhCCDuxIqPA5R9u/iqZ29wfIrdGpce0AKdXoFQ6EnWP7/4cLg AKKA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681829653; x=1684421653; 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=EfhwMvTdF+nxW4QIbzDKMW7E7O/7EuCgSfJoT4ktJKk=; b=VLFNYb0GEXzxnR9S0WVllxgkqk78l4b3VMHznddaASFSy6T91/4SDSJE5+eO7rBK8a OrTgfS8Pgg26ldh+ieJhE798cTsd2Ib9B5YKa4+ymaQz7NtUhCx/1ttNMbvsZ635wQ7w q4dL56qDH3zsdVOQE7ink24Axx1G5oK6sLa8Sjtpub2uEROJBsymbK32oZyc7Ufwh46f eTj+lKxhPjchIWzkyBJQT/+n5DHzbRtUbM5VEvqt3pMedJgQfd8tunaGr/KnHM37vtJV HoVDcOTeiIQv6G6SYjpcKyFLWa36/Z+4yuN5wlX6J4EpuK3CsWo08a9CURs/FvPLhl7o G9rQ== X-Gm-Message-State: AAQBX9d3l6YGS8g8uVlT1lyLtbuujmAHD5litVqVRVMUzl+61g5cY7M9 KO4sTPhCDicJpCBdfXEoJVSglcn3ZOPmbSSIUFr9dQ== X-Google-Smtp-Source: AKy350ZgLB/WBc8GOyEDUDumrOQ+KvSYZQqa6oa0isslarGW+peOSaafPqoy5z25OTE2YBDofEZ/JnufNH0SWm/ucyE= X-Received: by 2002:a25:d2d2:0:b0:b95:518b:4921 with SMTP id j201-20020a25d2d2000000b00b95518b4921mr1400083ybg.12.1681829652615; Tue, 18 Apr 2023 07:54:12 -0700 (PDT) MIME-Version: 1.0 References: <20230415000818.1955007-1-surenb@google.com> In-Reply-To: From: Suren Baghdasaryan Date: Tue, 18 Apr 2023 07:54:01 -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-Rspamd-Queue-Id: CBAE41C0020 X-Rspamd-Server: rspam09 X-Rspam-User: X-Stat-Signature: ebkjy1wgo4qbcpkpehir6y4iyydt53sm X-HE-Tag: 1681829653-649460 X-HE-Meta: U2FsdGVkX1/Ryevy4g2T/NbVJXdCWviv7WmEu/ki//ahz6ZSo1+S5+6Gc6BpIKZKcUQltWNQoT9bZ3/Bbkck6enrjX1j7cl1rNMvYtT5gTc5VZ8b5wX2LqweM6HV5LU7R0W60T+kDDHRLbBVAaNtkFxVvxxOH7tuHbqUbojarlEo+WR6h/cwuDd4DuYbjCjMQC7a0ThZ4y/akuJ5ankv2OS6mEYoRuvcgkOmFNDPWOtcuH5Tx128rtqorly+BiTt5KENnl15ix3mPOyQnhEgbFLEhjFC3xl3FlVzYFE4MEInHpHtfcwTX1g3z9t5P/2peah8uhkGMVYuvp5NJFVljQrs4pTuIPTr7t42jgzy4t5Ddp5O1fbRnj15TAF5PJfrSvIZ/TlGYGGKcFemgBf1vOwr2+FhkG5LYfcPf4VckTXvlHy/jMxyXuOQ7PFO+VGnq1HLgiTX+VGw9UmtSlMVd0vPpWEmrpM0tCVEzSsVfp6F1Ef4f8AN+feMXjrz8cV30LAqI+tdvnpCuQosqoLnrwegYBNr6H686bCbsgfqI1VAa1TRywfdDa5b08BCgAPxr8smrrI5DHqFZ9LK6aRXYQFS/YJl0r8g7ms7Cn1fIFDOFsJxvO3eHGMF1pWyCf9N5Ie6sMmIhsf/UHsoBsrRr6O72x1fIt44wRPbzDr75RDjTKIqWifY0M4cThmPIe9ENeDlpV1t7N+S0HoIbfsVcbOsXoCfuEWR5Qdbo83biptbIhsO+CxO2xgmZg+t1tfWFHv2hlCLU+B0jNuMPEQ3bbkaiqYGXcBNup+h+QxVZsnVELLt1C+q0Yakv/+3ROE95FeTbF8FL0f1zM5kmwcQMX3VkVZWkpkAnfeCBJ1TMpeLlraim2OruPsQyE5iTqyeFCZZZKkcu7ZTNZtNy7uslPPxpLyhKczyUv0jp7PHjo8kpvwxwy2b+W4ePs0pCAFdY7xLKKQ0g4PZymDV3Ua 0A5pwW2O GlJA7XRKONrXasVc+AfbTZta9UXcGJgVqeXgQt44peikr8/CvvIAD59CwW96fDbOmfd/7dPyEJsrXFpaGfC5J7mrQNXUus9Jof42Gs7AmHH3Sm1/lQ9Spvo0W8y+J7IkyCHEMbzX+evRHessGMyPk//iEYW6XGMt3WJfrfMHOgaqOEyKdOYpoEQz3PQ8q8QaXlrcEhb3vXVtU91aW18GvI2X1Sg== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000001, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Tue, Apr 18, 2023 at 7:25=E2=80=AFAM Matthew Wilcox wrote: > > On Mon, Apr 17, 2023 at 04:17:45PM -0700, Suren Baghdasaryan wrote: > > 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)= . That > > > > > - * includes arch_vma_access_permitted() failing before reac= hing here. > > > > > - * So this is not a "this many hardware page faults" counte= r. We > > > > > - * should use the hw profiling for that. > > > > > - * > > > > > - * - Incomplete faults (VM_FAULT_RETRY). They will only be c= ounted > > > > > - * once they're completed. > > > > > + * Do not account for incomplete faults (VM_FAULT_RETRY). The= y will 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 coun= ters. */ > > > > > + 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? > > Maybe I'm misunderstanding what you're proposing. I thought the > proposal was to make neither ERROR nor RETRY increment the counters, > but if the proposal is to make ERROR increment the perf counters > instead, then that's cool with me. Oh, I think now I understand your answer. You were not highlighting the difference between the who but objecting to the proposal of not counting both ERROR and RETRY. Am I on the same page now?