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 94208E6F07D for ; Fri, 1 Nov 2024 18:33:52 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 259426B0082; Fri, 1 Nov 2024 14:33:52 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 209BE6B0083; Fri, 1 Nov 2024 14:33:52 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0D17C6B0093; Fri, 1 Nov 2024 14:33:52 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id E356A6B0082 for ; Fri, 1 Nov 2024 14:33:51 -0400 (EDT) Received: from smtpin17.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 99123C0D8B for ; Fri, 1 Nov 2024 18:33:51 +0000 (UTC) X-FDA: 82738373088.17.5CB543F Received: from mail-ed1-f44.google.com (mail-ed1-f44.google.com [209.85.208.44]) by imf19.hostedemail.com (Postfix) with ESMTP id EC2B11A0028 for ; Fri, 1 Nov 2024 18:33:13 +0000 (UTC) Authentication-Results: imf19.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=RQd8tD+R; spf=pass (imf19.hostedemail.com: domain of joshua.hahnjy@gmail.com designates 209.85.208.44 as permitted sender) smtp.mailfrom=joshua.hahnjy@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1730485984; 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=+aKXYmYjBAuMzUUIrdg8wG61gEq+XCTqxoCb6g2OWXI=; b=0rdMne4noXHbR1CCgi1k10GZCdX3FbHvYgJXxNad1tqvvpFq2yeDx4fb+kzFdDNRAQaaHc VAdwJJsT57KO3F2T3WEOmbMF9Yxji02UTqywLu+z2RXs48TFphk5owgJMRysr5OjIxHjqD DPABaAVqoGLz5DlAWfEtvmL09nLY3AQ= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1730485984; a=rsa-sha256; cv=none; b=VwyzIu9nE/nqUYi1VJvK8EFcF0qxHctu6iOPIre5A6F6QuAsTyZgSvycppd0VN3ufIfNrB psNGMamFpkVEmWmYqN/if0nkNPNYceDzTS34Yf7/dR3rXakBoiFItNsJ3b03xyTCbxRCno xCvuMguooruAkTqHUbFQkr4eU3TPihk= ARC-Authentication-Results: i=1; imf19.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=RQd8tD+R; spf=pass (imf19.hostedemail.com: domain of joshua.hahnjy@gmail.com designates 209.85.208.44 as permitted sender) smtp.mailfrom=joshua.hahnjy@gmail.com; dmarc=pass (policy=none) header.from=gmail.com Received: by mail-ed1-f44.google.com with SMTP id 4fb4d7f45d1cf-5cb15b84544so2660011a12.2 for ; Fri, 01 Nov 2024 11:33:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1730486028; x=1731090828; darn=kvack.org; 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=+aKXYmYjBAuMzUUIrdg8wG61gEq+XCTqxoCb6g2OWXI=; b=RQd8tD+Rc6bIeXZerRjW4Cz/U7336tD7+KFtsfivztVUsc61/TpqjN8GCxfhOSt4SB vNo3sPcMlXOFDjjXx10EKYn4ALG7ZTruHp2yh8+jXzmp04+rDBdC9hsmsS/cdKmDBdiI 6vcBhc7BvApzSPwOgyIUae22xDwr/pMmyXvRnkbZQK1zMsrb30Pvx5oyBanQ8cj/f3yZ cY+ekWRU+H0fPka9oTVto6dYsTXy4ZV2gEzyycQUA//AhBIA21/cmvRANI8j8AJZFn0+ SRAe/nDooA/ScEA2BZ05AO8DpLGh68u3pGt+xnBfyMMYdhBF9/puv8MLiekzqW+nx1az ynLA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730486028; x=1731090828; 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=+aKXYmYjBAuMzUUIrdg8wG61gEq+XCTqxoCb6g2OWXI=; b=Zya6PkNUxLk+I2VXiFKU6xOvHOPvQPy1/6JvXL9KdfrxqX6KKnX/7Z+mgopGErhpVO NxxdYKbAaqdDYPtSGLG2g37RRpXfSJzYhuXoqWUbnGakEHm3EXPK6gfPUFOQ6SIoR/x9 2wPfJlnKVnZI1P36FpytLaEflzXY1Pwcoq4YY5nbGnkJLunt6/CzSvfF5SLUdh9ur8oF CU7AlKoxMP2pQXzwXHsdkU6w+ltGr0UuFeEsoCuuFdP433iL9N2TsaY2RybnVTBE2wRC g+sWf0xst3T1AXRCRbyYWjtvYpWoycpvH0m806rrQZ6VxltJACXNupX6kRtPcF9C9Ana fctg== X-Forwarded-Encrypted: i=1; AJvYcCVyrbEgAoqTRiWraqy1Hvyd/mcZfdbQswiS6/SaAZQI96v9IaH3Xe/q6gws2XAGGn1ZcEokYLkHcA==@kvack.org X-Gm-Message-State: AOJu0YxtNCy37T3TrvI8yjjvlL5Ptz2UrwMIfzqRtpjrMw/vdPoAO4K5 absqCxYSVLGOvDipcwaeiq3k2CVVnfwfJsvaSOuTAKxIcQESdQaw4YwMnU+pbZ9oUdq4dzx3w7Z sb+Pdo8lCxt30TVQZk68CSli3ciQ= X-Google-Smtp-Source: AGHT+IGir20gPToL50TgOpG3orUvf19xkLLVjvjLOCoU66Vkq4D32IzyCycWQAYpcoMknZ+dUtfXBJc4Jegp+l+59nA= X-Received: by 2002:a05:6402:2808:b0:5cb:739d:5416 with SMTP id 4fb4d7f45d1cf-5ceb936b3d3mr3274777a12.31.1730486027898; Fri, 01 Nov 2024 11:33:47 -0700 (PDT) MIME-Version: 1.0 References: <20241028210505.1950884-1-joshua.hahnjy@gmail.com> <20241030150102.GA706616@cmpxchg.org> <20241030183044.GA706387@cmpxchg.org> <20241031183413.bb0bc34e8354cc14cdfc3c29@linux-foundation.org> In-Reply-To: <20241031183413.bb0bc34e8354cc14cdfc3c29@linux-foundation.org> From: Joshua Hahn Date: Fri, 1 Nov 2024 14:33:36 -0400 Message-ID: Subject: Re: [PATCH v3 1/1] memcg/hugetlb: Adding hugeTLB counters to memcg To: Andrew Morton Cc: Michal Hocko , Johannes Weiner , nphamcs@gmail.com, shakeel.butt@linux.dev, roman.gushchin@linux.dev, muchun.song@linux.dev, tj@kernel.org, lizefan.x@bytedance.com, mkoutny@suse.com, corbet@lwn.net, lnyng@meta.com, cgroups@vger.kernel.org, linux-mm@kvack.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-team@meta.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Stat-Signature: kip7tyg6s3fitkaetfjg1xzk68g633ky X-Rspam-User: X-Rspamd-Queue-Id: EC2B11A0028 X-Rspamd-Server: rspam02 X-HE-Tag: 1730485993-164772 X-HE-Meta: U2FsdGVkX1+cgjtBvRRkEB9d3ze0kqhCu984zf7bg51CuAop/fmmRNmJZWhd6QJTbhGEP5yqw4KJ0Zd1EErV/cxihe2M93yzStldpKRWtiuxX6Ha09B/YRFptt/LjnF95CuWzy0SZOAXFpguS2qnXRbAp6YcHOdv9k8Bju2hwmbOqnCl75tHotnxuRcvywZGtk5Tb8AKgCE2FVAofrePocZwIVJXlBtA2sgH9YYDyqVuptyn40J216SsO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ULbusHJVwVppsNJ6cu6HKGb650fYyKawss5kmgwVX2mxm7QwHrwg9jVAHK/nQ5vu2A3qM= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000051, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: On Thu, Oct 31, 2024 at 9:34=E2=80=AFPM Andrew Morton wrote: > > On Thu, 31 Oct 2024 15:03:34 -0400 Joshua Hahn = wrote: > > > Andrew -- I am sorry to ask again, but do you think you can replace > > the 3rd section in the patch (3. Implementation Details) with the > > following paragraphs? > > No problem. > : 3. Implementation Details: > : In the alloc / free hugetlb functions, we call lruvec_stat_mod_folio > : regardless of whether memcg accounts hugetlb. mem_cgroup_commit_charge > : which is called from alloc_hugetlb_folio will set memcg for the folio > : only if the CGRP_ROOT_MEMORY_HUGETLB_ACCOUNTING cgroup mount option is > : used, so lruvec_stat_mod_folio accounts per-memcg hugetlb counters only > : if the feature is enabled. Regardless of whether memcg accounts for > : hugetlb, the newly added global counter is updated and shown in > : /proc/vmstat. > : > : The global counter is added because vmstats is the preferred framework > : for cgroup stats. It makes stat items consistent between global and > : cgroups. It also provides a per-node breakdown, which is useful. > : Because it does not use cgroup-specific hooks, we also keep generic MM > : code separate from memcg code. > : > : With this said, there are 2 problems: > : (a) They are still not reported in memory.stat, which means the > : disparity between the memcg reports are still there. > : (b) We cannot reasonably expect users to enable the hugeTLB controller > : just for the sake of hugeTLB usage reporting, especially since > : they don't have any use for hugeTLB usage enforcing [2]. > : > : [1] https://lore.kernel.org/all/20231006184629.155543-1-nphamcs@gmail.c= om/ > : [2] Of course, we can't make a new patch for every feature that can be > : duplicated. However, since the existing solution of enabling the > : hugeTLB controller is an imperfect solution that still leaves a > : discrepancy between memory.stat and memory.curent, I think that it > : is reasonable to isolate the feature in this case. > Hello Andrew, Thank you for your help as always. I apologize for not being clear in my original request -- the "With this said, there are 2 problems:" paragraph i= s part of the 2nd section (2. We already have a hugeTLB controller...) So the outline will be: This patch introduces... 1. Why is this patch necessary?\n Currently, memcg hugeTLB accounting... Aside from the consistency between... 2. We already have a hugeTLB controller. Why not use that?\n It is true that hugeTLB tracks... With this said, there are 2 problems:\n (a) They are still not... (b) We cannot reasonably... 3. Implementation Details\n In the alloc / free hugetlb functions, ... The global counter is added because... [1] https://lore.kernel.org/ ... [2] Of course, we can't make a new patch... Thank you for your patience. I promise that this is the last change to the patch message, I apologize for the frequent requests for modifications. I hope you have a great day! Joshua