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 E7F6FC3271E for ; Mon, 8 Jul 2024 16:04:06 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 6F9916B00A7; Mon, 8 Jul 2024 12:04:06 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 6A9816B00A8; Mon, 8 Jul 2024 12:04:06 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 572026B00A9; Mon, 8 Jul 2024 12:04:06 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 36F176B00A7 for ; Mon, 8 Jul 2024 12:04:06 -0400 (EDT) Received: from smtpin29.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id A50C48149C for ; Mon, 8 Jul 2024 16:04:05 +0000 (UTC) X-FDA: 82317056850.29.C8847A0 Received: from mail-ed1-f41.google.com (mail-ed1-f41.google.com [209.85.208.41]) by imf07.hostedemail.com (Postfix) with ESMTP id 6403B4002D for ; Mon, 8 Jul 2024 16:04:03 +0000 (UTC) Authentication-Results: imf07.hostedemail.com; dkim=pass header.d=suse.com header.s=google header.b=TSkFvmes; spf=pass (imf07.hostedemail.com: domain of mhocko@suse.com designates 209.85.208.41 as permitted sender) smtp.mailfrom=mhocko@suse.com; dmarc=pass (policy=quarantine) header.from=suse.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1720454629; 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=r/Nh20E7oiLudtA0FS0qlhX52m/6CLHQileRH4RyzWg=; b=unVclylNRrqzw1gYIwzTDW2+rZ2FSb8LR2d8IvmBB62AboSPBlZFR7xVBGuR88H79zIULF P7JW8XAlLceOOE3Wa5taAq91yYuFlqpO066m6fdGkfqz2ilUaBVIYcSGrrGH6Sg5IBcPpP dl/Jhu42vu88g55JrZUDr5OSBB4E2ck= ARC-Authentication-Results: i=1; imf07.hostedemail.com; dkim=pass header.d=suse.com header.s=google header.b=TSkFvmes; spf=pass (imf07.hostedemail.com: domain of mhocko@suse.com designates 209.85.208.41 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=1720454629; a=rsa-sha256; cv=none; b=7duF9uT3eKcqZNI9f1f6Y9F3VUIIWXmup45MG4bPpHDSpdMwqG7Nk5r1u6GPALU/KLP/et bAM9/V5fYd9o865fbuDri6WHRjO+lAji33V+64vklNH/wUGGl9ovMhcBVyzGZxAEueocMx NYF+/AshFqUBkz7Me15Yd1Hyzi8OVeg= Received: by mail-ed1-f41.google.com with SMTP id 4fb4d7f45d1cf-57cc1c00ba6so5529108a12.1 for ; Mon, 08 Jul 2024 09:04:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1720454642; x=1721059442; darn=kvack.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=r/Nh20E7oiLudtA0FS0qlhX52m/6CLHQileRH4RyzWg=; b=TSkFvmesavX0BMdXte+YwJ2lo2lKjU4qzbzCbbTinr9AgYgHO3NA+DaNmTUPKXoqP2 hxqNmiFlS7ajxo8iLKJs3qD+gx4mvpOzGsc3TQxq+tsFUTToprTzom9HjP7W5WJ7JUAV 2RnTGLl5K5MEORAu0i4jW/DsM96D/VwkLU2dt5k/C7jSWvg3OEiEpZh65mTkT3k4NwTS zMGmhOmp+z/Cj4u2pCbj12A1wFOTdLbHhUIfSbfwmVqXg+dhBvElLIN4ur0xoEW0HeNH iijusXRbtem9vNYb0DlZzxG1pGrt3VPbaptdGC3XIQYAVc5XSHNDP3XUd1d9U6+iX6sn +IoA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720454642; x=1721059442; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=r/Nh20E7oiLudtA0FS0qlhX52m/6CLHQileRH4RyzWg=; b=j56M0XKzqUfd0rqpQYJMb2pcueOEVIO1RprI8yog8SaSEc45+zqh4b6Hv4283NHTJr ZfSbGIRTGvGNstxeqkq272bZnZ+CPqQgE23ibJ5URhBu2Lo0/yreBeJOI4Mg8dsOdZ3S r/WVlo2gfyBVXRdb1sOF/DKbOo4S/7tZHMaIX5d5Ka3HoVC6rJ4bSHtii2lIg2i8L/pN o5gwTDQOTbG3bZMfwc1i9XHacNTIwmwNm+DFn1dWl2BteM4faXn/iBNCrozilxXNQVMT fCDBTBs+WpvclLusR3X/kcsjIUDx4w+YgVxbKeqm9vp8vLTUkYp/CNBLHKjGaF2Xazd6 geAg== X-Forwarded-Encrypted: i=1; AJvYcCWFxGMHg0XyuZUTMpCNb0ZucAbJ3rWB7kDjB6n/t14D/Zf4DFx3+vP9SyQmfCclfBqZnQzbUBl1F77pttCdVfzA9eg= X-Gm-Message-State: AOJu0YzrC5AYLQWWgmrIP/dJ+jsMHTdkC3h3mkBgHAb8Jsfqw0hsCLI/ coZ7Fv8Nejl6PaA6r5vQ3UiD69VfoWfLhZoFgksBjTZwNl5YgcRIoIoR4D7L1t0= X-Google-Smtp-Source: AGHT+IHVj7SwwtCWqG3e/oHvkJvsv6UgptYMNeGBr1++0ZWNEn4UoPauERNteSei9ct3YpU1AQM7fQ== X-Received: by 2002:a05:6402:2353:b0:57c:c166:ba6 with SMTP id 4fb4d7f45d1cf-594bb58015cmr35695a12.19.1720454641745; Mon, 08 Jul 2024 09:04:01 -0700 (PDT) Received: from localhost (109-81-92-226.rct.o2.cz. [109.81.92.226]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-594bc3efb13sm7321a12.42.2024.07.08.09.04.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Jul 2024 09:04:01 -0700 (PDT) Date: Mon, 8 Jul 2024 18:04:00 +0200 From: Michal Hocko To: xiujianfeng Cc: Andrew Morton , tj@kernel.org, lizefan.x@bytedance.com, hannes@cmpxchg.org, corbet@lwn.net, cgroups@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, Sidhartha Kumar , Miaohe Lin , Baolin Wang Subject: Re: [PATCH -next] mm/hugetlb_cgroup: introduce peak and rsvd.peak to v2 Message-ID: References: <20240702125728.2743143-1-xiujianfeng@huawei.com> <20240702185851.e85a742f3391857781368f6c@linux-foundation.org> <6843023e-3e80-0c1c-6aab-b386ffebd668@huawei.com> <20240703133804.1d8ddf90f738a7d546399b3b@linux-foundation.org> <5ce7be39-ac42-98c9-65fc-589385b8f65b@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <5ce7be39-ac42-98c9-65fc-589385b8f65b@huawei.com> X-Rspam-User: X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: 6403B4002D X-Stat-Signature: t3txoszmrui6u4fbdp6qibwcgnuf5udb X-HE-Tag: 1720454643-752098 X-HE-Meta: U2FsdGVkX19JXLGipHlfxtVnEGNboMDY6UdSx1mz9vehbHf4NeDewKNi00Nieky9NowH4ozz/+oypyiIPmkfZE+wnbKguMdiavf9irv/CFcS9M/6lAooci56YgoLLpc8YQyNDO+1GXDycqjKvTQeR58BO2iyl9x6aFWmR6pRAzvEh3TgQEfYEd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kN0kUW9BsndBwaQElATpMytKxM3aAMJ33akgm9KqpWSyRan+n3x3yIDiQpUvgJ0Ut/8GKsdjF8dtm6apKCmVA/H9JiPW4Yj3pfp4NtDkXx33LNeANEn/B1CavxAV3IM= 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: List-Subscribe: List-Unsubscribe: On Mon 08-07-24 21:40:39, xiujianfeng wrote: > > > On 2024/7/8 20:48, Michal Hocko wrote: > > On Wed 03-07-24 13:38:04, Andrew Morton wrote: > >> On Wed, 3 Jul 2024 10:45:56 +0800 xiujianfeng wrote: > >> > >>> > >>> > >>> On 2024/7/3 9:58, Andrew Morton wrote: > >>>> On Tue, 2 Jul 2024 12:57:28 +0000 Xiu Jianfeng wrote: > >>>> > >>>>> Introduce peak and rsvd.peak to v2 to show the historical maximum > >>>>> usage of resources, as in some scenarios it is necessary to configure > >>>>> the value of max/rsvd.max based on the peak usage of resources. > >>>> > >>>> "in some scenarios it is necessary" is not a strong statement. It > >>>> would be helpful to fully describe these scenarios so that others can > >>>> better understand the value of this change. > >>>> > >>> > >>> Hi Andrew, > >>> > >>> Is the following description acceptable for you? > >>> > >>> > >>> Since HugeTLB doesn't support page reclaim, enforcing the limit at > >>> page fault time implies that, the application will get SIGBUS signal > >>> if it tries to fault in HugeTLB pages beyond its limit. Therefore the > >>> application needs to know exactly how many HugeTLB pages it uses before > >>> hand, and the sysadmin needs to make sure that there are enough > >>> available on the machine for all the users to avoid processes getting > >>> SIGBUS. > > > > yes, this is pretty much a definition of hugetlb. > > > >>> When running some open-source software, it may not be possible to know > >>> the exact amount of hugetlb it consumes, so cannot correctly configure > >>> the max value. If there is a peak metric, we can run the open-source > >>> software first and then configure the max based on the peak value. > > > > I would push back on this. Hugetlb workloads pretty much require to know > > the number of hugetlb pages ahead of time. Because you need to > > preallocate them for the global hugetlb pool. What I am really missing > > in the above justification is an explanation of how come you know how to > > configure the global pool but you do not know that for a particular > > cgroup. How exactly do you configure the global pool then? > > Yes, in this scenario, it's indeed challenging to determine the > appropriate size for the global pool. Therefore, a feasible approach is > to initially configure a larger value. Once the software is running > within the container successfully, the maximum value for the container > and the size of the system's global pool can be determined based on the > peak value, otherwise, increase the size of the global pool and try > again. so I believe the peak metric is useful for this scenario. This sounds really backwards to me. Not that I care much about peak value itself. It is not really anything disruptive to add nor maintain but this approach to configuring the system just feels completely wrong. You shouldn't be really using hugetlb cgroup controller if you do not have a very specific idea about expected and therefore allowed hugetlb pool consumption. -- Michal Hocko SUSE Labs