Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp377276rwe; Thu, 25 Aug 2022 01:51:33 -0700 (PDT) X-Google-Smtp-Source: AA6agR5/c9IxBmE6vwgbLgPUdEB1UJqWVI0sto7P6yYsivscMh7BJpmterEpfQ/yFEW6sCY/0S1R X-Received: by 2002:a17:902:d4c9:b0:172:f480:bdd with SMTP id o9-20020a170902d4c900b00172f4800bddmr2779139plg.170.1661417492789; Thu, 25 Aug 2022 01:51:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661417492; cv=none; d=google.com; s=arc-20160816; b=nAZ7LH7XF5fQvwT5Og/N8Rl3Y1yGUBkOhUyurfij6L/ayjR/wtSlLkNDtivAz4vCyh 3KQlK3PY0dPeyM/a5O0BMNSnT8przsGJQjmKScvdIS0JXEy748U+gwm7qPEP/v2pWGE7 IbrNbRiYz0DAUqoRTfxxP4BZAaW5bSaJuyG4rr8dHyAAXrGKtR12OU/QUlj034AAUm+R vrypZXTeV31q9MpOq+sD7WhgObVDZEihkz09TLshD/OmymehUXx1+3cSfaMOqqESi/Il pjBHA3ULPc8E4Pq/l3JKz9CFrysvidD616btYjWEZULhuwohMrDfLKtwkHSw0noK8gDm s8ww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=H+0hvgnQryLyRGTLY2PSvbtKINzM1C3o/madftxyfvU=; b=vtfwCI0qNiOnO2+25/AO8PsGvfmTEwZVM5mo4DQmOA6lcx/dFpwRVpgIw/9kBC7lAw qbwZXDF7p//Q4ORe8PxgfdlNn7w2UvPJms3zQ3TymDM+5qVEyKn2pSq6gIvpLcaJ6iKO 9T+orm1IluIiSRqcXMxMKTD3dvY+2cYHpsiZxI4/w/m0jQLSqC5VJVibEl1WMZnNY3cb Qy2N5q/pZqqcrSL12Vceshg0lxheexv+EhhZ36h1Jcw0RDQ7Jnzjtp+0/vJpJvVExzac tZ8vFTAQeGqWUA+p49DioEc8t64A5WCfdYlGxIjD6HLlvKjUxH1YklyEuxtUID4j6KRg 843A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=hUs2zEar; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n12-20020a634d4c000000b0041b557cea68si20993419pgl.25.2022.08.25.01.51.21; Thu, 25 Aug 2022 01:51:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=hUs2zEar; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235219AbiHYIev (ORCPT + 99 others); Thu, 25 Aug 2022 04:34:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43094 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234415AbiHYIef (ORCPT ); Thu, 25 Aug 2022 04:34:35 -0400 Received: from mail-lj1-x22b.google.com (mail-lj1-x22b.google.com [IPv6:2a00:1450:4864:20::22b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 411CEA599B; Thu, 25 Aug 2022 01:34:34 -0700 (PDT) Received: by mail-lj1-x22b.google.com with SMTP id n24so16684685ljc.13; Thu, 25 Aug 2022 01:34:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc; bh=H+0hvgnQryLyRGTLY2PSvbtKINzM1C3o/madftxyfvU=; b=hUs2zEarOFOjldcG3/iN1PjdwMaKcwDVlAxhiVE1FNpVdYCy9CBiFFc0u4vGdOhtTJ Zjf7OoJfwwqcqxxmkppcrILJB9/dXeYYO4zQnglsljh9LY6b31UWtcvuyN2xpMf5+91r pgv+hOaa4lZvxqNvi0bAfaF/LNas8FXjjBy68uXz5htwDQqKbfvUl0XMYV7OiDZ03ZCn kakLDuYy35p7tQLQr19m2+/EHNOYoK521heqvB/5pGDWO0PBTrkmq95thaBW04NEYDOp f6QFGMSBJepxO1H2h7tEoGwlalN8ez1DlEJF24r4AXehRuV/Dwkl0LsnKM+ZSeK+ROZ/ lVIA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc; bh=H+0hvgnQryLyRGTLY2PSvbtKINzM1C3o/madftxyfvU=; b=WnSZHB1fuCuneXEbaaYtMHuNnT0YX4beAJLKRbxYVqsaj3kvqwXZJ0LMYtNdlCG15X iqNsPOex6MEFP5x5UPYr1I2TwdJaF6OQPfdsOOVxBYOeIT+X473bd1ucYroA9cMpo4r4 hgsWMz8C3GUeGuH3Yxz8XqYEqxIc8G5+4Q/o77ipxpGVkcvvxXUhKEg1q7Cj1gvuQ9LO y8IPGHsT/mVxXeiVkcDKf5ta1yPe1V0lyH6JX9q06/Fyw94HvzP2kIxZnZnrUcrxXPML SFQyEEEi/ktO7W9YAkbAAxh4aDdzJ8lkF12ffPGyy/14AbE53Qa36WDwxYhVD5o2HPpz 3Oaw== X-Gm-Message-State: ACgBeo3M/OPwX5a+MP5ZMFHjdqEVzqC6zAdWRWlkUpxEqwSPVfbEUswR wq2wXfis15HemiUy1MTP7j2STS58FsLiGj05GbI= X-Received: by 2002:a2e:3817:0:b0:261:cfba:ee4c with SMTP id f23-20020a2e3817000000b00261cfbaee4cmr732301lja.443.1661416472267; Thu, 25 Aug 2022 01:34:32 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Zhaoyang Huang Date: Thu, 25 Aug 2022 16:34:04 +0800 Message-ID: Subject: Re: [RFC PATCH] memcg: use root_mem_cgroup when css is inherited To: Michal Hocko Cc: Suren Baghdasaryan , Tejun Heo , Shakeel Butt , "zhaoyang.huang" , Johannes Weiner , Linux MM , LKML , Cgroups , Ke Wang , Zefan Li , Roman Gushchin , Muchun Song Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 On Thu, Aug 25, 2022 at 2:40 PM Michal Hocko wrote: > > On Thu 25-08-22 08:43:52, Zhaoyang Huang wrote: > > On Wed, Aug 24, 2022 at 6:27 PM Michal Hocko wrote: > > > > > > On Wed 24-08-22 17:34:42, Zhaoyang Huang wrote: > [...] > > > > IMHO, charging the pages which out of explicitly memory > > > > enabled group to root could solve all of the above constraints with no > > > > harm. > > > > > > This would break the hierarchical property of the controller. So a > > > strong no no. Consider the following example > > > > > > root > > > | > > > A > > > controllers="memory" > > > memory.max = 1G > > > subtree_control="" > > > | | | > > > A1 A2 A3 > > > > > > althought A1,2,3 do not have their memory controller enabled explicitly > > > they are still constrained by the A memcg limit. If you just charge to > > > the root because it doesn't have memory controller enabled explicitly > > > then you just evade that constrain. I hope you understand why that is a > > > problem. > > IMO, A1-A3 should be explicitly enabled via echo "+memory" > > > A/subtree_control since memory.max has been set. > > You seem to be missing the point I've triedy to make here. It is not > about how the respective subtree should or shouldn't be configured. It > is about the hierarchical behavior. Configuration at a higher level should be > enforced under subtree no matter how that subtree decides to > enabled/disable controllers. Such subtree might have beeb delegated > and configured differently yet the constrain should be still applied. > See the point? > > What you seem to be proposing is similar to cgroup v1 use_hierarchy > configuration. It has been decided that this is undesirable very early > in the cgroup v2 development because it make delegation impossible > (among other reasons). Ok, I would like to know how AA3 achieve the goal of competing with A1 and A2 for cpu but keep memory out of control under current policy? root | A controllers="memory,cpu" memory.max = 1G subtree_control="memory,cpu" | | | A1 A2 A3 subtree_control="cpu" | | AA3 AA4 controllers="cpu" > > -- > Michal Hocko > SUSE Labs