diff options
author | Glauber Costa <glommer@parallels.com> | 2012-12-18 17:22:48 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-12-18 18:02:14 -0500 |
commit | d79923fad95b0cdf7770e024677180c734cb7148 (patch) | |
tree | e7cf6e9fb151d3c0d5c773fa1ba723a71b1e9329 /mm/slab.c | |
parent | b9ce5ef49f00daf2254c6953c8d31f79aabccd34 (diff) |
sl[au]b: allocate objects from memcg cache
We are able to match a cache allocation to a particular memcg. If the
task doesn't change groups during the allocation itself - a rare event,
this will give us a good picture about who is the first group to touch a
cache page.
This patch uses the now available infrastructure by calling
memcg_kmem_get_cache() before all the cache allocations.
Signed-off-by: Glauber Costa <glommer@parallels.com>
Cc: Christoph Lameter <cl@linux.com>
Cc: David Rientjes <rientjes@google.com>
Cc: Frederic Weisbecker <fweisbec@redhat.com>
Cc: Greg Thelen <gthelen@google.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: JoonSoo Kim <js1304@gmail.com>
Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: Mel Gorman <mel@csn.ul.ie>
Cc: Michal Hocko <mhocko@suse.cz>
Cc: Pekka Enberg <penberg@cs.helsinki.fi>
Cc: Rik van Riel <riel@redhat.com>
Cc: Suleiman Souhlal <suleiman@google.com>
Cc: Tejun Heo <tj@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/slab.c')
-rw-r--r-- | mm/slab.c | 6 |
1 files changed, 5 insertions, 1 deletions
@@ -1933,7 +1933,7 @@ static void kmem_freepages(struct kmem_cache *cachep, void *addr) | |||
1933 | } | 1933 | } |
1934 | if (current->reclaim_state) | 1934 | if (current->reclaim_state) |
1935 | current->reclaim_state->reclaimed_slab += nr_freed; | 1935 | current->reclaim_state->reclaimed_slab += nr_freed; |
1936 | free_pages((unsigned long)addr, cachep->gfporder); | 1936 | free_memcg_kmem_pages((unsigned long)addr, cachep->gfporder); |
1937 | } | 1937 | } |
1938 | 1938 | ||
1939 | static void kmem_rcu_free(struct rcu_head *head) | 1939 | static void kmem_rcu_free(struct rcu_head *head) |
@@ -3486,6 +3486,8 @@ slab_alloc_node(struct kmem_cache *cachep, gfp_t flags, int nodeid, | |||
3486 | if (slab_should_failslab(cachep, flags)) | 3486 | if (slab_should_failslab(cachep, flags)) |
3487 | return NULL; | 3487 | return NULL; |
3488 | 3488 | ||
3489 | cachep = memcg_kmem_get_cache(cachep, flags); | ||
3490 | |||
3489 | cache_alloc_debugcheck_before(cachep, flags); | 3491 | cache_alloc_debugcheck_before(cachep, flags); |
3490 | local_irq_save(save_flags); | 3492 | local_irq_save(save_flags); |
3491 | 3493 | ||
@@ -3571,6 +3573,8 @@ slab_alloc(struct kmem_cache *cachep, gfp_t flags, unsigned long caller) | |||
3571 | if (slab_should_failslab(cachep, flags)) | 3573 | if (slab_should_failslab(cachep, flags)) |
3572 | return NULL; | 3574 | return NULL; |
3573 | 3575 | ||
3576 | cachep = memcg_kmem_get_cache(cachep, flags); | ||
3577 | |||
3574 | cache_alloc_debugcheck_before(cachep, flags); | 3578 | cache_alloc_debugcheck_before(cachep, flags); |
3575 | local_irq_save(save_flags); | 3579 | local_irq_save(save_flags); |
3576 | objp = __do_cache_alloc(cachep, flags); | 3580 | objp = __do_cache_alloc(cachep, flags); |