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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A37C0C04AA5 for ; Thu, 25 Aug 2022 06:41:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235734AbiHYGk7 (ORCPT ); Thu, 25 Aug 2022 02:40:59 -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: 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