Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp443682rwe; Wed, 24 Aug 2022 03:53:45 -0700 (PDT) X-Google-Smtp-Source: AA6agR5uW1Tf1RXbg1O1hAuARD7mFh4h3bk6HwYZxlOmAfE9Vd9ll9DoC89nJmcT//S7n7fA2/Zt X-Received: by 2002:a17:90b:3805:b0:1fb:75d4:59d4 with SMTP id mq5-20020a17090b380500b001fb75d459d4mr4777747pjb.209.1661338425628; Wed, 24 Aug 2022 03:53:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661338425; cv=none; d=google.com; s=arc-20160816; b=l1ZroyQvcbKakEkUkrYd4XevbjSEpTej4NN+RL+iHXvv48mQ3mu3N5v1yY6rXx3i3L Z9WoeGa8x2TLhYungudptEW2bDK+/YQpn63e1q5dNAX6fIs4FpsH1K+XMaiurGzisQK5 8n5+LPmxfyL5BvsRdLJ3hC9y5kgO9ZQMWdqrHEuvlddSwbAFRpts0Gk0V0s6JhAyF0f5 zmDmegQ+SSCWvsGAWgGYXGwgYuVjUrdF+zUMOrlMPI561F/1ZBr42QpbZW1ZRdPtK4CP vcnyO+45Or6vmlQ4KPvtVuzE61F4R0TFPWfBqppNI/xJPBw2UI5LNb/dyQA8pdqA8/K1 rFkA== 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=svip1HnOF9D7Fl9aKofEvyk0pEgENUVlEuB1mZtboTA=; b=UwL3rh1m/RtIaakxqAspmn0djQAlkPjhlw6qrII3j3ahKwcV19wjZSzqtFtMVWbG4X VHGQsQB8cpUj3OCjPE1GaiQGR/j1ZJpTZzqaUPfNd9POLTn6cLTVJ6scU74Y+vxHrWI7 W0IGUVO84axMZZwxLgI0JExMNX8/v6ih8N5HRFJHE+tI0tIhpVdM1d4jCh+jE4ONHGmK 4ZF7L5ISNCWtVj36Ufv+zPmybbIhmP76KfRLV3wrMtyOeVfQdcwKvhTm/ujtoqwV6F18 19kHPEd6GXrMzRdHcpbOZbusoDEMkrC1J7AUecRUlfmpPzf6YZEhiwKkZdLtN4ljLHiq +VVA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=BSwbM9o5; 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 r10-20020a63d90a000000b003fdc8b4d872si17607663pgg.602.2022.08.24.03.53.32; Wed, 24 Aug 2022 03:53:45 -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=BSwbM9o5; 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 S235329AbiHXK2B (ORCPT + 99 others); Wed, 24 Aug 2022 06:28:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39258 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235759AbiHXK1k (ORCPT ); Wed, 24 Aug 2022 06:27:40 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 15F4E80B75; Wed, 24 Aug 2022 03:27:03 -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-out1.suse.de (Postfix) with ESMTPS id AF57A34169; Wed, 24 Aug 2022 10:27:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1661336821; 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=svip1HnOF9D7Fl9aKofEvyk0pEgENUVlEuB1mZtboTA=; b=BSwbM9o5a63Dsl3aydVUid7PDlzXWhAjXTXwpvHPRto/Y+Z4jx+DSo3SpxBtt/QERnMVCr Bsy6tdYVt8qrRFwuly1qta1c5/YJ/QwiiPW6MwVlDOnVjadS+2kc3loarhh3eYS9c9OEfd Ry2BcmegFWJQ3RRPza792trSufbhx4o= 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 8A0F413AC0; Wed, 24 Aug 2022 10:27:01 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id HCidH/X8BWMvGwAAMHmgww (envelope-from ); Wed, 24 Aug 2022 10:27:01 +0000 Date: Wed, 24 Aug 2022 12:27:00 +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 Wed 24-08-22 17:34:42, Zhaoyang Huang wrote: > On Wed, Aug 24, 2022 at 3:50 PM Michal Hocko wrote: > > > > On Wed 24-08-22 10:23:14, Zhaoyang Huang wrote: > > > On Tue, Aug 23, 2022 at 7:51 PM Michal Hocko wrote: > > [...] > > > > One way to achieve that would be shaping the hierarchy the following way > > > > root > > > > / \ > > > > no_memcg[1] memcg[2] > > > > |||||||| ||||| > > > > app_cgroups app_cgroups > > > > > > > > with > > > > no_memcg.subtree_control = "" > > > > memcg.subtree_control = memory > > > > > > > > no? > > > According to my understanding, No as there will be no no_memcg. All > > > children groups under root would have its cgroup.controllers = memory > > > as long as root has memory enabled. > > > > Correct > > > > > Under this circumstance, all > > > descendants group under 'no_memcg' will charge memory to its parent > > > group. > > > > Correct. And why is that a problem? I thought you main concern was a per > > application LRUs. With the above configuration all app_cgroups which do > > not require an explicit memory control will share the same (no_memcg) > > LRU and they will be aged together. > I can't agree since this indicates the processes want memory free > depending on a specific hierarchy which could have been determined by > other subsys. I really fail to understand your requirements. > 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. -- Michal Hocko SUSE Labs