Re: [PATCH v3 06/16] memcg: infrastructure to match an allocation to the right cache

2012-09-25 Thread Christoph Lameter
On Tue, 25 Sep 2012, Glauber Costa wrote: > >> 1) Do like the events mechanism and allocate this in a separate > >> structure. Add a pointer chase in the access, and I don't think it helps > >> much because it gets allocated anyway. But we could at least > >> defer it to the time when we limit

Re: [PATCH v3 06/16] memcg: infrastructure to match an allocation to the right cache

2012-09-25 Thread Glauber Costa
On 09/24/2012 09:56 PM, Tejun Heo wrote: > Hello, Glauber. > > On Mon, Sep 24, 2012 at 12:46:35PM +0400, Glauber Costa wrote: +#ifdef CONFIG_MEMCG_KMEM + /* Slab accounting */ + struct kmem_cache *slabs[MAX_KMEM_CACHE_TYPES]; +#endif >>> >>> Bah, 400 entry array in struct

Re: [PATCH v3 06/16] memcg: infrastructure to match an allocation to the right cache

2012-09-25 Thread Glauber Costa
On 09/24/2012 09:56 PM, Tejun Heo wrote: Hello, Glauber. On Mon, Sep 24, 2012 at 12:46:35PM +0400, Glauber Costa wrote: +#ifdef CONFIG_MEMCG_KMEM + /* Slab accounting */ + struct kmem_cache *slabs[MAX_KMEM_CACHE_TYPES]; +#endif Bah, 400 entry array in struct mem_cgroup. Can't we do

Re: [PATCH v3 06/16] memcg: infrastructure to match an allocation to the right cache

2012-09-25 Thread Christoph Lameter
On Tue, 25 Sep 2012, Glauber Costa wrote: 1) Do like the events mechanism and allocate this in a separate structure. Add a pointer chase in the access, and I don't think it helps much because it gets allocated anyway. But we could at least defer it to the time when we limit the cache.

Re: [PATCH v3 06/16] memcg: infrastructure to match an allocation to the right cache

2012-09-24 Thread Tejun Heo
On Mon, Sep 24, 2012 at 12:17:37PM +0400, Glauber Costa wrote: > On 09/22/2012 12:52 AM, Tejun Heo wrote: > > Missed some stuff. > > > > On Tue, Sep 18, 2012 at 06:12:00PM +0400, Glauber Costa wrote: > >> +static struct kmem_cache *memcg_create_kmem_cache(struct mem_cgroup > >> *memcg, > >> +

Re: [PATCH v3 06/16] memcg: infrastructure to match an allocation to the right cache

2012-09-24 Thread Tejun Heo
Hello, Glauber. On Mon, Sep 24, 2012 at 12:46:35PM +0400, Glauber Costa wrote: > >> +#ifdef CONFIG_MEMCG_KMEM > >> + /* Slab accounting */ > >> + struct kmem_cache *slabs[MAX_KMEM_CACHE_TYPES]; > >> +#endif > > > > Bah, 400 entry array in struct mem_cgroup. Can't we do something a > > bit

Re: [PATCH v3 06/16] memcg: infrastructure to match an allocation to the right cache

2012-09-24 Thread Glauber Costa
On 09/21/2012 10:32 PM, Tejun Heo wrote: > On Tue, Sep 18, 2012 at 06:12:00PM +0400, Glauber Costa wrote: >> diff --git a/mm/memcontrol.c b/mm/memcontrol.c >> index 04851bb..1cce5c3 100644 >> --- a/mm/memcontrol.c >> +++ b/mm/memcontrol.c >> @@ -339,6 +339,11 @@ struct mem_cgroup { >> #ifdef

Re: [PATCH v3 06/16] memcg: infrastructure to match an allocation to the right cache

2012-09-24 Thread Glauber Costa
On 09/22/2012 12:52 AM, Tejun Heo wrote: > Missed some stuff. > > On Tue, Sep 18, 2012 at 06:12:00PM +0400, Glauber Costa wrote: >> +static struct kmem_cache *memcg_create_kmem_cache(struct mem_cgroup *memcg, >> + struct kmem_cache *cachep) >> +{ > ...

Re: [PATCH v3 06/16] memcg: infrastructure to match an allocation to the right cache

2012-09-24 Thread Glauber Costa
On 09/22/2012 12:52 AM, Tejun Heo wrote: Missed some stuff. On Tue, Sep 18, 2012 at 06:12:00PM +0400, Glauber Costa wrote: +static struct kmem_cache *memcg_create_kmem_cache(struct mem_cgroup *memcg, + struct kmem_cache *cachep) +{ ... +

Re: [PATCH v3 06/16] memcg: infrastructure to match an allocation to the right cache

2012-09-24 Thread Glauber Costa
On 09/21/2012 10:32 PM, Tejun Heo wrote: On Tue, Sep 18, 2012 at 06:12:00PM +0400, Glauber Costa wrote: diff --git a/mm/memcontrol.c b/mm/memcontrol.c index 04851bb..1cce5c3 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c @@ -339,6 +339,11 @@ struct mem_cgroup { #ifdef CONFIG_INET

Re: [PATCH v3 06/16] memcg: infrastructure to match an allocation to the right cache

2012-09-24 Thread Tejun Heo
Hello, Glauber. On Mon, Sep 24, 2012 at 12:46:35PM +0400, Glauber Costa wrote: +#ifdef CONFIG_MEMCG_KMEM + /* Slab accounting */ + struct kmem_cache *slabs[MAX_KMEM_CACHE_TYPES]; +#endif Bah, 400 entry array in struct mem_cgroup. Can't we do something a bit more flexible?

Re: [PATCH v3 06/16] memcg: infrastructure to match an allocation to the right cache

2012-09-24 Thread Tejun Heo
On Mon, Sep 24, 2012 at 12:17:37PM +0400, Glauber Costa wrote: On 09/22/2012 12:52 AM, Tejun Heo wrote: Missed some stuff. On Tue, Sep 18, 2012 at 06:12:00PM +0400, Glauber Costa wrote: +static struct kmem_cache *memcg_create_kmem_cache(struct mem_cgroup *memcg, +

Re: [PATCH v3 06/16] memcg: infrastructure to match an allocation to the right cache

2012-09-21 Thread Tejun Heo
Missed some stuff. On Tue, Sep 18, 2012 at 06:12:00PM +0400, Glauber Costa wrote: > +static struct kmem_cache *memcg_create_kmem_cache(struct mem_cgroup *memcg, > + struct kmem_cache *cachep) > +{ ... > + memcg->slabs[idx] = new_cachep; ... >

Re: [PATCH v3 06/16] memcg: infrastructure to match an allocation to the right cache

2012-09-21 Thread Tejun Heo
On Tue, Sep 18, 2012 at 06:12:00PM +0400, Glauber Costa wrote: > diff --git a/mm/memcontrol.c b/mm/memcontrol.c > index 04851bb..1cce5c3 100644 > --- a/mm/memcontrol.c > +++ b/mm/memcontrol.c > @@ -339,6 +339,11 @@ struct mem_cgroup { > #ifdef CONFIG_INET > struct tcp_memcontrol tcp_mem; >

Re: [PATCH v3 06/16] memcg: infrastructure to match an allocation to the right cache

2012-09-21 Thread Tejun Heo
On Tue, Sep 18, 2012 at 06:12:00PM +0400, Glauber Costa wrote: diff --git a/mm/memcontrol.c b/mm/memcontrol.c index 04851bb..1cce5c3 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c @@ -339,6 +339,11 @@ struct mem_cgroup { #ifdef CONFIG_INET struct tcp_memcontrol tcp_mem; #endif

Re: [PATCH v3 06/16] memcg: infrastructure to match an allocation to the right cache

2012-09-21 Thread Tejun Heo
Missed some stuff. On Tue, Sep 18, 2012 at 06:12:00PM +0400, Glauber Costa wrote: +static struct kmem_cache *memcg_create_kmem_cache(struct mem_cgroup *memcg, + struct kmem_cache *cachep) +{ ... + memcg-slabs[idx] = new_cachep; ... +struct

[PATCH v3 06/16] memcg: infrastructure to match an allocation to the right cache

2012-09-18 Thread Glauber Costa
The page allocator is able to bind a page to a memcg when it is allocated. But for the caches, we'd like to have as many objects as possible in a page belonging to the same cache. This is done in this patch by calling memcg_kmem_get_cache in the beginning of every allocation function. This

[PATCH v3 06/16] memcg: infrastructure to match an allocation to the right cache

2012-09-18 Thread Glauber Costa
The page allocator is able to bind a page to a memcg when it is allocated. But for the caches, we'd like to have as many objects as possible in a page belonging to the same cache. This is done in this patch by calling memcg_kmem_get_cache in the beginning of every allocation function. This