From patchwork Wed Aug 14 20:28:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shakeel Butt X-Patchwork-Id: 13763929 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 CB306C52D7F for ; Wed, 14 Aug 2024 20:28:58 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 39D456B008A; Wed, 14 Aug 2024 16:28:58 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 34B076B008C; Wed, 14 Aug 2024 16:28:58 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2609B6B0092; Wed, 14 Aug 2024 16:28:58 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id F3A946B008A for ; Wed, 14 Aug 2024 16:28:57 -0400 (EDT) Received: from smtpin04.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id A0E44A809B for ; Wed, 14 Aug 2024 20:28:57 +0000 (UTC) X-FDA: 82451989914.04.56CEA62 Received: from out-175.mta0.migadu.com (out-175.mta0.migadu.com [91.218.175.175]) by imf04.hostedemail.com (Postfix) with ESMTP id F0E2F40011 for ; Wed, 14 Aug 2024 20:28:55 +0000 (UTC) Authentication-Results: imf04.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b="mZtHF/+X"; spf=pass (imf04.hostedemail.com: domain of shakeel.butt@linux.dev designates 91.218.175.175 as permitted sender) smtp.mailfrom=shakeel.butt@linux.dev; dmarc=pass (policy=none) header.from=linux.dev ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1723667264; 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-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=8pUIHp5n0Uar92kH9etH8g4haQHVbq2z8GQwWBMKVbI=; b=36jIUsMfa7/F/TgNkKiBWgx4JSKr9dAlRmT0wtYYHtxtsWzGMJSzQYEwZelEwHtLdQsYNs uvU3j9mtUQXnhcrLucr1tl+a9pFH6zBvBlya7IALyB/G9jkwtTCfBkQYR1hzUKSm90sKSF NCCqLXdOlXxFMyUHDKgleqfAXco2cdI= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1723667264; a=rsa-sha256; cv=none; b=xvDC+Ia5kGGU5zZVEOWbX3lRo5jPR6LVDe+MR7e3qs0iN1SaFD7RQVIJZcNm2Q5F6bKumV 0Bske7WoMny+k1vtZtT94BS0q9z278tQE3UciJnEpLvOgGgLGVT5C+6EsKKhSekD+vuQhy Pz+hJKjq/8Gi5YO7bkSBX8QO9nNeXdE= ARC-Authentication-Results: i=1; imf04.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b="mZtHF/+X"; spf=pass (imf04.hostedemail.com: domain of shakeel.butt@linux.dev designates 91.218.175.175 as permitted sender) smtp.mailfrom=shakeel.butt@linux.dev; dmarc=pass (policy=none) header.from=linux.dev X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1723667333; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=8pUIHp5n0Uar92kH9etH8g4haQHVbq2z8GQwWBMKVbI=; b=mZtHF/+X+qPTZcKMFtclAXikUnNlfUnwTEG4tmMmgOnlawA/B7BHf93jTy2dB5PmVWzF+K 83+QCsTr39iKyFqluczw4EnCKNFyRrQSJyD9+RRQwFrUxEWYBb5TLwf3MV28ldF0WzTUtH Y0QfkRW+ayHV894fjUUljDs+3fwec5w= From: Shakeel Butt To: Andrew Morton Cc: Johannes Weiner , Michal Hocko , Roman Gushchin , Muchun Song , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Meta kernel team , cgroups@vger.kernel.org Subject: [PATCH 2/4] memcg: initiate deprecation of v1 soft limit Date: Wed, 14 Aug 2024 13:28:23 -0700 Message-ID: <20240814202825.2694077-3-shakeel.butt@linux.dev> In-Reply-To: <20240814202825.2694077-1-shakeel.butt@linux.dev> References: <20240814202825.2694077-1-shakeel.butt@linux.dev> MIME-Version: 1.0 X-Migadu-Flow: FLOW_OUT X-Rspam-User: X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: F0E2F40011 X-Stat-Signature: km1ka53cnxhmcyytjd1wct4gbh73trsa X-HE-Tag: 1723667335-428359 X-HE-Meta: U2FsdGVkX18H5+9FU7ztzqa/mzzEWpW3DDVsYIeAqyrhmrP2HlU2ESDrtCMpZXUk0QELZBhqu9+uiA8Ni6gDNfroUSN86/FFyLZlAo3z18Zlcy+m1XN2qRMrFfU8L0ZBxGBirdsHemIGNgA0m1UQA83AnlH9QtZGnqp1f8wGk+BsU2cBAdtiZaDRg3SbHPmEimJXJbpdL/oEQUPOQCHFcsTQpf4T8Rd5+q5g1LyXosL7aJxDGB+M1yTWatRd/6cEIL1A/b6yTxHuEHrEDA8S/wIYhrG+FR2H1K3eXNBx+mlSZOuWUog9H9YvTmkqRlW0ZfuBv+lvYTRM86BTGmureakET7jtlfQn4sozBrQ27JLMQrBvlkVt+1+XJJfXdie4h/ZgsJeN+ew1mIuclVzOGE/5ykcJLx0347sAn2dKsyJMoVM6AmimbtywXA9yb3Lo8ddFUr5opD7en8RjkiinphNxPa0sgr4+brVKr9DYiN/kR7EXq9j8mYY34UrzAaecT1RYMJuI5pkybghTv3Ap67jmWrcRdEziw5VjtjXLkMewOrlSkL6pf0HoGK85VMK2oMcGGOyvLx4uFgYjtAPdTfTFtRteyoqzdD6eO9Jc4/wuVBtva348NBy7wATc4JaoQiBSoMzEYpEJSBpvo7kdzNDb3ZjS6rWMK00GMQa2b/e5Ku7e924oBBKL63W/zVj909cNLEN1t8PDwcMQYOfPjau0JzKEk/nWK2qK4ndyd/f82KpdxjXv7JDco8cWYkLfGtrslPr+XYiWE7TFHVKPzAsyoxkAA45LpjxW0gUMEx+NZYZwsJnMmky29XJendS8uQDBC+w95DKzFcO/fgnhUj1Zj3byFFpwuTwVpmibfn/IleBlE5DMZ5nbhZ99y2QbIvsTQ1f5dU3Hw9xv8pcNKrwKX9WZ7yjgnAoNMUVk5pbjE2N6Nn6vQlIbddpsV33/wydu0xKQ2GsFWVludLA XQOaiVWk DiWU1Nc+fAhuErHAEtYh3ObNnH9PuB02d2k2zkfYM9eOY0Ytd1YuuZDwEIcacePh94OoXSWbmelExBg9X6Xe0xTBzrGSn9E5ZTVE8eUlmhwK8ay3R72770qgnabKCFK8Yb3j0FDKbKrxvyeWHT6BpovrHPgoWxpy/y3AphOd6cVNzf7Q= 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: Memcg v1 provides soft limit functionality for the best effort memory sharing between multiple workloads on a system. It is usually triggered through kswapd and at the moment does not reclaim kernel memory. Memcg v2 provide more straightforward best effort (memory.low) and hard protection (memory.min) functionalities. Let's initiate the deprecation of soft limit from v1 and gather if v2 needs something more to move the existing v1 users to v2 regarding soft limit. Signed-off-by: Shakeel Butt --- Documentation/admin-guide/cgroup-v1/memory.rst | 8 ++++++-- mm/memcontrol-v1.c | 3 +++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/Documentation/admin-guide/cgroup-v1/memory.rst b/Documentation/admin-guide/cgroup-v1/memory.rst index fb6d3e2a6395..afe5e95e9f7b 100644 --- a/Documentation/admin-guide/cgroup-v1/memory.rst +++ b/Documentation/admin-guide/cgroup-v1/memory.rst @@ -78,6 +78,8 @@ Brief summary of control files. memory.memsw.max_usage_in_bytes show max memory+Swap usage recorded memory.soft_limit_in_bytes set/show soft limit of memory usage This knob is not available on CONFIG_PREEMPT_RT systems. + This knob is deprecated and shouldn't be + used. memory.stat show various statistics memory.use_hierarchy set/show hierarchical account enabled This knob is deprecated and shouldn't be @@ -701,8 +703,10 @@ For compatibility reasons writing 1 to memory.use_hierarchy will always pass:: # echo 1 > memory.use_hierarchy -7. Soft limits -============== +7. Soft limits (DEPRECATED) +=========================== + +THIS IS DEPRECATED! Soft limits allow for greater sharing of memory. The idea behind soft limits is to allow control groups to use as much of the memory as needed, provided diff --git a/mm/memcontrol-v1.c b/mm/memcontrol-v1.c index b8e2ee454eaa..e0bb54e42011 100644 --- a/mm/memcontrol-v1.c +++ b/mm/memcontrol-v1.c @@ -2458,6 +2458,9 @@ static ssize_t mem_cgroup_write(struct kernfs_open_file *of, if (IS_ENABLED(CONFIG_PREEMPT_RT)) { ret = -EOPNOTSUPP; } else { + pr_warn_once("soft_limit_in_bytes is deprecated and will be removed. " + "Please report your usecase to linux-mm@kvack.org if you " + "depend on this functionality.\n"); WRITE_ONCE(memcg->soft_limit, nr_pages); ret = 0; }