Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp319667rwe; Thu, 25 Aug 2022 00:21:41 -0700 (PDT) X-Google-Smtp-Source: AA6agR5nAzOWUg0E4FidX5eKv0cSnbnLZ5EWDN+l6itAoPhILp8MeyO6B9IDaNkmEF8sTvJmFTC6 X-Received: by 2002:a63:e901:0:b0:422:4d27:5814 with SMTP id i1-20020a63e901000000b004224d275814mr2258096pgh.317.1661412100814; Thu, 25 Aug 2022 00:21:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661412100; cv=none; d=google.com; s=arc-20160816; b=RuTxgTSynkJNxM247ij1Rgh5Km1BUnKYe+7QiXMEYY35eQa46f37e04vpJhpQNKwVn l6u8JkYkPlYayIA7giJG8raLlwh8B71RBPnfxnsYi/F+2GI9bZZ9f21+zr6wlqfHaDNJ VPQHS8ddCoDM0AA7jlT06cQoR11+3/w1/3cDhNGykO1VqZLuCOsMSj5gaYgH171p2FL7 GbAlSrgLmSZA+pVrLpPThzR0aueSjkOxgSfjUSwqinHS20CfgPw7j3zLKucA3bjpWiwc 55cXGufRIZBdKkWHOnUWg/j2PHs1u31Fgpa3EoNwpHlFklmjnwc0k3a8ZUMdN/t7BCb5 V0nw== 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-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=8tP0U7uO6jkjoWoaVJTMGffTLHsMTAeM7ZO+0Ttzpnc=; b=LP2QGWu7QaxmnACLe9XAd64miyU1Ng5k+KzY+NmC2dqOBwRz2LUfpGrF2GoVbM6tiB aIyVH03htOgdj/MFbkI1cBj1b8a96Qq3MLeZV0ezmbWYNxaX1CCA+JGk6uO+aYeBaW2F Ufwgj9EH5+TMxkqgByDl3DZK7FmV5OLv5B/C6fox6Je5u8hGzURDSMNK8BSJT1A+beYI /EnjuDjXEIVQjDp3vwOewPhSkVHShu0S5ZZVcZf0tU+NqNyGJZWHUqw25JONUJNVA8cF OyvBKWPTWuLN0zUAFpewGS4rZl/sRywdYRFuaqCcDJn7FE8/8RTkG1tT9xH5nAY0mCYn emIQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=Rlq2EbXz; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k38-20020a63ff26000000b0041d54900184si16484652pgi.497.2022.08.25.00.21.28; Thu, 25 Aug 2022 00:21:40 -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=@suse.com header.s=susede1 header.b=Rlq2EbXz; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235985AbiHYGk6 (ORCPT + 99 others); Thu, 25 Aug 2022 02:40:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49782 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235887AbiHYGkx (ORCPT ); Thu, 25 Aug 2022 02:40:53 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3EAB9E03F; Wed, 24 Aug 2022 23:40:52 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id D76AE5BE15; Thu, 25 Aug 2022 06:40:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1661409650; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=8tP0U7uO6jkjoWoaVJTMGffTLHsMTAeM7ZO+0Ttzpnc=; b=Rlq2EbXz/KoWktPrNnKN7AIXIeIrydmCssc+ZXhRb8K/2E3gz3XlPnDJOGqi2IIcPcmtAO /gA127K196XnzQb58YhLdftTVYTGJzLNuLnqgaP2dPun3n3mKuze7iKY/qiq73UzJvHzsO XCPRI/PrCt8PtA7mhOsqkjocr6NW3hs= Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id B8D2C13A47; Thu, 25 Aug 2022 06:40:50 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id SRPaKnIZB2OIOwAAMHmgww (envelope-from ); Thu, 25 Aug 2022 06:40:50 +0000 Date: Thu, 25 Aug 2022 08:40:50 +0200 From: Michal Hocko To: Zhaoyang Huang Cc: Suren Baghdasaryan , Tejun Heo , Shakeel Butt , "zhaoyang.huang" , Johannes Weiner , Linux MM , LKML , Cgroups , Ke Wang , Zefan Li , Roman Gushchin , Muchun Song Subject: Re: [RFC PATCH] memcg: use root_mem_cgroup when css is inherited Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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 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). -- Michal Hocko SUSE Labs