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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 55F19C32796 for ; Wed, 24 Aug 2022 10:27:04 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D5941940007; Wed, 24 Aug 2022 06:27:03 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D09E26B0074; Wed, 24 Aug 2022 06:27:03 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id BD204940007; Wed, 24 Aug 2022 06:27:03 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id AD1C26B0073 for ; Wed, 24 Aug 2022 06:27:03 -0400 (EDT) Received: from smtpin31.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 8D1294033F for ; Wed, 24 Aug 2022 10:27:03 +0000 (UTC) X-FDA: 79834108326.31.2A0EA76 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by imf28.hostedemail.com (Postfix) with ESMTP id 0E2D1C0076 for ; Wed, 24 Aug 2022 10:27:02 +0000 (UTC) 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: ARC-Authentication-Results: i=1; imf28.hostedemail.com; dkim=pass header.d=suse.com header.s=susede1 header.b=BSwbM9o5; spf=pass (imf28.hostedemail.com: domain of mhocko@suse.com designates 195.135.220.28 as permitted sender) smtp.mailfrom=mhocko@suse.com; dmarc=pass (policy=quarantine) header.from=suse.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1661336823; a=rsa-sha256; cv=none; b=vIz4RPXjCnZARY7z9I+daedJUPYlsziueUSdZlii7T3NGy6+7AGnTNIlJsKiKKOSRRexkR OHZLZKr8niQl+Junqe2m9EG8b7AD+3DkP13D6l5pa96Lgq7lIgSbdnkX5CuhkCkaIxnP6m oDtMVgDpDb16Nx7x3rWDnZ84Fmgk3H8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1661336823; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=svip1HnOF9D7Fl9aKofEvyk0pEgENUVlEuB1mZtboTA=; b=f03ExAveOUp4USaCMLMyivu5P3DuvqNaLu9VQ/TW6yH8/BBtxDUJhqAuOPXIxe523V7FkA +Mq56KMaboSiIqcnksuiIpo++Rc8HRQL+C9prABgpG8HA8xDlQxMjwvz2bs/3Q6Du9KZjy f5y+6QDOtbGHeldjGfXcxEQkVhb8Ru4= Authentication-Results: imf28.hostedemail.com; dkim=pass header.d=suse.com header.s=susede1 header.b=BSwbM9o5; spf=pass (imf28.hostedemail.com: domain of mhocko@suse.com designates 195.135.220.28 as permitted sender) smtp.mailfrom=mhocko@suse.com; dmarc=pass (policy=quarantine) header.from=suse.com X-Rspam-User: X-Rspamd-Queue-Id: 0E2D1C0076 X-Rspamd-Server: rspam05 X-Stat-Signature: mpnoo7qzbdzb6ka4oan119ojbz5kyfa6 X-HE-Tag: 1661336822-372899 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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