Received: by 2002:ab2:6309:0:b0:1fb:d597:ff75 with SMTP id s9csp563832lqt; Thu, 6 Jun 2024 11:15:42 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXG92sNpB33B8kiic96WGYd8j3let8H0EJg5HbYkau9tmdlGGQkhh0TXToOmyFppJGwfAsqQhuJ1cGpRIR3WIT+dwCJPA2QcFmp53ZwcQ== X-Google-Smtp-Source: AGHT+IFk+f10CH4g5zBqbMxv4l8NT8kSgiiWV6NseaSIreufrsO9241JCchn5+n0Q9bAyRAZW9PL X-Received: by 2002:a17:902:d506:b0:1f4:a026:4888 with SMTP id d9443c01a7336-1f6d02e65d2mr4641635ad.21.1717697742457; Thu, 06 Jun 2024 11:15:42 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717697742; cv=pass; d=google.com; s=arc-20160816; b=Kc6jTyOZv6HJ17DGLmf43c77JwL2SdSXpqI7mRxQhwCvnisrXPue20fruP7huUVpWW 4dwktaA0qQSgIaRswr6xAjSwoGzQMYMj/jcV08NOvnpYlS0K1qsz4yGXxepqrGU4UMFQ KMT1jjVbguej8DeBnS+jzxWX9mZSiSKFHo1ZSq8JehDCUlZ+2zhd7A2QuTf5INvZafp1 6FDxkSZu5D+oe9qq+g+bPLe+3QbOHxXY8zC5jkvAT/5j0A6hhOwcjk26zZFSHpv1BnM0 qWcag3BYUzojXYYIQl/FjwoplpLiljXGgShQ6f4qwsTgZB/ET0+7/N8wdadHLchyBJKq k4yQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:message-id:subject:cc:to:from:date:dkim-signature; bh=Zm43uA+FFLHcQl+sDCvd8VPxTBF9+LzpAfW+SfYXKcA=; fh=49TcTfSNdQyhAT4zUO7PxOQS0G7yA0LPS9x7i1DEOSA=; b=EPSXqKEDs/1HHIfntimI2eYpZMTykGLJBWgDCdduAlbFzupiqH8PQFactbp6avUkQr aH7Xac6PuGIqssMFCndbqf8ToIsb0mND2Kq9Li1In2kIakOWszLQ593Eq8MhkMOPkFIe jMAlfzv9L6YHWHNOIUyETyWYvC7dc0dC3cmTCrWTb4zi7YrK+EFqkT8bRn6AMJQUnzku MVXWG9I7cqH7zAkSAV3X0ATFd9/Mh0nxH5XdBI9gZ0yO6afeKffgwprrf6pSCtEG63Rp 69TgCMrNGaiEmJ6iXTj+os1OikU8IVMn1UNIF2G+10G6vwoWRFaVWgDnmZ+dhHl9Dbiu rEfw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=If2w5F5Z; arc=pass (i=1 spf=pass spfdomain=linux.dev dkim=pass dkdomain=linux.dev dmarc=pass fromdomain=linux.dev); spf=pass (google.com: domain of linux-kernel+bounces-204868-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-204868-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id d9443c01a7336-1f6bd7d2cd1si15542135ad.215.2024.06.06.11.15.42 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Jun 2024 11:15:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-204868-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=If2w5F5Z; arc=pass (i=1 spf=pass spfdomain=linux.dev dkim=pass dkdomain=linux.dev dmarc=pass fromdomain=linux.dev); spf=pass (google.com: domain of linux-kernel+bounces-204868-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-204868-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 163C128A1B4 for ; Thu, 6 Jun 2024 18:15:42 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id F11721993B0; Thu, 6 Jun 2024 18:15:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="If2w5F5Z" Received: from out-172.mta0.migadu.com (out-172.mta0.migadu.com [91.218.175.172]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 75763199399 for ; Thu, 6 Jun 2024 18:15:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717697718; cv=none; b=sAVSIN5bzRBzObBrb27AF0FvF85FUXdWcXXfhC9x35X2F4bDjNEDN60MKYD2Pqp2YJk6tVW4Y0rJNZxi+t8dXj/TOVNxOOmTDm9/empQuNyn0gJohCAfz/vz4dgHO/4FTTwLfkfZ7cPbZpOQOdvKwKgBH/yF+/viR83wSD0U3yQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717697718; c=relaxed/simple; bh=ytajylKBlzwPswUUv2PV8XK1+cwCdFg6WnD/8QncpwQ=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=GBCV26mJvieDLTZHP7VWqND//jRe0GGieg+03ZkYDyj54FH08z3tbQLwxYDT+ljyPgqVFHX7TDdyxLTkvZPVn2HFOxhL+zUk5I4nblzHKUzoBhCx8PrA9SQckSUdvIwaJcJ8usjL18WGMW1XZjXudz++Mnt/mZX7Vu60N3cYYQc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=If2w5F5Z; arc=none smtp.client-ip=91.218.175.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev X-Envelope-To: mkoutny@suse.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1717697714; h=from:from: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:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Zm43uA+FFLHcQl+sDCvd8VPxTBF9+LzpAfW+SfYXKcA=; b=If2w5F5Zph9CPlLmSbDtKOFaWOdch41r+lhhzrRFSq3r8BF8SWCpDg8bIfa6Qm0usWedal SHHmp+IAtel164h1JJDc9izUSVY3Z4JE9sy4y3KFtJbcEMaoQZ/dxaYGQACssHxbulRoXj cnBeRCdKm0Ms6sR8G818cpPUl2nSbhA= X-Envelope-To: cgroups@vger.kernel.org X-Envelope-To: linux-doc@vger.kernel.org X-Envelope-To: linux-kernel@vger.kernel.org X-Envelope-To: linux-mm@kvack.org X-Envelope-To: tj@kernel.org X-Envelope-To: lizefan.x@bytedance.com X-Envelope-To: hannes@cmpxchg.org X-Envelope-To: corbet@lwn.net X-Envelope-To: mhocko@kernel.org X-Envelope-To: shakeel.butt@linux.dev X-Envelope-To: muchun.song@linux.dev X-Envelope-To: akpm@linux-foundation.org X-Envelope-To: jkratochvil@azul.com Date: Thu, 6 Jun 2024 11:15:00 -0700 X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Roman Gushchin To: Michal =?iso-8859-1?Q?Koutn=FD?= Cc: cgroups@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, Tejun Heo , Zefan Li , Johannes Weiner , Jonathan Corbet , Michal Hocko , Shakeel Butt , Muchun Song , Andrew Morton , "Jan Kratochvil (Azul)" Subject: Re: [RFC PATCH v5 0/3] Add memory.max.effective for application's allocators Message-ID: References: <20240606152232.20253-1-mkoutny@suse.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20240606152232.20253-1-mkoutny@suse.com> X-Migadu-Flow: FLOW_OUT On Thu, Jun 06, 2024 at 05:22:29PM +0200, Michal Koutn? wrote: > Some applications use memory cgroup limits to scale their own memory > needs. Reading of the immediate membership cgroup's memory.max is not > sufficient because of possible ancestral limits. The application could > traverse upwards to figure out the tightest limit but this would not > work in cgroup namespace where the view of cgroup hierarchy is > incomplete and the limit may apply from outer world. > Additionally, applications should respond to limit changes. If the goal is to detect how much memory would it be possible to allocate, I'm not sure that knowing all memory.max limits upper in the hierarchy really buys anything without knowing actual usages and a potential for memory reclaim across the entire tree. E.g.: A (max = 100G) | \ B C C's effective max will come out as 100G, but if B.anon_usage = 100G and there is no swap, the actual number is 0. But if it's more about exploring the "invisible" part of the cgroup tree configuration, it makes sense to me. Not sure about the naming, maybe something like memory.tree.max or memory.parent.max or even memory.hierarchical.max is a better fit. Thanks!