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 ABEE1E6B255 for ; Fri, 1 Nov 2024 12:44:16 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 357056B008A; Fri, 1 Nov 2024 08:44:16 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 306C56B008C; Fri, 1 Nov 2024 08:44:16 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 21C5F6B0093; Fri, 1 Nov 2024 08:44:16 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 0434B6B008A for ; Fri, 1 Nov 2024 08:44:15 -0400 (EDT) Received: from smtpin03.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id AD44116029F for ; Fri, 1 Nov 2024 12:44:15 +0000 (UTC) X-FDA: 82737492684.03.E8A37B3 Received: from frasgout.his.huawei.com (frasgout.his.huawei.com [185.176.79.56]) by imf02.hostedemail.com (Postfix) with ESMTP id 3622680012 for ; Fri, 1 Nov 2024 12:43:18 +0000 (UTC) Authentication-Results: imf02.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf02.hostedemail.com: domain of stepanov.anatoly@huawei.com designates 185.176.79.56 as permitted sender) smtp.mailfrom=stepanov.anatoly@huawei.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1730464971; 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=AUhBcgri3OEnXGMMXYOpLjHhwSCDmGqFphQfXRE12Z4=; b=JvfVnl9PYfSUrOr56qyTVl0GNskfP+e6mNpwaDWpXL1pFJKxE2Jl6aGOCrQke8h3le10jR jMEMlNhv01mKMBQbbmdi1AxGkEuZ3jOo4e+IDF+CjnDiNXRlWSb7VfYpxNdEPiWqJj6jqZ m8GtZQlTrSHarRI/1pVyV6mbOr9dB9M= ARC-Authentication-Results: i=1; imf02.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf02.hostedemail.com: domain of stepanov.anatoly@huawei.com designates 185.176.79.56 as permitted sender) smtp.mailfrom=stepanov.anatoly@huawei.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1730464971; a=rsa-sha256; cv=none; b=uAhX3qKNLvQoZivroz4Fk09HOzSo5d8CzH5kqKlbt4ilnXzonX1CKGgkvgOBtMrEMCevHe ch04V71UVpIVX9v6zj0QoTPTuYo4+z+NQvPoG+XcDDj1w7foT16sKhrxGjK9WOoO7tgNZ5 +RFltDUEKYYKdwGN02nI+MKNVubQDNE= Received: from mail.maildlp.com (unknown [172.18.186.231]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4Xg0mK0jPzz6LD2q; Fri, 1 Nov 2024 20:39:13 +0800 (CST) Received: from mscpeml500003.china.huawei.com (unknown [7.188.49.51]) by mail.maildlp.com (Postfix) with ESMTPS id 1C03C140B55; Fri, 1 Nov 2024 20:44:07 +0800 (CST) Received: from [10.123.123.226] (10.123.123.226) by mscpeml500003.china.huawei.com (7.188.49.51) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1258.34; Fri, 1 Nov 2024 15:44:06 +0300 Message-ID: <8e55d735-b65d-428f-8689-8f0b729d56c4@huawei.com> Date: Fri, 1 Nov 2024 15:44:06 +0300 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [RFC PATCH 0/3] Cgroup-based THP control To: Johannes Weiner , CC: , , , , , , , , , , , , , , , , , , , , References: <20241030083311.965933-1-gutierrez.asier@huawei-partners.com> <20241030150851.GB706616@cmpxchg.org> Content-Language: en-US From: Stepanov Anatoly In-Reply-To: <20241030150851.GB706616@cmpxchg.org> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.123.123.226] X-ClientProxiedBy: mscpeml100004.china.huawei.com (7.188.51.133) To mscpeml500003.china.huawei.com (7.188.49.51) X-Rspam-User: X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: 3622680012 X-Stat-Signature: zbhnq5wutks7fdgym869tmqpx91wm4f6 X-HE-Tag: 1730464998-789408 X-HE-Meta: U2FsdGVkX18cr6pIoinZDyxJtfK7tUKSp6VMhQbPEJtXtBWl8vo2x5GYcBa7M/xSnui2jXwWc3ZYg+PY5WPkpLWc3dwUM5VtR500cQvLhNQvLwKUjn4RVI8m/zaFPAgX12wbHLxpJires1Yew9o8GcotiPVlGnqS2rZGYKe228m4BV5Yj9aQbwMtvOW/ecj6wY5IRWV0bu9Q3s4C/o+AGQ5TZCby97J8jpYD12c5oYFJT96Kg3e2Kp5Bf5+OwK9mcC0JJACx9NFCRHMYlg4SA5g4dFW9iyX9RPd+XxMPkcjh9WPx7saLVk3S41Me34Fy7ZBdxu7KYrKHYo8kiPVDMLK9JfGTTK60adxCjOBUxhBFC8t1oZpYwwIeiGD3871jdJN3GHeDSRehS+ITMF//gpzm8VOuWiDM1JqKvBFpZ8+1g6475724RkQeq+CWT+twyetbF6EQb6jdsr7eFmm1ZSc9UW3lwBBDoC3jvKH21e3gM8vdthMgrjAk+R7VlSNJ2gLMWx/JB+ITSEuK9Y1ANZ7K6L+tJSBprAcZCeXzTnzRb3BtQ0+bhKsWWcnKGux6Nf73SxbPixsjbIu4KZM3MSqUY126BU58LMiVdV2HbH1EthPJuKHWRit/JikWP4U4d2DUuEZwtTaM6a8w1uURUFf7a6icZuRDA9zxHSSGHtX5VM/fovyAr6HFlXlGRgQcnaFA90ObaUbxOuoXdNf1jYUi0ipb1UGFEtoXAUQQ9CF/rBDE+er9dKndm+2mBFortshNy4vjnEeTErVeGAbJdcP6uXx0kMsWwzv5GpPQ/+jvSHpu/xP4jlk7UgvehYDnvfVSpqg5y15J2mSvE+1uUwD2P7NtGRv1R5dsktiBdQl1Oic8onKG9CQ3aC0YEYAOwJ0xDgSf5PTrVVbEzexS5QpFhaHWdqFKrxt4sLWOJMkVJTzXKEO7f8bw3ERY9V78y+jpAxAhI5ovhP/JE9d hq9ETQy/ nOn7KAgGr3af/Z0iunXLeRSFc44HP+YYJxjG+Rt1wkIsryb513Sjx5Ab9GSe18Ho2/3LB34B3j7jUqGbiodTUYsH+lAAyu93UICBSeXFnAmpCeY0zVqnjeoj+pC/hKxrXGxADALEXh1mhjdKO3EhNCalB/VCZguUYggh2en6PuPBl9Ah34DfraSAecMT+qqFrrJKTHvlpWKBzpOMsSSLSzC5oGBB/w5fNW1OB 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 10/30/2024 6:08 PM, Johannes Weiner wrote: > On Wed, Oct 30, 2024 at 04:33:08PM +0800, gutierrez.asier@huawei-partners.com wrote: >> From: Asier Gutierrez >> >> Currently THP modes are set globally. It can be an overkill if only some >> specific app/set of apps need to get benefits from THP usage. Moreover, various >> apps might need different THP settings. Here we propose a cgroup-based THP >> control mechanism. >> >> THP interface is added to memory cgroup subsystem. Existing global THP control >> semantics is supported for backward compatibility. When THP modes are set >> globally all the changes are propagated to memory cgroups. However, when a >> particular cgroup changes its THP policy, the global THP policy in sysfs remains >> the same. >> >> New memcg files are exposed: memory.thp_enabled and memory.thp_defrag, which >> have completely the same format as global THP enabled/defrag. >> >> Child cgroups inherit THP settings from parent cgroup upon creation. Particular >> cgroup mode changes aren't propagated to child cgroups. > > Cgroups are for hierarchical resource distribution. It's tempting to > add parameters you would want for flat collections of processes, but > it gets weird when it comes to inheritance and hiearchical semantics > inside the cgroup tree - like it does here. So this is not a good fit. > > On this particular issue, I agree with what Willy and David: let's not > proliferate THP knobs; let's focus on making them truly transparent. We're also thinking about THP-limit direction (as mentioned in cover-letter) Just have per-cgroup THP-limit and only global THP knobs, with couple additional global modes (always-cgroup/madvise-cgroup). "always-cgroup" for instance would enable THP for those tasks which are attached to non-root memcg. Per-cgroup THP limit might be used in combination with global THP knobs, and in this we can maintain hiearchical semantics. Now it's just an idea, may be it's better to have another RFC patch-set for this, to be able to have more productive conversation. -- Anatoly Stepanov, Huawei