Home » Mailing lists » Devel » [PATCH v5 00/14] kmem controller for memcg.
[PATCH v5 11/14] memcg: allow a memcg with kmem charges to be destructed. [message #48397 is a reply to message #48393] |
Tue, 16 October 2012 10:16   |
Glauber Costa
Messages: 916 Registered: October 2011
|
Senior Member |
|
|
Because the ultimate goal of the kmem tracking in memcg is to track slab
pages as well, we can't guarantee that we'll always be able to point a
page to a particular process, and migrate the charges along with it -
since in the common case, a page will contain data belonging to multiple
processes.
Because of that, when we destroy a memcg, we only make sure the
destruction will succeed by discounting the kmem charges from the user
charges when we try to empty the cgroup.
Signed-off-by: Glauber Costa <glommer@parallels.com>
Acked-by: Kamezawa Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Reviewed-by: Michal Hocko <mhocko@suse.cz>
CC: Christoph Lameter <cl@linux.com>
CC: Pekka Enberg <penberg@cs.helsinki.fi>
CC: Johannes Weiner <hannes@cmpxchg.org>
CC: Suleiman Souhlal <suleiman@google.com>
CC: Tejun Heo <tj@kernel.org>
---
mm/memcontrol.c | 17 ++++++++++++++++-
1 file changed, 16 insertions(+), 1 deletion(-)
diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 1dd31a1..9086cf2 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -544,6 +544,11 @@ static void disarm_kmem_keys(struct mem_cgroup *memcg)
{
if (memcg_kmem_is_active(memcg))
static_key_slow_dec(&memcg_kmem_enabled_key);
+ /*
+ * This check can't live in kmem destruction function,
+ * since the charges will outlive the cgroup
+ */
+ WARN_ON(res_counter_read_u64(&memcg->kmem, RES_USAGE) != 0);
}
#else
static void disarm_kmem_keys(struct mem_cgroup *memcg)
@@ -3993,6 +3998,7 @@ static int mem_cgroup_force_empty(struct mem_cgroup *memcg, bool free_all)
int node, zid, shrink;
int nr_retries = MEM_CGROUP_RECLAIM_RETRIES;
struct cgroup *cgrp = memcg->css.cgroup;
+ u64 usage;
css_get(&memcg->css);
@@ -4026,8 +4032,17 @@ move_account:
mem_cgroup_end_move(memcg);
memcg_oom_recover(memcg);
cond_resched();
+ /*
+ * Kernel memory may not necessarily be trackable to a specific
+ * process. So they are not migrated, and therefore we can't
+ * expect their value to drop to 0 here.
+ *
+ * having res filled up with kmem only is enough
+ */
+ usage = res_counter_read_u64(&memcg->res, RES_USAGE) -
+ res_counter_read_u64(&memcg->kmem, RES_USAGE);
/* "ret" should also be checked to ensure all lists are empty. */
- } while (res_counter_read_u64(&memcg->res, RES_USAGE) > 0 || ret);
+ } while (usage > 0 || ret);
out:
css_put(&memcg->css);
return ret;
--
1.7.11.7
|
|
|
 |
|
[PATCH v5 00/14] kmem controller for memcg.
|
 |
|
[PATCH v5 03/14] memcg: change defines to an enum
|
 |
|
Re: [PATCH v5 03/14] memcg: change defines to an enum
|
 |
|
[PATCH v5 01/14] memcg: Make it possible to use the stock for more than one page.
|
 |
|
Re: [PATCH v5 01/14] memcg: Make it possible to use the stock for more than one page.
By: akpm on Wed, 17 October 2012 22:11
|
 |
|
Re: [PATCH v5 01/14] memcg: Make it possible to use the stock for more than one page.
|
 |
|
[PATCH v5 04/14] kmem accounting basic infrastructure
|
 |
|
Re: [PATCH v5 04/14] kmem accounting basic infrastructure
|
 |
|
Re: [PATCH v5 04/14] kmem accounting basic infrastructure
|
 |
|
Re: [PATCH v5 04/14] kmem accounting basic infrastructure
|
 |
|
Re: [PATCH v5 04/14] kmem accounting basic infrastructure
|
 |
|
Re: [PATCH v5 04/14] kmem accounting basic infrastructure
|
 |
|
Re: [PATCH v5 04/14] kmem accounting basic infrastructure
By: akpm on Wed, 17 October 2012 22:12
|
 |
|
Re: [PATCH v5 04/14] kmem accounting basic infrastructure
|
 |
|
[PATCH v5 11/14] memcg: allow a memcg with kmem charges to be destructed.
|
 |
|
Re: [PATCH v5 11/14] memcg: allow a memcg with kmem charges to be destructed.
By: akpm on Wed, 17 October 2012 22:12
|
 |
|
Re: [PATCH v5 11/14] memcg: allow a memcg with kmem charges to be destructed.
|
 |
|
[PATCH v5 06/14] memcg: kmem controller infrastructure
|
 |
|
Re: [PATCH v5 06/14] memcg: kmem controller infrastructure
|
 |
|
Re: [PATCH v5 06/14] memcg: kmem controller infrastructure
By: akpm on Wed, 17 October 2012 22:12
|
 |
|
Re: [PATCH v5 06/14] memcg: kmem controller infrastructure
|
 |
|
Re: [PATCH v5 06/14] memcg: kmem controller infrastructure
|
 |
|
Re: [PATCH v5 06/14] memcg: kmem controller infrastructure
|
 |
|
Re: [PATCH v5 06/14] memcg: kmem controller infrastructure
|
 |
|
Re: [PATCH v5 06/14] memcg: kmem controller infrastructure
|
 |
|
Re: [PATCH v5 06/14] memcg: kmem controller infrastructure
|
 |
|
Re: [PATCH v5 06/14] memcg: kmem controller infrastructure
|
 |
|
Re: [PATCH v5 06/14] memcg: kmem controller infrastructure
|
 |
|
Re: [PATCH v5 06/14] memcg: kmem controller infrastructure
|
 |
|
Re: [PATCH v5 06/14] memcg: kmem controller infrastructure
|
 |
|
Re: [PATCH v5 06/14] memcg: kmem controller infrastructure
|
 |
|
Re: [PATCH v5 06/14] memcg: kmem controller infrastructure
|
 |
|
Re: [PATCH v5 06/14] memcg: kmem controller infrastructure
|
 |
|
[PATCH v5 05/14] Add a __GFP_KMEMCG flag
|
 |
|
Re: [PATCH v5 05/14] Add a __GFP_KMEMCG flag
|
 |
|
Re: [PATCH v5 05/14] Add a __GFP_KMEMCG flag
|
 |
|
[PATCH v5 09/14] memcg: kmem accounting lifecycle management
|
 |
|
Re: [PATCH v5 09/14] memcg: kmem accounting lifecycle management
|
 |
|
Re: [PATCH v5 09/14] memcg: kmem accounting lifecycle management
|
 |
|
Re: [PATCH v5 09/14] memcg: kmem accounting lifecycle management
|
 |
|
[PATCH v5 10/14] memcg: use static branches when code not in use
|
 |
|
[PATCH v5 14/14] Add documentation about the kmem controller
|
 |
|
Re: [PATCH v5 14/14] Add documentation about the kmem controller
|
 |
|
Re: [PATCH v5 14/14] Add documentation about the kmem controller
|
 |
|
Re: [PATCH v5 14/14] Add documentation about the kmem controller
|
 |
|
Re: [PATCH v5 14/14] Add documentation about the kmem controller
|
 |
|
Re: [PATCH v5 14/14] Add documentation about the kmem controller
By: akpm on Wed, 17 October 2012 22:12
|
 |
|
Re: [PATCH v5 14/14] Add documentation about the kmem controller
|
 |
|
[PATCH v5 13/14] protect architectures where THREAD_SIZE >= PAGE_SIZE against fork bombs
|
 |
|
Re: [PATCH v5 13/14] protect architectures where THREAD_SIZE >= PAGE_SIZE against fork bombs
By: akpm on Wed, 17 October 2012 22:12
|
 |
|
Re: [PATCH v5 13/14] protect architectures where THREAD_SIZE >= PAGE_SIZE against fork bombs
|
 |
|
[PATCH v5 07/14] mm: Allocate kernel pages to the right memcg
|
 |
|
Re: [PATCH v5 07/14] mm: Allocate kernel pages to the right memcg
|
 |
|
Re: [PATCH v5 07/14] mm: Allocate kernel pages to the right memcg
|
 |
|
Re: [PATCH v5 07/14] mm: Allocate kernel pages to the right memcg
By: akpm on Wed, 17 October 2012 22:12
|
 |
|
Re: [PATCH v5 07/14] mm: Allocate kernel pages to the right memcg
|
 |
|
Re: [PATCH v5 07/14] mm: Allocate kernel pages to the right memcg
By: akpm on Thu, 18 October 2012 20:44
|
 |
|
Re: [PATCH v5 07/14] mm: Allocate kernel pages to the right memcg
|
 |
|
Re: [PATCH v5 07/14] mm: Allocate kernel pages to the right memcg
|
 |
|
Re: [PATCH v5 00/14] kmem controller for memcg.
By: akpm on Wed, 17 October 2012 22:11
|
 |
|
Re: [PATCH v5 00/14] kmem controller for memcg.
|
 |
|
Re: [PATCH v5 00/14] kmem controller for memcg.
By: akpm on Thu, 18 October 2012 19:21
|
 |
|
Re: [PATCH v5 00/14] kmem controller for memcg.
|
Goto Forum:
Current Time: Sun Aug 24 10:49:11 GMT 2025
Total time taken to generate the page: 0.05885 seconds
|