From patchwork Wed Aug 14 22:00:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shakeel Butt X-Patchwork-Id: 13764180 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 84096C52D7F for ; Wed, 14 Aug 2024 22:00:42 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 147DE6B00AC; Wed, 14 Aug 2024 18:00:42 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 0D2C56B00AD; Wed, 14 Aug 2024 18:00:42 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id EDA9E6B00AE; Wed, 14 Aug 2024 18:00:41 -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 CE3056B00AC for ; Wed, 14 Aug 2024 18:00:41 -0400 (EDT) Received: from smtpin12.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 8B6EFC0F5C for ; Wed, 14 Aug 2024 22:00:41 +0000 (UTC) X-FDA: 82452221082.12.5C4C28A Received: from out-188.mta1.migadu.com (out-188.mta1.migadu.com [95.215.58.188]) by imf02.hostedemail.com (Postfix) with ESMTP id C6C8880029 for ; Wed, 14 Aug 2024 22:00:39 +0000 (UTC) Authentication-Results: imf02.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b="I3mM4/fd"; spf=pass (imf02.hostedemail.com: domain of shakeel.butt@linux.dev designates 95.215.58.188 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=1723672744; 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=iTKRX6spDgpXKN9MCF3Pa/WT+sJ1zV3S3bnMyq0x3A4=; b=Ei8sWcketcXSn/g1SCIU88Cn4zL5xjvu9htVVQFyzCSFQW6SonmDcpdHnB3vvPkOvSXjlU Wo/lD8T2xDt/BGZRmteEnNoguhesL6xhjuFGO1IaBW6rh55aC1fWEVdKXjkQe4SnkfkZAu j4mruLLLx7CQMD4rqkxcoNhrZbrLKoo= ARC-Authentication-Results: i=1; imf02.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b="I3mM4/fd"; spf=pass (imf02.hostedemail.com: domain of shakeel.butt@linux.dev designates 95.215.58.188 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=1723672744; a=rsa-sha256; cv=none; b=uWK3ew526ZhyOcaq764zuQrcE2DR/W+jSVqNpoSTury7vYVP5iPzJ4LZPR1upmsd850SPx pU011Fuyj2uwlRlTPZJocPh8lBPvzgbtUkIWhp0VBh2t0xlF9SVW8CyuMWKWxRjEG75n6y meN1zkUzS3N1V0ZhMEVXQ/Pt1KVSmO0= 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=1723672838; 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=iTKRX6spDgpXKN9MCF3Pa/WT+sJ1zV3S3bnMyq0x3A4=; b=I3mM4/fdtZrE8ernV/ewmEGCnnv0Puhieiwj1WeFt7TAcdjW2hGuBxWLTrIULHCnqRNurT oiZYA9pG0E2wMZrCeKPKzwJ6sgUokA9GJcg3v8HdLCGRlbVuv9sI2eyRbbfeR+5NZM6qqt YIzUsK4ItOg3v+4dIOfOEedmgWMevSs= From: Shakeel Butt To: Andrew Morton Cc: Johannes Weiner , Michal Hocko , Roman Gushchin , Muchun Song , "T . J . Mercier" , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Meta kernel team , cgroups@vger.kernel.org Subject: [PATCH v2 4/4] memcg: initiate deprecation of pressure_level Date: Wed, 14 Aug 2024 15:00:21 -0700 Message-ID: <20240814220021.3208384-5-shakeel.butt@linux.dev> In-Reply-To: <20240814220021.3208384-1-shakeel.butt@linux.dev> References: <20240814220021.3208384-1-shakeel.butt@linux.dev> MIME-Version: 1.0 X-Migadu-Flow: FLOW_OUT X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: C6C8880029 X-Stat-Signature: 5ap7155of7b39pzjnprcya5aq37cbjd9 X-Rspam-User: X-HE-Tag: 1723672839-608154 X-HE-Meta: U2FsdGVkX19ypB2lNJPE7LCogUyMVAAB9au/dSF9R1vLj56XOwxgaCYwTj0XNmDT98uBisebtlgpyMj+QBNYD6E6v2s4kJkSmZJT+ZmFAuK1dC6WZ+7BXMXVDapTLSaIhyuecvj5qhRTLpspfCWUb2/Yx1N0uqW7cQS6DMbufWM5LAxIFb2Az462cclA/fJldaq5365/j5cbu2bypWJy86aWBQHb8t1yNRdcsVRFkhFaRMaRTa28XUL1cM1GiqzlXtc21sBd24I5TZww7KJHhbLdNe5ah1fT27Lee3tQ6KT1f8H8SRR1svaWUV1BLxPsX2RFMyoJS15orOftcv/RWx2jDjloCWIEgCSJZ+BU7JpTfwxDwqEceuKZHPCT7HNjFJIOAvtAlpTMSoebEHAcz/db3w1J5PAUNRdc7hNjTqtRzuqfoBF+KRSYlaUlgSTdSEmfrpdU8Tns7o4PlTkV/mcyqkPmJCYa23ZyVeYBuv8sHCeWDhIiWMBCD7zpkEe5IcPgSYoQNJp4xbhTRq2j7vF1ZeCpyC/dHXsTguRxuGJxK4la6VbYXvGQypnJhP5bQeu9XX/etMLp/tj/51CuWOYsmyYfOdx4CcH8ZyLrXCxRLg/VVB07h9fv4TEI5mX1gIa1QGagaBhCNWvGen/Z/LfGBxZSinf1pWl3jM7hnf63FZqg/g1QEv/ff8KH3+N4kv+uCh99Xnza8n+ljJAkh6Kx7bjk/i0oNs1U+3m9s31A5yZIQOcaNmIeeh3+BTem+u+PBPrPCupDlUjYJZSOeOVtpwij5P67GfwmTh6BpmvTXRWj62E71YE/o2+XHsTkMnP6zObnAEHps7Hl3H/dYnlwUw5H2lEWV34Eahg50RNvRat6V5f5HSF6a22KlTLo+N2J8gMQpkNKR8HAq4MagsULuw4w1nDV82V2gAiNOS3hMk6q8ikE2ROCzZYE3cRIolIB6pIOsHxy+3951Va 5n5J0+7y rO49NRUwHfM311Znc5YY/gk4XpDWZCIC4b1Nt4X07SUqP4aKRUnlAd0NJWd5HUBdxlGdpin4EryKFyUNZO7YMhc1WLoWZBum0FitiEnQHfSCjCJ92Ysp1YSPL+Cff8IjjthawXCi4Afo0r/6vArdoS7jnOjrBOnchlxybyfoB7rBKop36yov0Ig2bPh/v2JoDe3wZ2W9BgwEPcSOMWP7kQor3Rw== 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 Reviewed-by: T.J. Mercier --- Changes since v1: - Fix build (T.J. Mercier) 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 0042206414c8..270501db9f4e 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 334a02597d9a..52aecdae2c28 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")) {