From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from psmtp.com (na3sys010amx196.postini.com [74.125.245.196]) by kanga.kvack.org (Postfix) with SMTP id 0BA1C6B006C for ; Mon, 29 Oct 2012 11:14:34 -0400 (EDT) Received: by mail-oa0-f41.google.com with SMTP id k14so6066082oag.14 for ; Mon, 29 Oct 2012 08:14:34 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: <1350656442-1523-12-git-send-email-glommer@parallels.com> References: <1350656442-1523-1-git-send-email-glommer@parallels.com> <1350656442-1523-12-git-send-email-glommer@parallels.com> Date: Tue, 30 Oct 2012 00:14:34 +0900 Message-ID: Subject: Re: [PATCH v5 11/18] sl[au]b: Allocate objects from memcg cache From: JoonSoo Kim Content-Type: text/plain; charset=ISO-8859-1 Sender: owner-linux-mm@kvack.org List-ID: To: Glauber Costa Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, cgroups@vger.kernel.org, Mel Gorman , Tejun Heo , Andrew Morton , Michal Hocko , Johannes Weiner , kamezawa.hiroyu@jp.fujitsu.com, Christoph Lameter , David Rientjes , Pekka Enberg , devel@openvz.org, Pekka Enberg , Suleiman Souhlal Hi, Glauber. 2012/10/19 Glauber Costa : > 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 > CC: Christoph Lameter > CC: Pekka Enberg > CC: Michal Hocko > CC: Kamezawa Hiroyuki > CC: Johannes Weiner > CC: Suleiman Souhlal > CC: Tejun Heo > --- > include/linux/slub_def.h | 15 ++++++++++----- > mm/memcontrol.c | 3 +++ > mm/slab.c | 6 +++++- > mm/slub.c | 5 +++-- > 4 files changed, 21 insertions(+), 8 deletions(-) > > diff --git a/include/linux/slub_def.h b/include/linux/slub_def.h > index 961e72e..ed330df 100644 > --- a/include/linux/slub_def.h > +++ b/include/linux/slub_def.h > @@ -13,6 +13,8 @@ > #include > > #include > +#include > +#include > > enum stat_item { > ALLOC_FASTPATH, /* Allocation from cpu slab */ > @@ -209,14 +211,14 @@ static __always_inline int kmalloc_index(size_t size) > * This ought to end up with a global pointer to the right cache > * in kmalloc_caches. > */ > -static __always_inline struct kmem_cache *kmalloc_slab(size_t size) > +static __always_inline struct kmem_cache *kmalloc_slab(gfp_t flags, size_t size) > { > int index = kmalloc_index(size); > > if (index == 0) > return NULL; > > - return kmalloc_caches[index]; > + return memcg_kmem_get_cache(kmalloc_caches[index], flags); > } You don't need this, because memcg_kmem_get_cache() is invoked in both slab_alloc() and __cache_alloc_node(). -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: email@kvack.org