Received: by 2002:a05:7412:3784:b0:e2:908c:2ebd with SMTP id jk4csp54958rdb; Fri, 29 Sep 2023 16:33:48 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGi8GEOIyV87yma/J1nIr+4fHKs3LepxD9cRvJkFaKB7wRAU1pAAmD+HwtTo2E58TzUxEXj X-Received: by 2002:a05:6870:c106:b0:1dc:930c:6f11 with SMTP id f6-20020a056870c10600b001dc930c6f11mr5909200oad.33.1696030428473; Fri, 29 Sep 2023 16:33:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696030428; cv=none; d=google.com; s=arc-20160816; b=Gghm33ZnI6hhia4qow36lPl8a3cAIkExeaM/1YY/fIp6jNGI652eVwmp26Z1ojrb3Y xm91OEQ4ELNHl4UOnmAeiSZU12NEEChk31lMZcG/j9v/52BDVHqW9dmgJlmD11xN6HfA KltXVOoZSH017Ahh4FUHR809TOwY0cDtBtOr0uS81FmaldWgeqwa5HuBf9rcMFhuM1qf +6L4/PIp7Ck1B9NNnat33lQXbzgWJmTTArmdKOZmHKAG08Yul9Vxn2MQIflmhFL2HWuz Fj5Xz/XM6p2nG6Ad8U6nsitCZSTLxZXZqA1P6pcqO6Cf4zt65xJqXegyAuqWU4c6IT54 reYw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=+iwwlqvaBxCwMsikVRLEIWQ+fldLakckoypjf/711hA=; fh=EIF5xEjZMpxW5zDx1/RkiHIL8OkBEr3kkEpvzgKXR78=; b=lgXwbLayvCv8AU9tvuefkKkUl508VPslZTHZiZCWCoF/6Dmv1qGAjCMCbmulYtRpgB T+KvPgIP1OgReMkuSg7oJ8Ee1q6s65yvVPGEZRN7v/NA1yyPzNYokpqW6yDb35kxy9X9 oOGE2px+V8ZF3JlOxVO0BgkvVjRHeTIHNY6AihlHc0pMWkV41TtVAUmGvTMGsrJzR31D rxEBD5klGpBxZHeGPNKJu3gvb7ndg9hT2/hApxCgHZ1WMKTkZzognya0g4Ix7DA4ldIY JpWCp3EtREpoBOC1MZXChJeWltc/QZV0OTREYCXNJjsLwDHdUFK4uMR48K4H0oEQn369 1v8Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=WLn70OIk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id n7-20020a056a000d4700b0068c01fba745si20265305pfv.184.2023.09.29.16.33.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Sep 2023 16:33:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=WLn70OIk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id AA7D28024FF5; Fri, 29 Sep 2023 08:12:42 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233362AbjI2PMj (ORCPT + 99 others); Fri, 29 Sep 2023 11:12:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36092 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230104AbjI2PMh (ORCPT ); Fri, 29 Sep 2023 11:12:37 -0400 Received: from mail-ej1-x62d.google.com (mail-ej1-x62d.google.com [IPv6:2a00:1450:4864:20::62d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C9947D6 for ; Fri, 29 Sep 2023 08:12:35 -0700 (PDT) Received: by mail-ej1-x62d.google.com with SMTP id a640c23a62f3a-991c786369cso1827378866b.1 for ; Fri, 29 Sep 2023 08:12:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1696000354; x=1696605154; darn=vger.kernel.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=+iwwlqvaBxCwMsikVRLEIWQ+fldLakckoypjf/711hA=; b=WLn70OIkQJ4NzM2XZdkBYl2Dm5pzEEW0+f8l3kQAoTtGd8Dt17uSrgo+uGDEpAcdyZ B9hX0h1kdCG9eNCFLztk2dL1uJw+YdRik2l8AvFqcUnWJeaOPBZMG4/iCIphOxqVt92p l8uDDXt8pfafAkhms1ULQoI110LXaBSui0FubtpWrd1PAya5oW7dC0rNPFza+Txsii6l 4RlQ6xbghic9bBAw6grFGbVHzaYZ7MKzTpV3iTUqvHBy/JZk/x8I53zR9wD3r3Tp5Hx6 YEi27K5FDKheHnjGLlLoMPbp+lnDf/FLdMY15XOTWWsCvQpS9nLKHXeewxQ0IWW62FsD HoEg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696000354; x=1696605154; 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=+iwwlqvaBxCwMsikVRLEIWQ+fldLakckoypjf/711hA=; b=OyjngFNzN5TUFkbx+FB3NvX2dC0E1NR91FtD4hQjmlUxLlWMCWteXHmnoUDlQqT6CL vPeCQUGyaBQMd7ZXjCUJjX6ezjmnAFsEGHqY/ZwWwj2GHqhhw6JEYMC+9SXs6enmsZRq wdgoE9ssFY/cExmAPO7aowKmRrjZSNEuK3S9OX/w3ePh/ZgSBP96MyGZYXNlPuQWNabc M1B5fKV7aHv9BOnWbDiwCqOFNMmuEQ9spOCrMmgQSGdH2D66TWVsgjFylS3PYBA1jg4a /ZBN/ELKrmwHRqDbIFyRb+Dw9BPDNjzk4BTHsgJCTz5vhyhF3O+d7wBU93tCtogwA/mf 1HOA== X-Gm-Message-State: AOJu0YzRVh4SnHZtHYikBt8Iy3vo3BbSwiZBnU8zhpbwsmslmoKcXN0j nKkTdMgdPCC+y82U1htjm2VH/Z1XHsVXqgCufoTYzQ== X-Received: by 2002:a17:906:51db:b0:9b2:abda:2543 with SMTP id v27-20020a17090651db00b009b2abda2543mr4673191ejk.65.1696000354025; Fri, 29 Sep 2023 08:12:34 -0700 (PDT) MIME-Version: 1.0 References: <20230928005723.1709119-1-nphamcs@gmail.com> <20230928005723.1709119-2-nphamcs@gmail.com> <20230929150829.GA16353@cmpxchg.org> In-Reply-To: <20230929150829.GA16353@cmpxchg.org> From: Yosry Ahmed Date: Fri, 29 Sep 2023 08:11:54 -0700 Message-ID: Subject: Re: [PATCH v2 1/2] hugetlb: memcg: account hugetlb-backed memory in memory controller To: Johannes Weiner 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 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-17.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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 (howler.vger.email [0.0.0.0]); Fri, 29 Sep 2023 08:12:43 -0700 (PDT) On Fri, Sep 29, 2023 at 8:08=E2=80=AFAM 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?