linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/4] memcg: initiate deprecation of v1 features
@ 2024-08-14 20:28 Shakeel Butt
  2024-08-14 20:28 ` [PATCH 1/4] memcg: initiate deprecation of v1 tcp accounting Shakeel Butt
                   ` (3 more replies)
  0 siblings, 4 replies; 12+ messages in thread
From: Shakeel Butt @ 2024-08-14 20:28 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Johannes Weiner, Michal Hocko, Roman Gushchin, Muchun Song,
	linux-mm, linux-kernel, Meta kernel team, cgroups

Let start the deprecation process of the memcg v1 features which we
discussed during LSFMMBPF 2024 [1]. For now add the warnings to collect
the information on how the current users are using these features. Next
we will work on providing better alternatives in v2 (if needed) and
fully deprecate these features.

Link: https://lwn.net/Articles/974575 [1]

Shakeel Butt (4):
  memcg: initiate deprecation of v1 tcp accounting
  memcg: initiate deprecation of v1 soft limit
  memcg: initiate deprecation of oom_control
  memcg: initiate deprecation of pressure_level

 .../admin-guide/cgroup-v1/memory.rst          | 32 +++++++++++++++----
 mm/memcontrol-v1.c                            | 16 ++++++++++
 2 files changed, 42 insertions(+), 6 deletions(-)

-- 
2.43.5



^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH 1/4] memcg: initiate deprecation of v1 tcp accounting
  2024-08-14 20:28 [PATCH 0/4] memcg: initiate deprecation of v1 features Shakeel Butt
@ 2024-08-14 20:28 ` Shakeel Butt
  2024-08-14 20:59   ` T.J. Mercier
  2024-08-14 20:28 ` [PATCH 2/4] memcg: initiate deprecation of v1 soft limit Shakeel Butt
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 12+ messages in thread
From: Shakeel Butt @ 2024-08-14 20:28 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Johannes Weiner, Michal Hocko, Roman Gushchin, Muchun Song,
	linux-mm, linux-kernel, Meta kernel team, cgroups

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 <shakeel.butt@linux.dev>
---
 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..fb6d3e2a6395 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
 
  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 usage
+                                     This knob is deprecated and shouldn't be
+                                     used.
 				     hits limits
  memory.kmem.tcp.max_usage_in_bytes  show max tcp buf memory usage recorded
+                                     This knob is deprecated and shouldn't be
+                                     used.
 ==================================== ==========================================
 
 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_file *of,
 			ret = 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 = memcg_update_tcp_max(memcg, nr_pages);
 			break;
 		}
-- 
2.43.5



^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH 2/4] memcg: initiate deprecation of v1 soft limit
  2024-08-14 20:28 [PATCH 0/4] memcg: initiate deprecation of v1 features Shakeel Butt
  2024-08-14 20:28 ` [PATCH 1/4] memcg: initiate deprecation of v1 tcp accounting Shakeel Butt
@ 2024-08-14 20:28 ` Shakeel Butt
  2024-08-14 20:28 ` [PATCH 3/4] memcg: initiate deprecation of oom_control Shakeel Butt
  2024-08-14 20:28 ` [PATCH 4/4] memcg: initiate deprecation of pressure_level Shakeel Butt
  3 siblings, 0 replies; 12+ messages in thread
From: Shakeel Butt @ 2024-08-14 20:28 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Johannes Weiner, Michal Hocko, Roman Gushchin, Muchun Song,
	linux-mm, linux-kernel, Meta kernel team, cgroups

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 <shakeel.butt@linux.dev>
---
 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;
 		}
-- 
2.43.5



^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH 3/4] memcg: initiate deprecation of oom_control
  2024-08-14 20:28 [PATCH 0/4] memcg: initiate deprecation of v1 features Shakeel Butt
  2024-08-14 20:28 ` [PATCH 1/4] memcg: initiate deprecation of v1 tcp accounting Shakeel Butt
  2024-08-14 20:28 ` [PATCH 2/4] memcg: initiate deprecation of v1 soft limit Shakeel Butt
@ 2024-08-14 20:28 ` Shakeel Butt
  2024-08-14 21:00   ` T.J. Mercier
  2024-08-14 20:28 ` [PATCH 4/4] memcg: initiate deprecation of pressure_level Shakeel Butt
  3 siblings, 1 reply; 12+ messages in thread
From: Shakeel Butt @ 2024-08-14 20:28 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Johannes Weiner, Michal Hocko, Roman Gushchin, Muchun Song,
	linux-mm, linux-kernel, Meta kernel team, cgroups

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 <shakeel.butt@linux.dev>
---
 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 afe5e95e9f7b..74cea6712d06 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 kernel
@@ -846,8 +848,10 @@ It's applicable for root and non-root cgroup.
 
 .. _cgroup-v1-memory-oom-control:
 
-10. OOM Control
-===============
+10. OOM Control (DEPRECATED)
+============================
+
+THIS IS DEPRECATED!
 
 memory.oom_control file is for OOM notification and other controls.
 
diff --git a/mm/memcontrol-v1.c b/mm/memcontrol-v1.c
index e0bb54e42011..07343e338e4e 100644
--- a/mm/memcontrol-v1.c
+++ b/mm/memcontrol-v1.c
@@ -1907,6 +1907,9 @@ static ssize_t memcg_write_event_control(struct kernfs_open_file *of,
 		event->register_event = mem_cgroup_usage_register_event;
 		event->unregister_event = 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 = mem_cgroup_oom_register_event;
 		event->unregister_event = mem_cgroup_oom_unregister_event;
 	} else if (!strcmp(name, "memory.pressure_level")) {
@@ -2754,6 +2757,10 @@ static int mem_cgroup_oom_control_write(struct cgroup_subsys_state *css,
 {
 	struct mem_cgroup *memcg = mem_cgroup_from_css(css);
 
+	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 == 0) || (val == 1)))
 		return -EINVAL;
-- 
2.43.5



^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH 4/4] memcg: initiate deprecation of pressure_level
  2024-08-14 20:28 [PATCH 0/4] memcg: initiate deprecation of v1 features Shakeel Butt
                   ` (2 preceding siblings ...)
  2024-08-14 20:28 ` [PATCH 3/4] memcg: initiate deprecation of oom_control Shakeel Butt
@ 2024-08-14 20:28 ` Shakeel Butt
  2024-08-14 21:01   ` T.J. Mercier
  3 siblings, 1 reply; 12+ messages in thread
From: Shakeel Butt @ 2024-08-14 20:28 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Johannes Weiner, Michal Hocko, Roman Gushchin, Muchun Song,
	linux-mm, linux-kernel, Meta kernel team, cgroups

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 <shakeel.butt@linux.dev>
---
 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")) {
-- 
2.43.5



^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 1/4] memcg: initiate deprecation of v1 tcp accounting
  2024-08-14 20:28 ` [PATCH 1/4] memcg: initiate deprecation of v1 tcp accounting Shakeel Butt
@ 2024-08-14 20:59   ` T.J. Mercier
  2024-08-14 21:42     ` Shakeel Butt
  0 siblings, 1 reply; 12+ messages in thread
From: T.J. Mercier @ 2024-08-14 20:59 UTC (permalink / raw)
  To: Shakeel Butt
  Cc: Andrew Morton, Johannes Weiner, Michal Hocko, Roman Gushchin,
	Muchun Song, linux-mm, linux-kernel, Meta kernel team, cgroups

On Wed, Aug 14, 2024 at 1:28 PM Shakeel Butt <shakeel.butt@linux.dev> wrote:
>
> 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 <shakeel.butt@linux.dev>
> ---
>  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..fb6d3e2a6395 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
>
>   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 usage
> +                                     This knob is deprecated and shouldn't be
> +                                     used.
>                                      hits limits

Looks like you split the description (that has weird grammar) here.

>   memory.kmem.tcp.max_usage_in_bytes  show max tcp buf memory usage recorded
> +                                     This knob is deprecated and shouldn't be
> +                                     used.
>  ==================================== ==========================================
>
>  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_file *of,
>                         ret = 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 = memcg_update_tcp_max(memcg, nr_pages);
>                         break;
>                 }
> --
> 2.43.5
>
Otherwise LGTM
Reviewed-by: T.J. Mercier <tjmercier@google.com>


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 3/4] memcg: initiate deprecation of oom_control
  2024-08-14 20:28 ` [PATCH 3/4] memcg: initiate deprecation of oom_control Shakeel Butt
@ 2024-08-14 21:00   ` T.J. Mercier
  2024-08-14 21:41     ` Shakeel Butt
  2024-08-14 21:51     ` Andrew Morton
  0 siblings, 2 replies; 12+ messages in thread
From: T.J. Mercier @ 2024-08-14 21:00 UTC (permalink / raw)
  To: Shakeel Butt
  Cc: Andrew Morton, Johannes Weiner, Michal Hocko, Roman Gushchin,
	Muchun Song, linux-mm, linux-kernel, Meta kernel team, cgroups

On Wed, Aug 14, 2024 at 1:29 PM Shakeel Butt <shakeel.butt@linux.dev> wrote:
>
> 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 <shakeel.butt@linux.dev>
> ---
>  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 afe5e95e9f7b..74cea6712d06 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 kernel
> @@ -846,8 +848,10 @@ It's applicable for root and non-root cgroup.
>
>  .. _cgroup-v1-memory-oom-control:
>
> -10. OOM Control
> -===============
> +10. OOM Control (DEPRECATED)
> +============================
> +
> +THIS IS DEPRECATED!
>
>  memory.oom_control file is for OOM notification and other controls.
>
> diff --git a/mm/memcontrol-v1.c b/mm/memcontrol-v1.c
> index e0bb54e42011..07343e338e4e 100644
> --- a/mm/memcontrol-v1.c
> +++ b/mm/memcontrol-v1.c
> @@ -1907,6 +1907,9 @@ static ssize_t memcg_write_event_control(struct kernfs_open_file *of,
>                 event->register_event = mem_cgroup_usage_register_event;
>                 event->unregister_event = 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";

Missing close paren?

>                 event->register_event = mem_cgroup_oom_register_event;
>                 event->unregister_event = mem_cgroup_oom_unregister_event;
>         } else if (!strcmp(name, "memory.pressure_level")) {
> @@ -2754,6 +2757,10 @@ static int mem_cgroup_oom_control_write(struct cgroup_subsys_state *css,
>  {
>         struct mem_cgroup *memcg = mem_cgroup_from_css(css);
>
> +       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";
> +

Missing close paren?

>         /* cannot set to root cgroup and only 0 and 1 are allowed */
>         if (mem_cgroup_is_root(memcg) || !((val == 0) || (val == 1)))
>                 return -EINVAL;
> --
> 2.43.5
>
>


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 4/4] memcg: initiate deprecation of pressure_level
  2024-08-14 20:28 ` [PATCH 4/4] memcg: initiate deprecation of pressure_level Shakeel Butt
@ 2024-08-14 21:01   ` T.J. Mercier
  0 siblings, 0 replies; 12+ messages in thread
From: T.J. Mercier @ 2024-08-14 21:01 UTC (permalink / raw)
  To: Shakeel Butt
  Cc: Andrew Morton, Johannes Weiner, Michal Hocko, Roman Gushchin,
	Muchun Song, linux-mm, linux-kernel, Meta kernel team, cgroups

On Wed, Aug 14, 2024 at 1:29 PM Shakeel Butt <shakeel.butt@linux.dev> wrote:
>
> 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 <shakeel.butt@linux.dev>
> ---
>  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";

Missing close paren? Extra space at the end too.

>                 event->register_event = vmpressure_register_event;
>                 event->unregister_event = vmpressure_unregister_event;
>         } else if (!strcmp(name, "memory.memsw.usage_in_bytes")) {
> --
> 2.43.5
>
>


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 3/4] memcg: initiate deprecation of oom_control
  2024-08-14 21:00   ` T.J. Mercier
@ 2024-08-14 21:41     ` Shakeel Butt
  2024-08-14 21:49       ` Shakeel Butt
  2024-08-14 21:51     ` Andrew Morton
  1 sibling, 1 reply; 12+ messages in thread
From: Shakeel Butt @ 2024-08-14 21:41 UTC (permalink / raw)
  To: T.J. Mercier
  Cc: Andrew Morton, Johannes Weiner, Michal Hocko, Roman Gushchin,
	Muchun Song, linux-mm, linux-kernel, Meta kernel team, cgroups

On Wed, Aug 14, 2024 at 02:00:03PM GMT, T.J. Mercier wrote:
> On Wed, Aug 14, 2024 at 1:29 PM Shakeel Butt <shakeel.butt@linux.dev> wrote:
> >
> > 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 <shakeel.butt@linux.dev>
> > ---
> >  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 afe5e95e9f7b..74cea6712d06 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 kernel
> > @@ -846,8 +848,10 @@ It's applicable for root and non-root cgroup.
> >
> >  .. _cgroup-v1-memory-oom-control:
> >
> > -10. OOM Control
> > -===============
> > +10. OOM Control (DEPRECATED)
> > +============================
> > +
> > +THIS IS DEPRECATED!
> >
> >  memory.oom_control file is for OOM notification and other controls.
> >
> > diff --git a/mm/memcontrol-v1.c b/mm/memcontrol-v1.c
> > index e0bb54e42011..07343e338e4e 100644
> > --- a/mm/memcontrol-v1.c
> > +++ b/mm/memcontrol-v1.c
> > @@ -1907,6 +1907,9 @@ static ssize_t memcg_write_event_control(struct kernfs_open_file *of,
> >                 event->register_event = mem_cgroup_usage_register_event;
> >                 event->unregister_event = 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";
> 
> Missing close paren?

Ah, thanks for catching that. I compile tested the old version before
moving text around. Anyways, will resend.

> 
> >                 event->register_event = mem_cgroup_oom_register_event;
> >                 event->unregister_event = mem_cgroup_oom_unregister_event;
> >         } else if (!strcmp(name, "memory.pressure_level")) {
> > @@ -2754,6 +2757,10 @@ static int mem_cgroup_oom_control_write(struct cgroup_subsys_state *css,
> >  {
> >         struct mem_cgroup *memcg = mem_cgroup_from_css(css);
> >
> > +       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";
> > +
> 
> Missing close paren?
> 
> >         /* cannot set to root cgroup and only 0 and 1 are allowed */
> >         if (mem_cgroup_is_root(memcg) || !((val == 0) || (val == 1)))
> >                 return -EINVAL;
> > --
> > 2.43.5
> >
> >


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 1/4] memcg: initiate deprecation of v1 tcp accounting
  2024-08-14 20:59   ` T.J. Mercier
@ 2024-08-14 21:42     ` Shakeel Butt
  0 siblings, 0 replies; 12+ messages in thread
From: Shakeel Butt @ 2024-08-14 21:42 UTC (permalink / raw)
  To: T.J. Mercier
  Cc: Andrew Morton, Johannes Weiner, Michal Hocko, Roman Gushchin,
	Muchun Song, linux-mm, linux-kernel, Meta kernel team, cgroups

On Wed, Aug 14, 2024 at 01:59:15PM GMT, T.J. Mercier wrote:
> On Wed, Aug 14, 2024 at 1:28 PM Shakeel Butt <shakeel.butt@linux.dev> wrote:
> >
> > 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 <shakeel.butt@linux.dev>
> > ---
> >  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..fb6d3e2a6395 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
> >
> >   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 usage
> > +                                     This knob is deprecated and shouldn't be
> > +                                     used.
> >                                      hits limits
> 
> Looks like you split the description (that has weird grammar) here.
> 

Thanks for catching. Bad paste line. Will fix.

> >   memory.kmem.tcp.max_usage_in_bytes  show max tcp buf memory usage recorded
> > +                                     This knob is deprecated and shouldn't be
> > +                                     used.
> >  ==================================== ==========================================
> >
> >  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_file *of,
> >                         ret = 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 = memcg_update_tcp_max(memcg, nr_pages);
> >                         break;
> >                 }
> > --
> > 2.43.5
> >
> Otherwise LGTM
> Reviewed-by: T.J. Mercier <tjmercier@google.com>

Thanks.


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 3/4] memcg: initiate deprecation of oom_control
  2024-08-14 21:41     ` Shakeel Butt
@ 2024-08-14 21:49       ` Shakeel Butt
  0 siblings, 0 replies; 12+ messages in thread
From: Shakeel Butt @ 2024-08-14 21:49 UTC (permalink / raw)
  To: T.J. Mercier
  Cc: Andrew Morton, Johannes Weiner, Michal Hocko, Roman Gushchin,
	Muchun Song, linux-mm, linux-kernel, Meta kernel team, cgroups

On Wed, Aug 14, 2024 at 02:41:13PM GMT, Shakeel Butt wrote:
> On Wed, Aug 14, 2024 at 02:00:03PM GMT, T.J. Mercier wrote:
> > On Wed, Aug 14, 2024 at 1:29 PM Shakeel Butt <shakeel.butt@linux.dev> wrote:
> > >
> > > 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 <shakeel.butt@linux.dev>
> > > ---
> > >  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 afe5e95e9f7b..74cea6712d06 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 kernel
> > > @@ -846,8 +848,10 @@ It's applicable for root and non-root cgroup.
> > >
> > >  .. _cgroup-v1-memory-oom-control:
> > >
> > > -10. OOM Control
> > > -===============
> > > +10. OOM Control (DEPRECATED)
> > > +============================
> > > +
> > > +THIS IS DEPRECATED!
> > >
> > >  memory.oom_control file is for OOM notification and other controls.
> > >
> > > diff --git a/mm/memcontrol-v1.c b/mm/memcontrol-v1.c
> > > index e0bb54e42011..07343e338e4e 100644
> > > --- a/mm/memcontrol-v1.c
> > > +++ b/mm/memcontrol-v1.c
> > > @@ -1907,6 +1907,9 @@ static ssize_t memcg_write_event_control(struct kernfs_open_file *of,
> > >                 event->register_event = mem_cgroup_usage_register_event;
> > >                 event->unregister_event = 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";
> > 
> > Missing close paren?
> 
> Ah, thanks for catching that. I compile tested the old version before
> moving text around. Anyways, will resend.
> 

Oh I was building without CONFIG_MEMCG_V1.


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 3/4] memcg: initiate deprecation of oom_control
  2024-08-14 21:00   ` T.J. Mercier
  2024-08-14 21:41     ` Shakeel Butt
@ 2024-08-14 21:51     ` Andrew Morton
  1 sibling, 0 replies; 12+ messages in thread
From: Andrew Morton @ 2024-08-14 21:51 UTC (permalink / raw)
  To: T.J. Mercier
  Cc: Shakeel Butt, Johannes Weiner, Michal Hocko, Roman Gushchin,
	Muchun Song, linux-mm, linux-kernel, Meta kernel team, cgroups

On Wed, 14 Aug 2024 14:00:03 -0700 "T.J. Mercier" <tjmercier@google.com> wrote:

> > --- a/mm/memcontrol-v1.c
> > +++ b/mm/memcontrol-v1.c
> > @@ -1907,6 +1907,9 @@ static ssize_t memcg_write_event_control(struct kernfs_open_file *of,
> >                 event->register_event = mem_cgroup_usage_register_event;
> >                 event->unregister_event = 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";
> 
> Missing close paren?

err yes, thanks.

V2, please ;)


^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2024-08-14 21:52 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-08-14 20:28 [PATCH 0/4] memcg: initiate deprecation of v1 features Shakeel Butt
2024-08-14 20:28 ` [PATCH 1/4] memcg: initiate deprecation of v1 tcp accounting Shakeel Butt
2024-08-14 20:59   ` T.J. Mercier
2024-08-14 21:42     ` Shakeel Butt
2024-08-14 20:28 ` [PATCH 2/4] memcg: initiate deprecation of v1 soft limit Shakeel Butt
2024-08-14 20:28 ` [PATCH 3/4] memcg: initiate deprecation of oom_control Shakeel Butt
2024-08-14 21:00   ` T.J. Mercier
2024-08-14 21:41     ` Shakeel Butt
2024-08-14 21:49       ` Shakeel Butt
2024-08-14 21:51     ` Andrew Morton
2024-08-14 20:28 ` [PATCH 4/4] memcg: initiate deprecation of pressure_level Shakeel Butt
2024-08-14 21:01   ` T.J. Mercier

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox