From nobody Sun Feb 8 01:30:56 2026 Received: from out-177.mta1.migadu.com (out-177.mta1.migadu.com [95.215.58.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E6FDE13A418 for ; Wed, 14 Aug 2024 22:00:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.177 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723672832; cv=none; b=uA3DgJjgVgQbxanR95H9h6xPWA23hfkFVCsrjjy35LZHsG2zKj+ZUB9l9u+McSIKxdh0icJgIktL4QYuTwy5+ljBMIBKxqVjrqTHoZAIs/sO2cQcH/leXj6sMREoQOV8yFdSstXGAxFIRzkjhjl0qKWshwQJg3M41WWdPc6tV1Q= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723672832; c=relaxed/simple; bh=eYlMSthMiGu/5Moa/ziHx0rMfzWpxOnwtFWkMfZn/k4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=pZN66wwUv5CfjeODbuAZiGePK6pNGzhhMFgMePtKwAFeiNhgvz6mhTnukGDeL1jNi4mnRgC1AjflXkdNbn+WK28T01qhlDhb6HXNDpbDhVAmDJTwvGmOO3+vverkE42+Iipa6sH2jxO6sbzNjhd7/j9dBzoCgBHqq57tEqpXR1M= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=k9XxL/qK; arc=none smtp.client-ip=95.215.58.177 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="k9XxL/qK" 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=1723672828; 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=Sz+pgwG6Tx1uUhOGcclu4o7yKd27wktU4rb6DA6XtvQ=; b=k9XxL/qKt4zG1aGG3dBCyAmd5Sr42RvCEY0LaEM5mhGJOs3iQS7NWyg16PZugFZD70n2/F 5+lrHgDm6NgICmu3CH9OMHq38yZUFvuCOSBlGCyH6GGhlHYNo2MY4XW3AS6uwM8oVsiXdU O58UoLfoOb4+zfQgfOUYIDw3Nw1MyXE= 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 1/4] memcg: initiate deprecation of v1 tcp accounting Date: Wed, 14 Aug 2024 15:00:18 -0700 Message-ID: <20240814220021.3208384-2-shakeel.butt@linux.dev> In-Reply-To: <20240814220021.3208384-1-shakeel.butt@linux.dev> References: <20240814220021.3208384-1-shakeel.butt@linux.dev> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Migadu-Flow: FLOW_OUT Content-Type: text/plain; charset="utf-8" Memcg v1 provides opt-in TCP memory accounting feature. However it is mostly unused due to its performance impact on the network traffic. In v2, the TCP memory is accounted in the regular memory usage and is transparent to the users but they can observe the TCP memory usage through memcg stats. Let's initiate the deprecation process of memcg v1's tcp accounting functionality and add warnings to gather if there are any users and if there are, collect how they are using it and plan to provide them better alternative in v2. Signed-off-by: Shakeel Butt Reviewed-by: T.J. Mercier Acked-by: Michal Hocko Acked-by: Roman Gushchin --- Changes since v1: - Fix documentation Documentation/admin-guide/cgroup-v1/memory.rst | 8 ++++++++ mm/memcontrol-v1.c | 3 +++ 2 files changed, 11 insertions(+) diff --git a/Documentation/admin-guide/cgroup-v1/memory.rst b/Documentation= /admin-guide/cgroup-v1/memory.rst index 9cde26d33843..0114d758beab 100644 --- a/Documentation/admin-guide/cgroup-v1/memory.rst +++ b/Documentation/admin-guide/cgroup-v1/memory.rst @@ -105,10 +105,18 @@ Brief summary of control files. memory.kmem.max_usage_in_bytes show max kernel memory usage recorded =20 memory.kmem.tcp.limit_in_bytes set/show hard limit for tcp buf memory + This knob is deprecated and shouldn't= be + used. memory.kmem.tcp.usage_in_bytes show current tcp buf memory allocation + This knob is deprecated and shouldn't= be + used. memory.kmem.tcp.failcnt show the number of tcp buf memory usa= ge hits limits + This knob is deprecated and shouldn't= be + used. memory.kmem.tcp.max_usage_in_bytes show max tcp buf memory usage recorded + This knob is deprecated and shouldn't= be + used. =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D =20 1. History diff --git a/mm/memcontrol-v1.c b/mm/memcontrol-v1.c index 9725c731fb21..b8e2ee454eaa 100644 --- a/mm/memcontrol-v1.c +++ b/mm/memcontrol-v1.c @@ -2447,6 +2447,9 @@ static ssize_t mem_cgroup_write(struct kernfs_open_fi= le *of, ret =3D 0; break; case _TCP: + pr_warn_once("kmem.tcp.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"); ret =3D memcg_update_tcp_max(memcg, nr_pages); break; } --=20 2.43.5 From nobody Sun Feb 8 01:30:56 2026 Received: from out-178.mta0.migadu.com (out-178.mta0.migadu.com [91.218.175.178]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B86DA1494D7 for ; Wed, 14 Aug 2024 22:00:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.178 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723672834; cv=none; b=qqPfg4K5Tsbq7sWHdWAZC55hvrvzDiJQM724Zd3v+0sXQQW4ofp3Zdl65DewZgW4enPmF3nwxRvouOlUPB9FPdKcu+r1AKbg2Z4hSJ3Y+DIGiphSvpG2DYUKuu8TtlKEZXyywbrBhSqpaoW9RaapkKeVfCFlylA34ma9fOqmtQE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723672834; c=relaxed/simple; bh=7wWPttm3aZ9icfz+5PbT8iv5ss9RlWE+/HX28OrIEEk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=NSwwSGizPgZLrpENSpY9XSCgfY20eWqTwGjtX9AM9J44eyHaulH3kc7FTnV1Exo+zfPeAWDECPI4v18fy6we4X3V3La/79ZFzvNycjFTFkbiKT+k80Mi6KErntpe080poxvH6aSeval6/xGU6J83QnYyvgTSGu4M04zKpeEJ2sI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=wa4X42Rw; arc=none smtp.client-ip=91.218.175.178 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="wa4X42Rw" 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=1723672830; 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=CoKWYd7P/AKTgOxnO9z4vGUx2mh73AJSsiyA7cwqTAU=; b=wa4X42Rwt2kklgTFcAFXO/x/P5VKRQaJFoHFUwFYe4F6hsjQgaSSwKJXTPjuw7wjLUxeYX z8WHwVh0omw5zZdhINdF8S5R0v9ooyocSSy2i3Z9o5cVebyScNQVLRvrhbegTOVl3Vg5zK G69KtcTWY5BZ2dUv/cevweIOqDFOjss= 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 2/4] memcg: initiate deprecation of v1 soft limit Date: Wed, 14 Aug 2024 15:00:19 -0700 Message-ID: <20240814220021.3208384-3-shakeel.butt@linux.dev> In-Reply-To: <20240814220021.3208384-1-shakeel.butt@linux.dev> References: <20240814220021.3208384-1-shakeel.butt@linux.dev> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Migadu-Flow: FLOW_OUT Content-Type: text/plain; charset="utf-8" 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 Acked-by: Michal Hocko Acked-by: Roman Gushchin Reviewed-by: T.J. Mercier --- Changes since v1: - N/A 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 0114d758beab..6831c6c16e3f 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_hier= archy will always pass:: =20 # echo 1 > memory.use_hierarchy =20 -7. Soft limits -=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D +7. Soft limits (DEPRECATED) +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D + +THIS IS DEPRECATED! =20 Soft limits allow for greater sharing of memory. The idea behind soft limi= ts 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_fi= le *of, if (IS_ENABLED(CONFIG_PREEMPT_RT)) { ret =3D -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 =3D 0; } --=20 2.43.5 From nobody Sun Feb 8 01:30:56 2026 Received: from out-189.mta1.migadu.com (out-189.mta1.migadu.com [95.215.58.189]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 388D614A609 for ; Wed, 14 Aug 2024 22:00:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.189 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723672838; cv=none; b=HLfhcpYSqIxTKKHeLh5b5jHgNtYtCfBPHMcmTbN7/jODWOu75uUvyw/NuNI1ntcDaO6Rk9n12O53kMgUHiJmIY5drbFAJRtU6PtQMShf5/tU+O/d0wDqIAQQwY6+dwGsVv3yBRQUCqFvtv18rT+sVFFYiaFzzqCMkwUR7r0FMKA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723672838; c=relaxed/simple; bh=4nPlmXdtET7MVF2oXpX8zknFPgJ1pueCHJDwjPJOqaY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=cJbFqapNjvz/gFOr+5//g3aBchGuVL4gaUg9C7/u3bFXBZDlH520xqU2+Rgu6KXVBpbsCq8Fv5UUVfnmeBN4e1skfDLfaWW1764QlDFqraZNb4lVu4b1tGR8pHR+pu95Y4afhBHWcVPDxsSHExeWBQEnXV2O6PfPYlO4zFSujIw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=HBHvyvqn; arc=none smtp.client-ip=95.215.58.189 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="HBHvyvqn" 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=1723672834; 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=bxBQAPwN/d0yRus9CPsgbp4gq2sSHEHQBj1gyuLTZQI=; b=HBHvyvqnJWDy2mfX8AyaYzjISdzwSgxz2cvwPXfH0XnskTfGEsloaA1BghnYM50KtOxdUo pLH2sSEIXZGGGiRvvssuaZ8nSapVbNgIOb3GN0fuNkxAI9knDZphSZMcqFUq8YXwUhtLt4 7cNR0GdTGzxwAlyo2uAsX0niIultcOA= 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 3/4] memcg: initiate deprecation of oom_control Date: Wed, 14 Aug 2024 15:00:20 -0700 Message-ID: <20240814220021.3208384-4-shakeel.butt@linux.dev> In-Reply-To: <20240814220021.3208384-1-shakeel.butt@linux.dev> References: <20240814220021.3208384-1-shakeel.butt@linux.dev> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Migadu-Flow: FLOW_OUT Content-Type: text/plain; charset="utf-8" The oom_control provides functionality to disable memcg oom-killer, notifications on oom-kill and reading the stats regarding oom-kills. This interface was mainly introduced to provide functionality for userspace oom-killers. However it is not robust enough and only supports OOM handling in the page fault path. For v2, the users can use the combination of memory.events notifications and memory.high interface to provide userspace OOM-killing functionality. Let's start the deprecation process for v1 and gather the info on how the current users are using this interface and work on providing a more robust functionality in v2. Signed-off-by: Shakeel Butt Acked-by: Michal Hocko Acked-by: Roman Gushchin 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 | 7 +++++++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/Documentation/admin-guide/cgroup-v1/memory.rst b/Documentation= /admin-guide/cgroup-v1/memory.rst index 6831c6c16e3f..0042206414c8 100644 --- a/Documentation/admin-guide/cgroup-v1/memory.rst +++ b/Documentation/admin-guide/cgroup-v1/memory.rst @@ -92,6 +92,8 @@ Brief summary of control files. This knob is deprecated and shouldn't= be used. memory.oom_control set/show oom controls. + This knob is deprecated and shouldn't= be + used. memory.numa_stat show the number of memory usage per numa node memory.kmem.limit_in_bytes Deprecated knob to set and read the k= ernel @@ -846,8 +848,10 @@ It's applicable for root and non-root cgroup. =20 .. _cgroup-v1-memory-oom-control: =20 -10. OOM Control -=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D +10. OOM Control (DEPRECATED) +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D + +THIS IS DEPRECATED! =20 memory.oom_control file is for OOM notification and other controls. =20 diff --git a/mm/memcontrol-v1.c b/mm/memcontrol-v1.c index e0bb54e42011..334a02597d9a 100644 --- a/mm/memcontrol-v1.c +++ b/mm/memcontrol-v1.c @@ -1907,6 +1907,9 @@ static ssize_t memcg_write_event_control(struct kernf= s_open_file *of, event->register_event =3D mem_cgroup_usage_register_event; event->unregister_event =3D mem_cgroup_usage_unregister_event; } else if (!strcmp(name, "memory.oom_control")) { + pr_warn_once("oom_control 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 =3D mem_cgroup_oom_register_event; event->unregister_event =3D mem_cgroup_oom_unregister_event; } else if (!strcmp(name, "memory.pressure_level")) { @@ -2754,6 +2757,10 @@ static int mem_cgroup_oom_control_write(struct cgrou= p_subsys_state *css, { struct mem_cgroup *memcg =3D mem_cgroup_from_css(css); =20 + pr_warn_once("oom_control is deprecated and will be removed. " + "Please report your usecase to linux-mm-@kvack.org if you " + "depend on this functionality. \n"); + /* cannot set to root cgroup and only 0 and 1 are allowed */ if (mem_cgroup_is_root(memcg) || !((val =3D=3D 0) || (val =3D=3D 1))) return -EINVAL; --=20 2.43.5 From nobody Sun Feb 8 01:30:56 2026 Received: from out-174.mta1.migadu.com (out-174.mta1.migadu.com [95.215.58.174]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1D24114B963 for ; Wed, 14 Aug 2024 22:00:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.174 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723672841; cv=none; b=FYeow9XQRCrXOcCNv2F+5kZlO9ZrhGfSe+sCgCDtC7Ss+GTuFyusju0V3rbJjx123Cdo7zAAqryjlhY5f+NQ10hkCxrlR+pfP8Sx5bnR9oB/1wTyqgwN/Z38mHGWmZHXNbhhO6RkMBjyddIn7DgzvCO8n25mZbXNRH+OkQY3xwI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723672841; c=relaxed/simple; bh=uvmJdKlphzCDj9J+1c4DYKQn2WXN+iiCPTHzulFPE/A=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=nLHOi44kIgFo00iFM+wR8kvUvI+EY4nDEDoeI7VN1SV/rVauqIzYMa0DhDY4vE1yJe8xYnsraJ3550QqLE/rlndl2A8exhqYkFXygv5bsOU300ZJ1XBMqTh481X0AUztzBUSazBVSOFhup0Xf6zP05UqumRMhEJgvBJXieM+uK0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=I3mM4/fd; arc=none smtp.client-ip=95.215.58.174 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="I3mM4/fd" 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> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Migadu-Flow: FLOW_OUT Content-Type: text/plain; charset="utf-8" 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 Acked-by: Michal Hocko Acked-by: Roman Gushchin 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. =20 -11. Memory Pressure -=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D +11. Memory Pressure (DEPRECATED) +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D + +THIS IS DEPRECATED! =20 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 kernf= s_open_file *of, event->register_event =3D mem_cgroup_oom_register_event; event->unregister_event =3D 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 =3D vmpressure_register_event; event->unregister_event =3D vmpressure_unregister_event; } else if (!strcmp(name, "memory.memsw.usage_in_bytes")) { --=20 2.43.5