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 51766C64EC4 for ; Wed, 8 Mar 2023 16:01:17 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id DBD3F6B0072; Wed, 8 Mar 2023 11:01:16 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id D434E6B0074; Wed, 8 Mar 2023 11:01:16 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id BBBFD6B0075; Wed, 8 Mar 2023 11:01:16 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id A4E166B0072 for ; Wed, 8 Mar 2023 11:01:16 -0500 (EST) Received: from smtpin15.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 9B1441603EB for ; Wed, 8 Mar 2023 16:01:15 +0000 (UTC) X-FDA: 80546195310.15.CD9C1DD Received: from mail-qt1-f175.google.com (mail-qt1-f175.google.com [209.85.160.175]) by imf07.hostedemail.com (Postfix) with ESMTP id 9A51E400C3 for ; Wed, 8 Mar 2023 16:00:58 +0000 (UTC) Authentication-Results: imf07.hostedemail.com; dkim=pass header.d=cmpxchg-org.20210112.gappssmtp.com header.s=20210112 header.b=VKR9kxxO; spf=pass (imf07.hostedemail.com: domain of hannes@cmpxchg.org designates 209.85.160.175 as permitted sender) smtp.mailfrom=hannes@cmpxchg.org; dmarc=pass (policy=none) header.from=cmpxchg.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1678291259; 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: in-reply-to:in-reply-to:references:references:dkim-signature; bh=h3hZwpKMg+vlHtotr98nmh9kQ0sI9K4sYDzfoR8/Nkw=; b=oQfCjTVuYUtEsP41lTzMQ1qnzs4UTwtc1qSAIKe7z7C3JMyJoWHxJXp3Jh1OWas7SR4NAm 8p0JzR5A6RlndNjoeOxUWfL2+b4s0w8vLo8YrTfhIA5/gntV9NoHVs2LOGmuHytm1HksbT aSYethra1M5JPyz/l+zYxsVuKBa6JUM= ARC-Authentication-Results: i=1; imf07.hostedemail.com; dkim=pass header.d=cmpxchg-org.20210112.gappssmtp.com header.s=20210112 header.b=VKR9kxxO; spf=pass (imf07.hostedemail.com: domain of hannes@cmpxchg.org designates 209.85.160.175 as permitted sender) smtp.mailfrom=hannes@cmpxchg.org; dmarc=pass (policy=none) header.from=cmpxchg.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1678291259; a=rsa-sha256; cv=none; b=bWs1rWoynzcyPKuqw3wlxkfg/Blzv0Yq/fb3vPZgUjg8hsjz7SHg9+Bo7jBCb6v4ygzuIG W5tangDBLxNHQQhbGaQH+Ge21hIrCiUlYSHS2V34CfKwGO6bhR7XcAsar9q3jM1ihfmpZi l8lFOmHxVQWfIDm6neS7uxH3vVo9d+Y= Received: by mail-qt1-f175.google.com with SMTP id s12so18501223qtq.11 for ; Wed, 08 Mar 2023 08:00:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cmpxchg-org.20210112.gappssmtp.com; s=20210112; t=1678291257; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=h3hZwpKMg+vlHtotr98nmh9kQ0sI9K4sYDzfoR8/Nkw=; b=VKR9kxxOdfwLKRX+OUxi0CqO3qdzQviWy2G5KfY1OlbX5P2Zjs7o+pnTrBmcgdPn/3 3mcJ510vjumwGzDhiWCOfmNnwbgE1xGHD/3UPa5tx6sWp0j1xRGvNagDAeIJvEyJqMmY E2nu6YPt8YzGd84SVtsL7clnfqTYJf9TROwXIfd1yPVrGs7P4BS3ZZRyCNAU28hjP7I0 iglsK76350p0U/4VE1Mvd237L0HvzuoKM+uyEaqw58KBNXFQ+xVXxJHJV4vSiuA0zCYF ooBfwRMknXntUcS7NSqpef0p62PactO8oozTc50D7gqWgBk6/NceCWvU3Q7eLccrbNBa VWuw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678291257; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=h3hZwpKMg+vlHtotr98nmh9kQ0sI9K4sYDzfoR8/Nkw=; b=KNrsMl9kym18ger0euz3i4OFKZ4yUqdlEDoSlW8y+610SwdyaG0K/4lx7Hx29BLYV9 w9ipYs1smOvV5YkDEbPH6uR7DxcVlu4TMMgyYlHWnMJI4nowacrtp/OuZhufZBGYfHqq fBUNXwUB7Z/MRmr3qsQ8fWgiR6J8z8X+I1scWd1m9lQAV1ZrPyBkRm2tpYV+fFliBrue JwfCU6HVPImMhDUvkn50ouwvZymwgw9oiotET/lsB3mW4evKBMeNTTs86z/d8ZmBeBpq FMPKwSztw572cEz+SdUZJ6ciggy1EN+nAMRp9t6bWeo3ik5uKnocs+g/kqjZ1eYkpsVV giCQ== X-Gm-Message-State: AO0yUKWotitWHHHOuqUHnZtrdg7P7xWke3mwYnvjOJM4RG47thWicPC+ oZaoJLu7gMeynBlNcxeO7vbSAA== X-Google-Smtp-Source: AK7set8VHTOzJ1mGxBCJIKeE5Y/M6Q5A34bQK9WHzEHfDvqAd4z/Xd8BRHp+AwjZqV34Y2Q19xl+tQ== X-Received: by 2002:a05:622a:303:b0:3bf:a08d:b265 with SMTP id q3-20020a05622a030300b003bfa08db265mr37829235qtw.24.1678291257174; Wed, 08 Mar 2023 08:00:57 -0800 (PST) Received: from localhost (2603-7000-0c01-2716-8f57-5681-ccd3-4a2e.res6.spectrum.com. [2603:7000:c01:2716:8f57:5681:ccd3:4a2e]) by smtp.gmail.com with ESMTPSA id a191-20020ae9e8c8000000b00742743dba2asm11578051qkg.39.2023.03.08.08.00.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Mar 2023 08:00:56 -0800 (PST) Date: Wed, 8 Mar 2023 11:00:56 -0500 From: Johannes Weiner To: Yosry Ahmed Cc: Alexander Viro , "Darrick J. Wong" , Christoph Lameter , David Rientjes , Joonsoo Kim , Vlastimil Babka , Roman Gushchin , Hyeonggon Yoo <42.hyeyoo@gmail.com>, "Matthew Wilcox (Oracle)" , Miaohe Lin , David Hildenbrand , Peter Xu , NeilBrown , Shakeel Butt , Michal Hocko , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-xfs@vger.kernel.org, linux-mm@kvack.org Subject: Re: [PATCH v1 0/2] Ignore non-LRU-based reclaim in memcg reclaim Message-ID: <20230308160056.GA414058@cmpxchg.org> References: <20230228085002.2592473-1-yosryahmed@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230228085002.2592473-1-yosryahmed@google.com> X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: 9A51E400C3 X-Stat-Signature: g4uuo3xjfht98q439bi3zeg8naj75gy9 X-Rspam-User: X-HE-Tag: 1678291258-457048 X-HE-Meta: U2FsdGVkX1/4vDXXQGEZcghcl6U0ObCIZR4o27s10b00giTRFGG21wrUqBaxNr0O65BL9Fd7Mso3aZWpzWZ3TnHJlAnB3xs4HbO0HdQWE8cmfmgWarOiHIoQAslS5Nqey+fRtGJrEGHkn8JvuHE6t37TLhPnTm9xOb/jFRRYQbbP3e+1Ayv0zNb93AjJU+STsr/u5ogoSLPr5KFX/f+hu0Vuda2uhYId6CSXOpYem5VpF9Fqoa7ThZUgYmAxcBTt157Yj1Qaerwe82Mg4O9J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UYGNil00VIP/umqTC140CrfjfZmT2ICSplICR7ywPI3xQRiSOB+0/CfMxIVUvkWB4o7fLBHYF2dww+pytM9rkvILmik87nrNDNJi8od1RKwwbfyJgKQmyC2xB60ok3FkKfZsBxLiGBZi8= 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: Hello Yosry, On Tue, Feb 28, 2023 at 08:50:00AM +0000, Yosry Ahmed wrote: > Reclaimed pages through other means than LRU-based reclaim are tracked > through reclaim_state in struct scan_control, which is stashed in > current task_struct. These pages are added to the number of reclaimed > pages through LRUs. For memcg reclaim, these pages generally cannot be > linked to the memcg under reclaim and can cause an overestimated count > of reclaimed pages. This short series tries to address that. Could you please add more details on how this manifests as a problem with real workloads? > Patch 1 is just refactoring updating reclaim_state into a helper > function, and renames reclaimed_slab to just reclaimed, with a comment > describing its true purpose. Looking through the code again, I don't think these helpers add value. report_freed_pages() is fairly vague. Report to who? It abstracts only two lines of code, and those two lines are more descriptive of what's happening than the helper is. Just leave them open-coded. add_non_vmanscan_reclaimed() may or may not add anything. But let's take a step back. It only has two callsites because lrugen duplicates the entire reclaim implementation, including the call to shrink_slab() and the transfer of reclaim_state to sc->nr_reclaimed. IMO the resulting code would overall be simpler, less duplicative and easier to follow if you added a common shrink_slab_reclaim() that takes sc, handles the transfer, and documents the memcg exception.