Blob Blame History Raw
From 3d9f66f9e8daad0e706de84e1b79396bc8023237 Mon Sep 17 00:00:00 2001
From: Michal Hocko <mhocko@suse.cz>
Date: Wed, 14 May 2014 10:56:59 +0200
Subject: [PATCH 1/2] memcg: deprecate memory.force_empty knob
Patch-mainline: never, it has been dropped
References: bnc#878274

mhocko@suse.cz:
The patch hasn't been accepted in the end because all the knobs are
reconsidered in the new unified hierarchy API where this knob is not
present. The warning is not harmfull and should catch potential users
so we will keep it anyway.

force_empty has been introduced primarily to drop memory before it gets
reparented on the group removal.  This alone doesn't sound fully justified
because reparented pages which are not in use can be reclaimed also later
when there is a memory pressure on the parent level.

Mark the knob CFTYPE_INSANE which tells the cgroup core that it shouldn't
create the knob with the experimental sane_behavior.  Other users will get
informed about the deprecation and asked to tell us more because I do not
expect most users will use sane_behavior cgroups mode very soon.

Anyway I expect that most users will be simply cgroup remove handlers
which do that since ever without having any good reason for it.

If somebody really cares because reparented pages, which would be dropped
otherwise, push out more important ones then we should fix the reparenting
code and put pages to the tail.

[akpm: s/pr_info/pr_info_once/]
[akpm: fix garbled printk text]
Signed-off-by: Michal Hocko <mhocko@suse.cz>
Acked-by: Johannes Weiner <hannes@cmpxchg.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

---
 Documentation/admin-guide/cgroup-v1/memory.rst |    3 +++
 mm/memcontrol.c                                |    4 ++++
 2 files changed, 7 insertions(+)

--- a/Documentation/admin-guide/cgroup-v1/memory.rst
+++ b/Documentation/admin-guide/cgroup-v1/memory.rst
@@ -532,6 +532,9 @@ About use_hierarchy, see Section 6.
 
   About use_hierarchy, see Section 6.
 
+  Please note that this knob is considered deprecated and will be removed
+  in future.
+
 5.2 stat file
 -------------
 
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -3152,6 +3152,10 @@ static ssize_t mem_cgroup_force_empty_wr
 
 	if (mem_cgroup_is_root(memcg))
 		return -EINVAL;
+	pr_info_once("%s (%d): memory.force_empty is deprecated and will be "
+		     "removed.  Let us know if it is needed in your usecase at "
+		     "linux-mm@kvack.org\n",
+		     current->comm, task_pid_nr(current));
 	return mem_cgroup_force_empty(memcg) ?: nbytes;
 }