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 7BD43C2BD09 for ; Tue, 9 Jul 2024 12:47:41 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 05E5B6B0089; Tue, 9 Jul 2024 08:47:41 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 00F1D6B0096; Tue, 9 Jul 2024 08:47:40 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E18BE6B0099; Tue, 9 Jul 2024 08:47:40 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id C1FAE6B0089 for ; Tue, 9 Jul 2024 08:47:40 -0400 (EDT) Received: from smtpin21.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 60C0D1C3167 for ; Tue, 9 Jul 2024 12:47:40 +0000 (UTC) X-FDA: 82320190680.21.A6C8110 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by imf07.hostedemail.com (Postfix) with ESMTP id 7A34740029 for ; Tue, 9 Jul 2024 12:47:36 +0000 (UTC) Authentication-Results: imf07.hostedemail.com; dkim=none; spf=pass (imf07.hostedemail.com: domain of xiujianfeng@huawei.com designates 45.249.212.188 as permitted sender) smtp.mailfrom=xiujianfeng@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1720529234; 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:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=wQNtNBwrlK7L3OLkxX90AHWQTv76plZvLm+2iG12szw=; b=cZBVfXgr1bKRAC8BzAxtCxGtJZakSSNBMaV331ZNaMhZUMfT2GsR+bI4VBzE3qn9e/bKB3 2SGTkA7phquJrkdq8cYHg6wakrugif0qcFGSy8KL+UbiNodj/YWPzwq4p92Wwdiu/cLZFU C8aCu65fUJrV8OlEiluO8LRppCiJFeA= ARC-Authentication-Results: i=1; imf07.hostedemail.com; dkim=none; spf=pass (imf07.hostedemail.com: domain of xiujianfeng@huawei.com designates 45.249.212.188 as permitted sender) smtp.mailfrom=xiujianfeng@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1720529234; a=rsa-sha256; cv=none; b=zvPhP0wKSu0S3xCmQnmbcyyeFWbPNUfGCuFDRd6KWXBvNBYFItpFQfypm6DhfM9JEwZ6NX VhzL5YL/D8C+d8Uo0dwgSrjCdwMlTONt2gAULGNfv8F2Ufwq8IaFiwz+yYGDu3sbOPfyzF kgacMeoqJkdcLyqymfDFIw56M2IqcDc= Received: from mail.maildlp.com (unknown [172.19.163.48]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4WJLNS60Stzcn9S; Tue, 9 Jul 2024 20:47:04 +0800 (CST) Received: from dggpeml500023.china.huawei.com (unknown [7.185.36.114]) by mail.maildlp.com (Postfix) with ESMTPS id ECB7D180064; Tue, 9 Jul 2024 20:47:30 +0800 (CST) Received: from [10.67.110.112] (10.67.110.112) by dggpeml500023.china.huawei.com (7.185.36.114) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.39; Tue, 9 Jul 2024 20:47:30 +0800 Message-ID: Date: Tue, 9 Jul 2024 20:47:30 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.5.1 Subject: Re: [PATCH -next] mm/hugetlb_cgroup: introduce peak and rsvd.peak to v2 Content-Language: en-US To: Michal Hocko CC: Andrew Morton , , , , , , , , , Sidhartha Kumar , Miaohe Lin , Baolin Wang 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> From: xiujianfeng In-Reply-To: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.67.110.112] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To dggpeml500023.china.huawei.com (7.185.36.114) X-Stat-Signature: r68hceukotjzoepgiqitj4uhz59ifx4g X-Rspam-User: X-Rspamd-Queue-Id: 7A34740029 X-Rspamd-Server: rspam02 X-HE-Tag: 1720529256-430050 X-HE-Meta: U2FsdGVkX1+3C/vcREkN0TX4ufbtAUVVrdZYKanbzC1eIsGOfQYZAybZ5NpF9rQOdlrMLwwHy2GRio2Q9gpez3bXJzrcqIq0UAtFv/QZyKfhFE6bMwlIu2y9SBXmjMcaclhNxDWXP6tMNkT9Knbibma1OvyrlEcsWRLOLUw/tcvR+UM+6nb3NIPadB0ibyiJ7jSNXeO16NPL5ITLrV5daAVW154cIGdhUZ1v/Ja/qCGSQAmCqN8R6VXxzHQ6Pe8DaJSJnuasv6ATCZjJ4pqohEV+7bKLVm+odDIISqqdOgQ1fllEcpw7QDoMpTYruV85hoV2hstfSzWvIaVq1reiAkVXgFH0W9l7W3r/4HdXHqQX6BfKHdWrvKpDUfUIXr6hycf0MCuCVScK2D/bQk5qalEnT9a+SuvnB7qP4DNQP5ndGbgfz21DIP2ThtxPoPtR2Cm7i652srJ8xJRyC1UX1lv2nSBbPqUI0I6Ocbs8wg4UWFN4ib1d/oTT+y8Ndjo2T8HH8lP0ZNOzZsE++ofglbqLsS8xaXBwrDf+q7IwjxjkvECjAUiUqgYbNlpH5/yciWciBvA9z3VHrkFK9+9/451hKSZfppfCH9ziRPy8XebJMjGv89osFmiHICLfeVlMZUWTGU4sfdRwwCc9in5U37QDaamtaU5InI6kJeoS4xFamDlKoFDxZqX4hbrfzSKFQl0jyh2rm5hlzun1AoB9J7IXiIRFoGjhNZK5FlPczTR/a1Zw3LNfviZIOzbtP1K6DcOGYxe1EtMHxiy3j9uLAVXT8E74+NhHn3esumAQWCXcblKlKbYwXRt3RrtFhxQSV+NU4spDRtt86+orkQLhnZThnH2R3b13hyqDIKHxl9CF7F+/rsodQSS3uWBJtbtTI5uARd36ltWIy68DWUsdHWvR5cGIj4L7wyfcviZHH4CJ4Jb5OMeYTLevnBdXDSMrAtduU3yRIlyTrZzspb5 WW0Xsp/g x6OccBKfqsoT6JkW/mRr+vSegP9tGHTohfeBuoQc2bobYZBx8PZndSZQXJb5iXiXVcj4+jTYOMQdYbKiRNyEsGjKA4CkOrAhclEU16CglymXiQxtUbMTtV6e7DjqZfpPISWrRla21wUmTxug8JA5O2+PFguL++5QWPz99ErP+j/hlnOdWFF5+Oaz/f7Gy6gGz5PxJ4O6+8+AQ2tU= 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 2024/7/9 0:04, Michal Hocko wrote: > 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. > Thanks for sharing your thoughts. Since the peak metric exists in the legacy hugetlb controller, do you have any idea what scenario it's used for? I found it was introduced by commit abb8206cb077 ("hugetlb/cgroup: add hugetlb cgroup control files"), however there is no any description about the scenario.