From patchwork Wed Aug 14 20:28:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shakeel Butt X-Patchwork-Id: 13763931 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 26E56C52D7F for ; Wed, 14 Aug 2024 20:29:10 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B15466B0095; Wed, 14 Aug 2024 16:29:09 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id AC5BE6B0096; Wed, 14 Aug 2024 16:29:09 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9B3BC6B0098; Wed, 14 Aug 2024 16:29:09 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 7D3AD6B0095 for ; Wed, 14 Aug 2024 16:29:09 -0400 (EDT) Received: from smtpin28.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 443A54123F for ; Wed, 14 Aug 2024 20:29:09 +0000 (UTC) X-FDA: 82451990418.28.93B828B Received: from out-186.mta1.migadu.com (out-186.mta1.migadu.com [95.215.58.186]) by imf01.hostedemail.com (Postfix) with ESMTP id ED98540017 for ; Wed, 14 Aug 2024 20:29:05 +0000 (UTC) Authentication-Results: imf01.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=uYIww40y; spf=pass (imf01.hostedemail.com: domain of shakeel.butt@linux.dev designates 95.215.58.186 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=1723667250; 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=3eCpg6JY4xdfuSX+uQFFlngNTZJeJ79jR/+n8cnnPGg=; b=gkRR3q6UwU/kZh5XkX9SYGe5S5dbhFYjeUWiM4j1tuwEkxaYDAc7X9+Cp6oZFIjMEGGO20 A4Wu3D0s91AVaSgfzDclsDa4pm5wMjeCHcYgRSb5xX7soDqFxUKljhwZtM985VEv1rnZFd w+XkRAYI3JsXV1Vt04jTqo9M1MTNiag= ARC-Authentication-Results: i=1; imf01.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=uYIww40y; spf=pass (imf01.hostedemail.com: domain of shakeel.butt@linux.dev designates 95.215.58.186 as permitted sender) smtp.mailfrom=shakeel.butt@linux.dev; dmarc=pass (policy=none) header.from=linux.dev ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1723667250; a=rsa-sha256; cv=none; b=d8o63lvlvXEgLsyKOtdccT1Pzc+CrqH6CRAE462P3v3PisszCz3NKYsKrnmaBdn1XnqtNo H89qVx+eogMDrLfQ3B1mtU+2cGdNY8Bl5Q4n7dU0yUOyE8QUEY4D21XKgTc0ZD1eXIy2TB k2w3zr2KtyVE5kUw5yX5L5G5ugfsCVQ= 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=1723667344; 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=3eCpg6JY4xdfuSX+uQFFlngNTZJeJ79jR/+n8cnnPGg=; b=uYIww40yZ2Xis6U+cV8wV/Qs15VdbFr767xvkUF6MKj22Z5GbZZ3gW76QyP813dZJJC4cN MmTNF4nMADLnjKP+viVJokLJazSp/Zr/b+oElSTlj+7+bo5blba50dZR8ER7c/fKvtdwrG 2YVGk1D8gSWKSpDZE6ngs16vo+I9uI4= 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 4/4] memcg: initiate deprecation of pressure_level Date: Wed, 14 Aug 2024 13:28:25 -0700 Message-ID: <20240814202825.2694077-5-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-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: ED98540017 X-Stat-Signature: 99hmhipt85cbp7p4u1ys3beh9aurytr3 X-Rspam-User: X-HE-Tag: 1723667345-887012 X-HE-Meta: U2FsdGVkX19uQFJSa6+0pn9YxxpqdU60Hux5c4elNkny34v/1hYItNV9os/gqqghUfHa7oIIo41KX7h1t2qg4n8pm7yv5zpnRLc4Rrjm2T1nddrvyNdyahObYXSMYpFBn6kKx8ZfMRU2hQxsyN2kzaB3lzpgATjgnaRX5Adi81SArz8Nq7P8A0Gr7gZMVBZxUt0V1ARs9nnZvteA3LK5euCwgl40GIsU3GWrY3zcC3FpzlTC0sMvReEB+w6Qs8BpBkYy3U/QwMFRRJzxG7qza2dZzeQfLmqHCfcyH0epcHt55YL7Ckpn/d9+SKinpwixjRX7Dy1vs0jbhzYoM3zxzgjNvdGBcB8heIPux4mWf++y/I5qEHYWg2yfDChJ9LZBAbBwnt49mT9yRLueO6OeelQl1FQOGnGTyk5rIQ/C7ot3Vi9p09A6GPk4cUDN5d6+0Oz13G6V24D8eX1ii5+mktTkVonriQFf9yzcinIQNaIAE5SGKFk9Q54TixX7RFY04FwmiCcUvLMsO0vo4SAwSClMv5sFtCUaKBdf26DtLDSzk2qbtLP/7wAbJc/GPU/TMBuCN5pucs4WiNkPu5iqZaMqD+MJyLR6K7vuSy1rZ0Px4U17wcX4omKn4WGW+9lgXFR8jbxCB20k/g3Tn4KbqeV4VlQatMKNC0mnOHNDw/Ms6CyQoeHW0VqdZ22lRwodMbzYoXUT5apgo+aKCvB3GZM7wYNuHfXufDglZRtSucI8N6Zc4vPx1iVZG0Zdb2st/Z6N80tcfwrMugknKd03ElxxWObnvR4cSenODNGpMEGYVO7nDOiM3BMK40v53RGgSESNJZP0dqZ3h0xLI6KC06XmUzRD2BaX7VFselbJSJ+nAfyBKZJkxyxYPbEiqiR/9yG5oTEPDQgEc2QGCvwd44PDoYsbDpHrWAAeuzMe75yNOrhyRbVkD2OS1CFXsQ1MbWXgU1Zf2ic1XA3QNOJ lRJxfYXj HrQWYqnrdalMM8d+JRo+7B27tzR1lS/qJXX4qdkvdEoyz9enyTIo8cIhPAIxfWc7Fx68/QdChpLpahPbIMF86eod82sTb8erhDjCAVnon3uqNXfRpyiwOA2BrtxCbt7ezcpVWKVtf32DuylzaLdEA1CjqoQCEQ7EQc5KKrrvFfRX14OWl+UKBbApZC7UOZYNH67BuuZlJHTUmBscw2UjOCxR5Dw== 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: The pressure_level in memcg v1 provides memory pressure notifications to the user space. At the moment it provides notifications for three levels of memory pressure i.e. low, medium and critical, which are defined based on internal memory reclaim implementation details. More specifically the ratio or scanned and reclaimed pages during a memory reclaim. However this is not robust as there are workloads with mostly unreclaimable user memory or kernel memory. For v2, the users can use PSI for memory pressure status of the system or the cgroup. Let's start the deprecation process for pressure_level and add warnings to gather the info on how the current users are using this interface and how they can be used to PSI. 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 74cea6712d06..8ec1faf08b6b 100644 --- a/Documentation/admin-guide/cgroup-v1/memory.rst +++ b/Documentation/admin-guide/cgroup-v1/memory.rst @@ -86,6 +86,8 @@ Brief summary of control files. used. memory.force_empty trigger forced page reclaim memory.pressure_level set memory pressure notifications + This knob is deprecated and shouldn't be + used. memory.swappiness set/show swappiness parameter of vmscan (See sysctl's vm.swappiness) memory.move_charge_at_immigrate set/show controls of moving charges @@ -898,8 +900,10 @@ At reading, current status of OOM is shown. The number of processes belonging to this cgroup killed by any kind of OOM killer. -11. Memory Pressure -=================== +11. Memory Pressure (DEPRECATED) +================================ + +THIS IS DEPRECATED! The pressure level notifications can be used to monitor the memory allocation cost; based on the pressure, applications can implement diff --git a/mm/memcontrol-v1.c b/mm/memcontrol-v1.c index 07343e338e4e..420c7d15f12a 100644 --- a/mm/memcontrol-v1.c +++ b/mm/memcontrol-v1.c @@ -1913,6 +1913,9 @@ static ssize_t memcg_write_event_control(struct kernfs_open_file *of, event->register_event = mem_cgroup_oom_register_event; event->unregister_event = mem_cgroup_oom_unregister_event; } else if (!strcmp(name, "memory.pressure_level")) { + pr_warn_once("pressure_level is deprecated and will be removed. " + "Please report your usecase to linux-mm-@kvack.org " + "if you depend on this functionality. \n"; event->register_event = vmpressure_register_event; event->unregister_event = vmpressure_unregister_event; } else if (!strcmp(name, "memory.memsw.usage_in_bytes")) {