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 6A8E0E728CE for ; Fri, 29 Sep 2023 17:42:26 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E0DD58D00E3; Fri, 29 Sep 2023 13:42:25 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id DBE3C8D002B; Fri, 29 Sep 2023 13:42:25 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C5E8B8D00E3; Fri, 29 Sep 2023 13:42:25 -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 B69E68D002B for ; Fri, 29 Sep 2023 13:42:25 -0400 (EDT) Received: from smtpin28.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 82F94C0444 for ; Fri, 29 Sep 2023 17:42:25 +0000 (UTC) X-FDA: 81290354250.28.1FBB948 Received: from mail-ot1-f48.google.com (mail-ot1-f48.google.com [209.85.210.48]) by imf14.hostedemail.com (Postfix) with ESMTP id 40E7B10001B for ; Fri, 29 Sep 2023 17:42:23 +0000 (UTC) Authentication-Results: imf14.hostedemail.com; dkim=pass header.d=cmpxchg-org.20230601.gappssmtp.com header.s=20230601 header.b=Z9mZ4z6S; dmarc=pass (policy=none) header.from=cmpxchg.org; spf=pass (imf14.hostedemail.com: domain of hannes@cmpxchg.org designates 209.85.210.48 as permitted sender) smtp.mailfrom=hannes@cmpxchg.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1696009343; 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=68RQMIL3JGNleZxOiCoTPvaR9s9H/zQLkKem3fLlu88=; b=1A5LA/JFBzuW95/Bp8WIJEKq6NUmpuGJkPPcJh396jvv9VUc+bS+Lkf6SeTCy5QPBNkR8i cuYXxs2DaLDG2WCKimVDKlhtznSoLcOJuBZHPIAN/CH6Vz/XK8i9D+8yoS3puMzhL4F5Vs gHVAsdDto45vko5sLrmQUqjTIZAS37M= ARC-Authentication-Results: i=1; imf14.hostedemail.com; dkim=pass header.d=cmpxchg-org.20230601.gappssmtp.com header.s=20230601 header.b=Z9mZ4z6S; dmarc=pass (policy=none) header.from=cmpxchg.org; spf=pass (imf14.hostedemail.com: domain of hannes@cmpxchg.org designates 209.85.210.48 as permitted sender) smtp.mailfrom=hannes@cmpxchg.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1696009343; a=rsa-sha256; cv=none; b=lb7LXx1fxllPvh19ybGWodzLT8IE3u6a4rUQnF13KKxL5knM24fIjqZYQg5ek9NbuEXO0t TuuCxGVcmqELQfeUbCVO5Mja5Q8QYdCfsrHwnjz0+UOwTIfpiFyYW3BH/MmVGCUjGvNVba sMhStrla73QKzYM3Y+IVDrkCWWiNu5c= Received: by mail-ot1-f48.google.com with SMTP id 46e09a7af769-6c4a25f6390so7952528a34.2 for ; Fri, 29 Sep 2023 10:42:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cmpxchg-org.20230601.gappssmtp.com; s=20230601; t=1696009342; x=1696614142; darn=kvack.org; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:from:to :cc:subject:date:message-id:reply-to; bh=68RQMIL3JGNleZxOiCoTPvaR9s9H/zQLkKem3fLlu88=; b=Z9mZ4z6Sn3N7uwoVWRcX7W/6WYas+4w7d3tBVCW+GBWdqLTfQyWYpUr5AfX60w6AHE iuwBVMWzLzKRoehZWOpBPtUeA6tc2N92iviAyAjnvnnK5SMQ6BK8xKb7Kv4B0ogJ2YkZ bg4Bl28e/Crq/K2yGbQfQCd7ycLuLZAY+R+k8jUmUYSXgpKH+9GvqioZh/hWE9ItGHAv XRS+AcAB7+956i4ix6cjjBxLecEi3F1crC3QbAcXX0rrQLzMIyYnTytyaFrYt11ARVuk 2LJMn/1Ntx6f5cjlThW7iO6DmUren26g1ROKvT8f0t2oakl2Y7eT+4krzIIb+9J5wigj uS4w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696009342; x=1696614142; h=in-reply-to:content-transfer-encoding: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=68RQMIL3JGNleZxOiCoTPvaR9s9H/zQLkKem3fLlu88=; b=AlLlQNF2o1oTRGoebf/PN71l6Dn0jc4iDs4Ktg8IVk7KcH3I4mS0Zjzfy+V7DJI6EE KcurL3C/nJLW2YCat9wsjx8XEeQttGCMts37dvL6odgk3AErSw4UuIb5Fz/EEFFIWBGv QLUHxo1CWOvLuOBs2O62mWQRRfF88TiE5+37SPjIYsi567XygpOlmDVunrKxHyQ4B8q4 4+un/CbSqN6OPSM1vS9E9k6KIChtABuqcb6m+ZcvdMtXtZcoCvrsuMGyBXGPyeHxnK9D Pm6R8EQyZV1gOcLzSNf+/EdffXSIcKbocAQRYYqh78tphi7tJZZW4DlwaEAbJXK+SgGz 2LiQ== X-Gm-Message-State: AOJu0Yz179srwiURl29DBqQQPW4XO08k4m6SP1IEGAyxVVZFZjFaLlKa B2t415Ud7JuRwcEvl6OTK/VI+g== X-Google-Smtp-Source: AGHT+IGyNmo17+iWn2ufBJg0OO9ZbA7uNNp+MMG6j43QotDJLGPGN7FO5yVqQx6ARbvw+dVe+LWDYw== X-Received: by 2002:a05:6830:22d4:b0:6bd:603:797f with SMTP id q20-20020a05683022d400b006bd0603797fmr5130719otc.37.1696009342226; Fri, 29 Sep 2023 10:42:22 -0700 (PDT) Received: from localhost ([2620:10d:c091:400::5:a683]) by smtp.gmail.com with ESMTPSA id oj2-20020a056214440200b0065af4977ea3sm5680149qvb.24.2023.09.29.10.42.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Sep 2023 10:42:21 -0700 (PDT) Date: Fri, 29 Sep 2023 13:42:21 -0400 From: Johannes Weiner To: Yosry Ahmed Cc: Nhat Pham , akpm@linux-foundation.org, riel@surriel.com, mhocko@kernel.org, roman.gushchin@linux.dev, shakeelb@google.com, muchun.song@linux.dev, tj@kernel.org, lizefan.x@bytedance.com, shuah@kernel.org, mike.kravetz@oracle.com, linux-mm@kvack.org, kernel-team@meta.com, linux-kernel@vger.kernel.org, cgroups@vger.kernel.org Subject: Re: [PATCH v2 1/2] hugetlb: memcg: account hugetlb-backed memory in memory controller Message-ID: <20230929174221.GA19137@cmpxchg.org> References: <20230928005723.1709119-1-nphamcs@gmail.com> <20230928005723.1709119-2-nphamcs@gmail.com> <20230929150829.GA16353@cmpxchg.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Rspam-User: X-Stat-Signature: capezhd3xod9t14895nhzyhyntus84xw X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 40E7B10001B X-HE-Tag: 1696009343-862428 X-HE-Meta: U2FsdGVkX1+0VQufOe0BagUFcBURs2BpQp4FXKZR+YXuR25No2PB5zTZ9PM1mPm4QvxUj/lBoGJbMhwsr8LqsRLi2CWJt0vaKlxLPZoZWNDAVoZk1IgWGnJg/vg4UiXJs0+oJzxWjFMr2s+UipajBeMmaqzGmADh0vxmUA09LQqloAjvYDlYoqYKGvTTrtk6+MBRwNUf/DAH+lsJSLx8yT0tcK8orJ3MRMzV6DP8lMgB3kFhWpG65KE1qjwgUg1KQVqS/sA2XwCfO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bF+EBx9xwOZsSZmF0E9xazEuHBtvDM8y/1LnPK4CACgXMVXqbPggvmnrdBcXGP6F2Lxh1KA1SGpWNOLrc7CTnYUgYAoK/S+3eyt7/fganZcIotZpaRPHgZy983sg/DVVgHD57ZmUWd6bm6a4 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: On Fri, Sep 29, 2023 at 08:11:54AM -0700, Yosry Ahmed wrote: > On Fri, Sep 29, 2023 at 8:08 AM Johannes Weiner wrote: > > > > On Thu, Sep 28, 2023 at 06:18:19PM -0700, Yosry Ahmed wrote: > > > My concern is the scenario where the memory controller is mounted in > > > cgroup v1, and cgroup v2 is mounted with memory_hugetlb_accounting. > > > > > > In this case it seems like the current code will only check whether > > > memory_hugetlb_accounting was set on cgroup v2 or not, disregarding > > > the fact that cgroup v1 did not enable hugetlb accounting. > > > > > > I obviously prefer that any features are also added to cgroup v1, > > > because we still didn't make it to cgroup v2, especially when the > > > infrastructure is shared. On the other hand, I am pretty sure the > > > maintainers will not like what I am saying :) > > > > I have a weak preference. > > > > It's definitely a little weird that the v1 controller's behavior > > changes based on the v2 mount flag. And that if you want it as an > > otherwise exclusive v1 user, you'd have to mount a dummy v2. > > > > But I also don't see a scenario where it would hurt, or where there > > would be an unresolvable conflict between v1 and v2 in expressing > > desired behavior, since the memory controller is exclusive to one. > > > > While we could eliminate this quirk with a simple > > !cgroup_subsys_on_dfl(memory_cgrp_subsys) inside the charge function, > > it would seem almost punitive to add extra code just to take something > > away that isn't really a problem and could be useful to some people. > > > > If Tejun doesn't object, I'd say let's just keep implied v1 behavior. > > I agree that adding extra code to take a feature away from v1 is > probably too much, but I also think relying on a v2 mount option is > weird. Would it be too much to just have a v1-specific flag as well > and use cgroup_subsys_on_dfl(memory_cgrp_subsys) to decide which flag > to read? Yeah, let's not preemptively add explicit new features to cgroup1. Since we agree the incidental support is weird, let's filter hugetlb charging on cgroup_subsys_on_dfl(memory_cgrp_subsys) after all. If somebody wants this for v1 - and it doesn't sound like Google is even in that category according to Frank - they should send a separate patch and we can go through all the reasons why switching to v2 is not an option for them.