Received: by 2002:a05:7412:3784:b0:e2:908c:2ebd with SMTP id jk4csp211422rdb; Sat, 30 Sep 2023 01:10:27 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHbtOuJebT1HqUzcsZIAbrda2d8PT8JYbQHWCCmpjLLVOUdFC5GpRLuUwbiXapgYu+kv5TZ X-Received: by 2002:a17:902:efc4:b0:1c3:2fc8:1305 with SMTP id ja4-20020a170902efc400b001c32fc81305mr5214398plb.47.1696061427401; Sat, 30 Sep 2023 01:10:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696061427; cv=none; d=google.com; s=arc-20160816; b=X0WHWtbRABaWFV9ugojurFGKH9GI6ZIfNY141NVqwCMMf66HiIvduyKXcPESHS7K7l VYLS0qD2vqsOGM7QqrQj+Vnl2cLNrp7RY0Ha+t55HTPvY5CF5dBtt0oLTDJ6ijJWXrkS gleCCwS/g6BVNsWeKXqxsZKMgjPRF6kepfbD8qWFZrGtsghHbbuq/GiJC/bnb+LwaBvG zueN2L2HuFzjsRK2WUrPZQKsUKG1FNIRbcYMkg8Jf3sWx2FRRUCnp9X0LUgwigR37/YM s5TMn9MwXZXq4roks7LkTmjqpGxCo28iChJDk2sNgLhb8Ftr2GptWzRShYPubG7mMZ0/ CmOg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=68RQMIL3JGNleZxOiCoTPvaR9s9H/zQLkKem3fLlu88=; fh=CZufC9EXGze3q+Z8hE+KZ9exJcJTUgC6bvswtuWo2G4=; b=pzGBDYeAgqpPnEh4pSEgiMboWG2fKOwf4iy/YplEs28/OAJjlfE16qpQ0BH5If2aZZ bVeeor1iAw3hDwuoEK0oVgr0Ip6wAL0IKW8Ykp+9yCm8GXhdYnsix5id2r/KcqtEA4Em 7rZmZkIAfctn1HpoNwlLpnPge+ruWeZUjgaCQwWt6OAh7YITeMbfRQcHVxxQI3zTWV+O qtkpc6J+7HshCFcw+1wx05A5Ezhzk9Xv7IPMDeKGus9ijJ8r++gABo4UOF0bD1iYmh71 MMg0rPsnUdOWBeAltiraopYA0Nns58Dh3AWS7HqBVpm8rnipi2IO06duzBar8zRZFeNE 6/Og== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cmpxchg-org.20230601.gappssmtp.com header.s=20230601 header.b=L023O7TP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=cmpxchg.org Return-Path: Received: from pete.vger.email (pete.vger.email. [2620:137:e000::3:6]) by mx.google.com with ESMTPS id j4-20020a170902da8400b001c5de4a5b4esi9452480plx.597.2023.09.30.01.10.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 30 Sep 2023 01:10:27 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) client-ip=2620:137:e000::3:6; Authentication-Results: mx.google.com; dkim=pass header.i=@cmpxchg-org.20230601.gappssmtp.com header.s=20230601 header.b=L023O7TP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=cmpxchg.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id 4F72481C3655; Fri, 29 Sep 2023 10:42:45 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233233AbjI2Rm0 (ORCPT + 99 others); Fri, 29 Sep 2023 13:42:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49828 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232954AbjI2RmZ (ORCPT ); Fri, 29 Sep 2023 13:42:25 -0400 Received: from mail-ot1-x32f.google.com (mail-ot1-x32f.google.com [IPv6:2607:f8b0:4864:20::32f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EE5B51AE for ; Fri, 29 Sep 2023 10:42:22 -0700 (PDT) Received: by mail-ot1-x32f.google.com with SMTP id 46e09a7af769-6c4a25f6390so7952527a34.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=vger.kernel.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=L023O7TPbKyGZH7XkKEr0b6TA1gyPuqsGVHgy2y56RmAXGWTmJ6flfTK/vR9SwIR3U maU3h4aby7r/wXqXrApkgAJo2tb/OkLCEz7Tg3v4nrSGw00AgLD0jMqT3u9IPY/+PYfp MOXCqYIM7rzKVoYT5PWdEl9FnPRj/FLfYcgHOCtbh6hyWzD0fGrBCTDhtCRJRsdS4wD3 ogKhzPRIvXfVSI6ejPtACbPRIwuk9RrsEqh4bUS45OmRC5AttG27kR57BxaN9G3VLKmd nIjh1ywEXoDZeTTH9vKhX81ZPboaKtqpYJJrKFjwkSNeeo9pkM7XKdUHYBV4yx0G/m27 0P6A== 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=YIL3oB+uZaP1PfiODVpcKiaoF0MrMulq/TGWh3RKKcHDlgdrKyWs9VCmitdFPi/+do TjmAy40k/79KD+6/Vh4kruUaNg1wMrL+2d1lRfzj+LbUFpXp5G2gknnygMbjcaH/nHrg aI2KRM7G4zLWHFrsFzSIm71piWv3oN531orXJxYLaHEo4k8L8qDW9qR9aKDUOjSFh+F1 mp8VhHW0nSHvhWFAIPTwil+TMQFRNymeX4K+MTMaO4A4lnH8uBx5QdI8anQqLWkx4eqA TSz/6Fql0dPLQUD/EQYZHfQy+g6I4/r6ggD2D9ZmqWJTCTuQQ3o0B4bZzc1ea5VqDJAt Y/8w== X-Gm-Message-State: AOJu0YzU3g2yrtVSVhqGyvHHX9nelC6m1qBBQ58fPElZMpshgVC3BRDm 7OB84giAu5jddsi2SMwouLKy0Q== 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-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (pete.vger.email [0.0.0.0]); Fri, 29 Sep 2023 10:42:45 -0700 (PDT) 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.