* [PATCH] Move memory controller allocations to their own slabs
@ 2008-03-11 4:31 ` Balbir Singh
0 siblings, 0 replies; 14+ messages in thread
From: Balbir Singh @ 2008-03-11 4:31 UTC (permalink / raw)
To: Paul Menage, Andrew Morton, Pavel Emelianov
Cc: Hugh Dickins, Sudhir Kumar, YAMAMOTO Takashi, lizf, linux-kernel,
taka, linux-mm, David Rientjes, Balbir Singh, KAMEZAWA Hiroyuki
Move the memory controller data structures page_cgroup and
mem_cgroup_per_zone to their own slab caches. It saves space on the system,
allocations are not necessarily pushed to order of 2 and should provide
performance benefits. Users who disable the memory controller can also double
check that the memory controller is not allocating page_cgroup's.
Signed-off-by: Balbir Singh <balbir@linux.vnet.ibm.com>
---
linux/memcontrol.h | 0
mm/memcontrol.c | 21 ++++++++++++++-------
2 files changed, 14 insertions(+), 7 deletions(-)
diff -puN mm/memcontrol.c~memory-controller-move-to-own-slab mm/memcontrol.c
--- linux-2.6.25-rc4/mm/memcontrol.c~memory-controller-move-to-own-slab 2008-03-10 23:22:34.000000000 +0530
+++ linux-2.6.25-rc4-balbir/mm/memcontrol.c 2008-03-10 23:34:42.000000000 +0530
@@ -26,6 +26,7 @@
#include <linux/backing-dev.h>
#include <linux/bit_spinlock.h>
#include <linux/rcupdate.h>
+#include <linux/slab.h>
#include <linux/swap.h>
#include <linux/spinlock.h>
#include <linux/fs.h>
@@ -35,6 +36,8 @@
struct cgroup_subsys mem_cgroup_subsys;
static const int MEM_CGROUP_RECLAIM_RETRIES = 5;
+static struct kmem_cache *page_cgroup_cache;
+static struct kmem_cache *mem_cgroup_per_zone_cache;
/*
* Statistics for memory cgroup.
@@ -560,7 +563,7 @@ retry:
}
unlock_page_cgroup(page);
- pc = kzalloc(sizeof(struct page_cgroup), gfp_mask);
+ pc = kmem_cache_zalloc(page_cgroup_cache, gfp_mask);
if (pc == NULL)
goto err;
@@ -622,7 +625,7 @@ retry:
*/
res_counter_uncharge(&mem->res, PAGE_SIZE);
css_put(&mem->css);
- kfree(pc);
+ kmem_cache_free(page_cgroup_cache, pc);
goto retry;
}
page_assign_page_cgroup(page, pc);
@@ -637,7 +640,7 @@ done:
return 0;
out:
css_put(&mem->css);
- kfree(pc);
+ kmem_cache_free(page_cgroup_cache, pc);
err:
return -ENOMEM;
}
@@ -695,7 +698,7 @@ void mem_cgroup_uncharge_page(struct pag
res_counter_uncharge(&mem->res, PAGE_SIZE);
css_put(&mem->css);
- kfree(pc);
+ kmem_cache_free(page_cgroup_cache, pc);
return;
}
@@ -988,9 +991,10 @@ static int alloc_mem_cgroup_per_zone_inf
* function.
*/
if (node_state(node, N_HIGH_MEMORY))
- pn = kmalloc_node(sizeof(*pn), GFP_KERNEL, node);
+ pn = kmem_cache_alloc_node(mem_cgroup_per_zone_cache,
+ GFP_KERNEL, node);
else
- pn = kmalloc(sizeof(*pn), GFP_KERNEL);
+ pn = kmem_cache_alloc(mem_cgroup_per_zone_cache, GFP_KERNEL);
if (!pn)
return 1;
@@ -1008,7 +1012,7 @@ static int alloc_mem_cgroup_per_zone_inf
static void free_mem_cgroup_per_zone_info(struct mem_cgroup *mem, int node)
{
- kfree(mem->info.nodeinfo[node]);
+ kmem_cache_free(mem_cgroup_per_zone_cache, mem->info.nodeinfo[node]);
}
static struct cgroup_subsys_state *
@@ -1020,6 +1024,9 @@ mem_cgroup_create(struct cgroup_subsys *
if (unlikely((cont->parent) == NULL)) {
mem = &init_mem_cgroup;
init_mm.mem_cgroup = mem;
+ page_cgroup_cache = KMEM_CACHE(page_cgroup, SLAB_PANIC);
+ mem_cgroup_per_zone_cache = KMEM_CACHE(mem_cgroup_per_zone,
+ SLAB_PANIC);
} else
mem = kzalloc(sizeof(struct mem_cgroup), GFP_KERNEL);
diff -puN include/linux/memcontrol.h~memory-controller-move-to-own-slab include/linux/memcontrol.h
_
--
Warm Regards,
Balbir Singh
Linux Technology Center
IBM, ISTL
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH] Move memory controller allocations to their own slabs
@ 2008-03-11 4:31 ` Balbir Singh
0 siblings, 0 replies; 14+ messages in thread
From: Balbir Singh @ 2008-03-11 4:31 UTC (permalink / raw)
To: Paul Menage, Andrew Morton, Pavel Emelianov
Cc: Hugh Dickins, Sudhir Kumar, YAMAMOTO Takashi, lizf, linux-kernel,
taka, linux-mm, David Rientjes, Balbir Singh, KAMEZAWA Hiroyuki
Move the memory controller data structures page_cgroup and
mem_cgroup_per_zone to their own slab caches. It saves space on the system,
allocations are not necessarily pushed to order of 2 and should provide
performance benefits. Users who disable the memory controller can also double
check that the memory controller is not allocating page_cgroup's.
Signed-off-by: Balbir Singh <balbir@linux.vnet.ibm.com>
---
linux/memcontrol.h | 0
mm/memcontrol.c | 21 ++++++++++++++-------
2 files changed, 14 insertions(+), 7 deletions(-)
diff -puN mm/memcontrol.c~memory-controller-move-to-own-slab mm/memcontrol.c
--- linux-2.6.25-rc4/mm/memcontrol.c~memory-controller-move-to-own-slab 2008-03-10 23:22:34.000000000 +0530
+++ linux-2.6.25-rc4-balbir/mm/memcontrol.c 2008-03-10 23:34:42.000000000 +0530
@@ -26,6 +26,7 @@
#include <linux/backing-dev.h>
#include <linux/bit_spinlock.h>
#include <linux/rcupdate.h>
+#include <linux/slab.h>
#include <linux/swap.h>
#include <linux/spinlock.h>
#include <linux/fs.h>
@@ -35,6 +36,8 @@
struct cgroup_subsys mem_cgroup_subsys;
static const int MEM_CGROUP_RECLAIM_RETRIES = 5;
+static struct kmem_cache *page_cgroup_cache;
+static struct kmem_cache *mem_cgroup_per_zone_cache;
/*
* Statistics for memory cgroup.
@@ -560,7 +563,7 @@ retry:
}
unlock_page_cgroup(page);
- pc = kzalloc(sizeof(struct page_cgroup), gfp_mask);
+ pc = kmem_cache_zalloc(page_cgroup_cache, gfp_mask);
if (pc == NULL)
goto err;
@@ -622,7 +625,7 @@ retry:
*/
res_counter_uncharge(&mem->res, PAGE_SIZE);
css_put(&mem->css);
- kfree(pc);
+ kmem_cache_free(page_cgroup_cache, pc);
goto retry;
}
page_assign_page_cgroup(page, pc);
@@ -637,7 +640,7 @@ done:
return 0;
out:
css_put(&mem->css);
- kfree(pc);
+ kmem_cache_free(page_cgroup_cache, pc);
err:
return -ENOMEM;
}
@@ -695,7 +698,7 @@ void mem_cgroup_uncharge_page(struct pag
res_counter_uncharge(&mem->res, PAGE_SIZE);
css_put(&mem->css);
- kfree(pc);
+ kmem_cache_free(page_cgroup_cache, pc);
return;
}
@@ -988,9 +991,10 @@ static int alloc_mem_cgroup_per_zone_inf
* function.
*/
if (node_state(node, N_HIGH_MEMORY))
- pn = kmalloc_node(sizeof(*pn), GFP_KERNEL, node);
+ pn = kmem_cache_alloc_node(mem_cgroup_per_zone_cache,
+ GFP_KERNEL, node);
else
- pn = kmalloc(sizeof(*pn), GFP_KERNEL);
+ pn = kmem_cache_alloc(mem_cgroup_per_zone_cache, GFP_KERNEL);
if (!pn)
return 1;
@@ -1008,7 +1012,7 @@ static int alloc_mem_cgroup_per_zone_inf
static void free_mem_cgroup_per_zone_info(struct mem_cgroup *mem, int node)
{
- kfree(mem->info.nodeinfo[node]);
+ kmem_cache_free(mem_cgroup_per_zone_cache, mem->info.nodeinfo[node]);
}
static struct cgroup_subsys_state *
@@ -1020,6 +1024,9 @@ mem_cgroup_create(struct cgroup_subsys *
if (unlikely((cont->parent) == NULL)) {
mem = &init_mem_cgroup;
init_mm.mem_cgroup = mem;
+ page_cgroup_cache = KMEM_CACHE(page_cgroup, SLAB_PANIC);
+ mem_cgroup_per_zone_cache = KMEM_CACHE(mem_cgroup_per_zone,
+ SLAB_PANIC);
} else
mem = kzalloc(sizeof(struct mem_cgroup), GFP_KERNEL);
diff -puN include/linux/memcontrol.h~memory-controller-move-to-own-slab include/linux/memcontrol.h
_
--
Warm Regards,
Balbir Singh
Linux Technology Center
IBM, ISTL
--
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: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH] Move memory controller allocations to their own slabs
2008-03-11 4:31 ` Balbir Singh
@ 2008-03-11 4:41 ` Andrew Morton
-1 siblings, 0 replies; 14+ messages in thread
From: Andrew Morton @ 2008-03-11 4:41 UTC (permalink / raw)
To: Balbir Singh
Cc: Paul Menage, Pavel Emelianov, Hugh Dickins, Sudhir Kumar,
YAMAMOTO Takashi, lizf, linux-kernel, taka, linux-mm,
David Rientjes, KAMEZAWA Hiroyuki
On Tue, 11 Mar 2008 10:01:49 +0530 Balbir Singh <balbir@linux.vnet.ibm.com> wrote:
>
>
> Move the memory controller data structures page_cgroup and
> mem_cgroup_per_zone to their own slab caches. It saves space on the system,
> allocations are not necessarily pushed to order of 2 and should provide
> performance benefits.
eh? Those structures are tiny. Which slab allocator has gone and used an
order-2 allocation and for which structure did it (stupidly) do this?
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH] Move memory controller allocations to their own slabs
@ 2008-03-11 4:41 ` Andrew Morton
0 siblings, 0 replies; 14+ messages in thread
From: Andrew Morton @ 2008-03-11 4:41 UTC (permalink / raw)
To: Balbir Singh
Cc: Paul Menage, Pavel Emelianov, Hugh Dickins, Sudhir Kumar,
YAMAMOTO Takashi, lizf, linux-kernel, taka, linux-mm,
David Rientjes, KAMEZAWA Hiroyuki
On Tue, 11 Mar 2008 10:01:49 +0530 Balbir Singh <balbir@linux.vnet.ibm.com> wrote:
>
>
> Move the memory controller data structures page_cgroup and
> mem_cgroup_per_zone to their own slab caches. It saves space on the system,
> allocations are not necessarily pushed to order of 2 and should provide
> performance benefits.
eh? Those structures are tiny. Which slab allocator has gone and used an
order-2 allocation and for which structure did it (stupidly) do this?
--
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: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH] Move memory controller allocations to their own slabs
2008-03-11 4:41 ` Andrew Morton
@ 2008-03-11 4:45 ` Balbir Singh
-1 siblings, 0 replies; 14+ messages in thread
From: Balbir Singh @ 2008-03-11 4:45 UTC (permalink / raw)
To: Andrew Morton
Cc: Paul Menage, Pavel Emelianov, Hugh Dickins, Sudhir Kumar,
YAMAMOTO Takashi, lizf, linux-kernel, taka, linux-mm,
David Rientjes, KAMEZAWA Hiroyuki
Andrew Morton wrote:
> On Tue, 11 Mar 2008 10:01:49 +0530 Balbir Singh <balbir@linux.vnet.ibm.com> wrote:
>
>>
>> Move the memory controller data structures page_cgroup and
>> mem_cgroup_per_zone to their own slab caches. It saves space on the system,
>> allocations are not necessarily pushed to order of 2 and should provide
>> performance benefits.
>
> eh? Those structures are tiny. Which slab allocator has gone and used an
> order-2 allocation and for which structure did it (stupidly) do this?
>
>
When I say order of 2, I meant with kmalloc. They are rounded of to 64, 128 byte
boundary. I wanted to pack these objects more closely.
--
Warm Regards,
Balbir Singh
Linux Technology Center
IBM, ISTL
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH] Move memory controller allocations to their own slabs
@ 2008-03-11 4:45 ` Balbir Singh
0 siblings, 0 replies; 14+ messages in thread
From: Balbir Singh @ 2008-03-11 4:45 UTC (permalink / raw)
To: Andrew Morton
Cc: Paul Menage, Pavel Emelianov, Hugh Dickins, Sudhir Kumar,
YAMAMOTO Takashi, lizf, linux-kernel, taka, linux-mm,
David Rientjes, KAMEZAWA Hiroyuki
Andrew Morton wrote:
> On Tue, 11 Mar 2008 10:01:49 +0530 Balbir Singh <balbir@linux.vnet.ibm.com> wrote:
>
>>
>> Move the memory controller data structures page_cgroup and
>> mem_cgroup_per_zone to their own slab caches. It saves space on the system,
>> allocations are not necessarily pushed to order of 2 and should provide
>> performance benefits.
>
> eh? Those structures are tiny. Which slab allocator has gone and used an
> order-2 allocation and for which structure did it (stupidly) do this?
>
>
When I say order of 2, I meant with kmalloc. They are rounded of to 64, 128 byte
boundary. I wanted to pack these objects more closely.
--
Warm Regards,
Balbir Singh
Linux Technology Center
IBM, ISTL
--
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: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH] Move memory controller allocations to their own slabs
2008-03-11 4:31 ` Balbir Singh
@ 2008-03-11 4:45 ` KAMEZAWA Hiroyuki
-1 siblings, 0 replies; 14+ messages in thread
From: KAMEZAWA Hiroyuki @ 2008-03-11 4:45 UTC (permalink / raw)
To: Balbir Singh
Cc: Paul Menage, Andrew Morton, Pavel Emelianov, Hugh Dickins,
Sudhir Kumar, YAMAMOTO Takashi, lizf, linux-kernel, taka,
linux-mm, David Rientjes
On Tue, 11 Mar 2008 10:01:49 +0530
Balbir Singh <balbir@linux.vnet.ibm.com> wrote:
>
> Move the memory controller data structures page_cgroup and
> mem_cgroup_per_zone to their own slab caches. It saves space on the system,
> allocations are not necessarily pushed to order of 2 and should provide
> performance benefits. Users who disable the memory controller can also double
> check that the memory controller is not allocating page_cgroup's.
>
> Signed-off-by: Balbir Singh <balbir@linux.vnet.ibm.com>
> ---
I think using its own kmem_cache for mem_cgroup_per_zone is a bit overkill.
Thanks,
-Kame
>
> linux/memcontrol.h | 0
> mm/memcontrol.c | 21 ++++++++++++++-------
> 2 files changed, 14 insertions(+), 7 deletions(-)
>
> diff -puN mm/memcontrol.c~memory-controller-move-to-own-slab mm/memcontrol.c
> --- linux-2.6.25-rc4/mm/memcontrol.c~memory-controller-move-to-own-slab 2008-03-10 23:22:34.000000000 +0530
> +++ linux-2.6.25-rc4-balbir/mm/memcontrol.c 2008-03-10 23:34:42.000000000 +0530
> @@ -26,6 +26,7 @@
> #include <linux/backing-dev.h>
> #include <linux/bit_spinlock.h>
> #include <linux/rcupdate.h>
> +#include <linux/slab.h>
> #include <linux/swap.h>
> #include <linux/spinlock.h>
> #include <linux/fs.h>
> @@ -35,6 +36,8 @@
>
> struct cgroup_subsys mem_cgroup_subsys;
> static const int MEM_CGROUP_RECLAIM_RETRIES = 5;
> +static struct kmem_cache *page_cgroup_cache;
> +static struct kmem_cache *mem_cgroup_per_zone_cache;
>
> /*
> * Statistics for memory cgroup.
> @@ -560,7 +563,7 @@ retry:
> }
> unlock_page_cgroup(page);
>
> - pc = kzalloc(sizeof(struct page_cgroup), gfp_mask);
> + pc = kmem_cache_zalloc(page_cgroup_cache, gfp_mask);
> if (pc == NULL)
> goto err;
>
> @@ -622,7 +625,7 @@ retry:
> */
> res_counter_uncharge(&mem->res, PAGE_SIZE);
> css_put(&mem->css);
> - kfree(pc);
> + kmem_cache_free(page_cgroup_cache, pc);
> goto retry;
> }
> page_assign_page_cgroup(page, pc);
> @@ -637,7 +640,7 @@ done:
> return 0;
> out:
> css_put(&mem->css);
> - kfree(pc);
> + kmem_cache_free(page_cgroup_cache, pc);
> err:
> return -ENOMEM;
> }
> @@ -695,7 +698,7 @@ void mem_cgroup_uncharge_page(struct pag
> res_counter_uncharge(&mem->res, PAGE_SIZE);
> css_put(&mem->css);
>
> - kfree(pc);
> + kmem_cache_free(page_cgroup_cache, pc);
> return;
> }
>
> @@ -988,9 +991,10 @@ static int alloc_mem_cgroup_per_zone_inf
> * function.
> */
> if (node_state(node, N_HIGH_MEMORY))
> - pn = kmalloc_node(sizeof(*pn), GFP_KERNEL, node);
> + pn = kmem_cache_alloc_node(mem_cgroup_per_zone_cache,
> + GFP_KERNEL, node);
> else
> - pn = kmalloc(sizeof(*pn), GFP_KERNEL);
> + pn = kmem_cache_alloc(mem_cgroup_per_zone_cache, GFP_KERNEL);
> if (!pn)
> return 1;
>
> @@ -1008,7 +1012,7 @@ static int alloc_mem_cgroup_per_zone_inf
>
> static void free_mem_cgroup_per_zone_info(struct mem_cgroup *mem, int node)
> {
> - kfree(mem->info.nodeinfo[node]);
> + kmem_cache_free(mem_cgroup_per_zone_cache, mem->info.nodeinfo[node]);
> }
>
> static struct cgroup_subsys_state *
> @@ -1020,6 +1024,9 @@ mem_cgroup_create(struct cgroup_subsys *
> if (unlikely((cont->parent) == NULL)) {
> mem = &init_mem_cgroup;
> init_mm.mem_cgroup = mem;
> + page_cgroup_cache = KMEM_CACHE(page_cgroup, SLAB_PANIC);
> + mem_cgroup_per_zone_cache = KMEM_CACHE(mem_cgroup_per_zone,
> + SLAB_PANIC);
> } else
> mem = kzalloc(sizeof(struct mem_cgroup), GFP_KERNEL);
>
> diff -puN include/linux/memcontrol.h~memory-controller-move-to-own-slab include/linux/memcontrol.h
> _
>
> --
> Warm Regards,
> Balbir Singh
> Linux Technology Center
> IBM, ISTL
>
> --
> 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: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
>
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH] Move memory controller allocations to their own slabs
@ 2008-03-11 4:45 ` KAMEZAWA Hiroyuki
0 siblings, 0 replies; 14+ messages in thread
From: KAMEZAWA Hiroyuki @ 2008-03-11 4:45 UTC (permalink / raw)
To: Balbir Singh
Cc: Paul Menage, Andrew Morton, Pavel Emelianov, Hugh Dickins,
Sudhir Kumar, YAMAMOTO Takashi, lizf, linux-kernel, taka,
linux-mm, David Rientjes
On Tue, 11 Mar 2008 10:01:49 +0530
Balbir Singh <balbir@linux.vnet.ibm.com> wrote:
>
> Move the memory controller data structures page_cgroup and
> mem_cgroup_per_zone to their own slab caches. It saves space on the system,
> allocations are not necessarily pushed to order of 2 and should provide
> performance benefits. Users who disable the memory controller can also double
> check that the memory controller is not allocating page_cgroup's.
>
> Signed-off-by: Balbir Singh <balbir@linux.vnet.ibm.com>
> ---
I think using its own kmem_cache for mem_cgroup_per_zone is a bit overkill.
Thanks,
-Kame
>
> linux/memcontrol.h | 0
> mm/memcontrol.c | 21 ++++++++++++++-------
> 2 files changed, 14 insertions(+), 7 deletions(-)
>
> diff -puN mm/memcontrol.c~memory-controller-move-to-own-slab mm/memcontrol.c
> --- linux-2.6.25-rc4/mm/memcontrol.c~memory-controller-move-to-own-slab 2008-03-10 23:22:34.000000000 +0530
> +++ linux-2.6.25-rc4-balbir/mm/memcontrol.c 2008-03-10 23:34:42.000000000 +0530
> @@ -26,6 +26,7 @@
> #include <linux/backing-dev.h>
> #include <linux/bit_spinlock.h>
> #include <linux/rcupdate.h>
> +#include <linux/slab.h>
> #include <linux/swap.h>
> #include <linux/spinlock.h>
> #include <linux/fs.h>
> @@ -35,6 +36,8 @@
>
> struct cgroup_subsys mem_cgroup_subsys;
> static const int MEM_CGROUP_RECLAIM_RETRIES = 5;
> +static struct kmem_cache *page_cgroup_cache;
> +static struct kmem_cache *mem_cgroup_per_zone_cache;
>
> /*
> * Statistics for memory cgroup.
> @@ -560,7 +563,7 @@ retry:
> }
> unlock_page_cgroup(page);
>
> - pc = kzalloc(sizeof(struct page_cgroup), gfp_mask);
> + pc = kmem_cache_zalloc(page_cgroup_cache, gfp_mask);
> if (pc == NULL)
> goto err;
>
> @@ -622,7 +625,7 @@ retry:
> */
> res_counter_uncharge(&mem->res, PAGE_SIZE);
> css_put(&mem->css);
> - kfree(pc);
> + kmem_cache_free(page_cgroup_cache, pc);
> goto retry;
> }
> page_assign_page_cgroup(page, pc);
> @@ -637,7 +640,7 @@ done:
> return 0;
> out:
> css_put(&mem->css);
> - kfree(pc);
> + kmem_cache_free(page_cgroup_cache, pc);
> err:
> return -ENOMEM;
> }
> @@ -695,7 +698,7 @@ void mem_cgroup_uncharge_page(struct pag
> res_counter_uncharge(&mem->res, PAGE_SIZE);
> css_put(&mem->css);
>
> - kfree(pc);
> + kmem_cache_free(page_cgroup_cache, pc);
> return;
> }
>
> @@ -988,9 +991,10 @@ static int alloc_mem_cgroup_per_zone_inf
> * function.
> */
> if (node_state(node, N_HIGH_MEMORY))
> - pn = kmalloc_node(sizeof(*pn), GFP_KERNEL, node);
> + pn = kmem_cache_alloc_node(mem_cgroup_per_zone_cache,
> + GFP_KERNEL, node);
> else
> - pn = kmalloc(sizeof(*pn), GFP_KERNEL);
> + pn = kmem_cache_alloc(mem_cgroup_per_zone_cache, GFP_KERNEL);
> if (!pn)
> return 1;
>
> @@ -1008,7 +1012,7 @@ static int alloc_mem_cgroup_per_zone_inf
>
> static void free_mem_cgroup_per_zone_info(struct mem_cgroup *mem, int node)
> {
> - kfree(mem->info.nodeinfo[node]);
> + kmem_cache_free(mem_cgroup_per_zone_cache, mem->info.nodeinfo[node]);
> }
>
> static struct cgroup_subsys_state *
> @@ -1020,6 +1024,9 @@ mem_cgroup_create(struct cgroup_subsys *
> if (unlikely((cont->parent) == NULL)) {
> mem = &init_mem_cgroup;
> init_mm.mem_cgroup = mem;
> + page_cgroup_cache = KMEM_CACHE(page_cgroup, SLAB_PANIC);
> + mem_cgroup_per_zone_cache = KMEM_CACHE(mem_cgroup_per_zone,
> + SLAB_PANIC);
> } else
> mem = kzalloc(sizeof(struct mem_cgroup), GFP_KERNEL);
>
> diff -puN include/linux/memcontrol.h~memory-controller-move-to-own-slab include/linux/memcontrol.h
> _
>
> --
> Warm Regards,
> Balbir Singh
> Linux Technology Center
> IBM, ISTL
>
> --
> 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: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
>
--
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: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH] Move memory controller allocations to their own slabs
2008-03-11 4:45 ` KAMEZAWA Hiroyuki
@ 2008-03-11 4:46 ` Balbir Singh
-1 siblings, 0 replies; 14+ messages in thread
From: Balbir Singh @ 2008-03-11 4:46 UTC (permalink / raw)
To: KAMEZAWA Hiroyuki
Cc: Paul Menage, Andrew Morton, Pavel Emelianov, Hugh Dickins,
Sudhir Kumar, YAMAMOTO Takashi, lizf, linux-kernel, taka,
linux-mm, David Rientjes
KAMEZAWA Hiroyuki wrote:
> On Tue, 11 Mar 2008 10:01:49 +0530
> Balbir Singh <balbir@linux.vnet.ibm.com> wrote:
>
>> Move the memory controller data structures page_cgroup and
>> mem_cgroup_per_zone to their own slab caches. It saves space on the system,
>> allocations are not necessarily pushed to order of 2 and should provide
>> performance benefits. Users who disable the memory controller can also double
>> check that the memory controller is not allocating page_cgroup's.
>>
>> Signed-off-by: Balbir Singh <balbir@linux.vnet.ibm.com>
>> ---
> I think using its own kmem_cache for mem_cgroup_per_zone is a bit overkill.
OK, sure, we can move back to the kmalloc.
--
Warm Regards,
Balbir Singh
Linux Technology Center
IBM, ISTL
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH] Move memory controller allocations to their own slabs
@ 2008-03-11 4:46 ` Balbir Singh
0 siblings, 0 replies; 14+ messages in thread
From: Balbir Singh @ 2008-03-11 4:46 UTC (permalink / raw)
To: KAMEZAWA Hiroyuki
Cc: Paul Menage, Andrew Morton, Pavel Emelianov, Hugh Dickins,
Sudhir Kumar, YAMAMOTO Takashi, lizf, linux-kernel, taka,
linux-mm, David Rientjes
KAMEZAWA Hiroyuki wrote:
> On Tue, 11 Mar 2008 10:01:49 +0530
> Balbir Singh <balbir@linux.vnet.ibm.com> wrote:
>
>> Move the memory controller data structures page_cgroup and
>> mem_cgroup_per_zone to their own slab caches. It saves space on the system,
>> allocations are not necessarily pushed to order of 2 and should provide
>> performance benefits. Users who disable the memory controller can also double
>> check that the memory controller is not allocating page_cgroup's.
>>
>> Signed-off-by: Balbir Singh <balbir@linux.vnet.ibm.com>
>> ---
> I think using its own kmem_cache for mem_cgroup_per_zone is a bit overkill.
OK, sure, we can move back to the kmalloc.
--
Warm Regards,
Balbir Singh
Linux Technology Center
IBM, ISTL
--
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: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 14+ messages in thread
* +
2008-03-11 4:31 ` Balbir Singh
@ 2008-03-11 5:00 ` KOSAKI Motohiro
-1 siblings, 0 replies; 14+ messages in thread
From: KOSAKI Motohiro @ 2008-03-11 5:00 UTC (permalink / raw)
To: Balbir Singh
Cc: kosaki.motohiro, Paul Menage, Andrew Morton, Pavel Emelianov,
Hugh Dickins, Sudhir Kumar, YAMAMOTO Takashi, lizf, linux-kernel,
taka, linux-mm, David Rientjes, KAMEZAWA Hiroyuki
Hi
> Signed-off-by: Balbir Singh <balbir@linux.vnet.ibm.com>
> ---
>
> linux/memcontrol.h | 0
???
unnecessary hunk?
or diff comannd bug?
> mm/memcontrol.c | 21 ++++++++++++++-------
> 2 files changed, 14 insertions(+), 7 deletions(-)
^ permalink raw reply [flat|nested] 14+ messages in thread
* +
@ 2008-03-11 5:00 ` KOSAKI Motohiro
0 siblings, 0 replies; 14+ messages in thread
From: KOSAKI Motohiro @ 2008-03-11 5:00 UTC (permalink / raw)
To: Balbir Singh
Cc: kosaki.motohiro, Paul Menage, Andrew Morton, Pavel Emelianov,
Hugh Dickins, Sudhir Kumar, YAMAMOTO Takashi, lizf, linux-kernel,
taka, linux-mm, David Rientjes, KAMEZAWA Hiroyuki
Hi
> Signed-off-by: Balbir Singh <balbir@linux.vnet.ibm.com>
> ---
>
> linux/memcontrol.h | 0
???
unnecessary hunk?
or diff comannd bug?
> mm/memcontrol.c | 21 ++++++++++++++-------
> 2 files changed, 14 insertions(+), 7 deletions(-)
--
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: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: +
2008-03-11 5:00 ` + KOSAKI Motohiro
@ 2008-03-11 5:07 ` Balbir Singh
-1 siblings, 0 replies; 14+ messages in thread
From: Balbir Singh @ 2008-03-11 5:07 UTC (permalink / raw)
To: KOSAKI Motohiro
Cc: Paul Menage, Andrew Morton, Pavel Emelianov, Hugh Dickins,
Sudhir Kumar, YAMAMOTO Takashi, lizf, linux-kernel, taka,
linux-mm, David Rientjes, KAMEZAWA Hiroyuki
KOSAKI Motohiro wrote:
> Hi
>
>> Signed-off-by: Balbir Singh <balbir@linux.vnet.ibm.com>
>> ---
>>
>> linux/memcontrol.h | 0
>
> ???
> unnecessary hunk?
> or diff comannd bug?
I use Andrew Morton's patchutils and specified both include/linux/memcontrol.h
and mm/memcontrol.c
$ cat pc/memory-controller-move-to-own-slab.pc
mm/memcontrol.c
include/linux/memcontrol.h
But refpatch generates linux/memcontrol.h. I am using diffstat v1.41. I'll
reboot to FC8 and see if that makes any difference.
--
Warm Regards,
Balbir Singh
Linux Technology Center
IBM, ISTL
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: +
@ 2008-03-11 5:07 ` Balbir Singh
0 siblings, 0 replies; 14+ messages in thread
From: Balbir Singh @ 2008-03-11 5:07 UTC (permalink / raw)
To: KOSAKI Motohiro
Cc: Paul Menage, Andrew Morton, Pavel Emelianov, Hugh Dickins,
Sudhir Kumar, YAMAMOTO Takashi, lizf, linux-kernel, taka,
linux-mm, David Rientjes, KAMEZAWA Hiroyuki
KOSAKI Motohiro wrote:
> Hi
>
>> Signed-off-by: Balbir Singh <balbir@linux.vnet.ibm.com>
>> ---
>>
>> linux/memcontrol.h | 0
>
> ???
> unnecessary hunk?
> or diff comannd bug?
I use Andrew Morton's patchutils and specified both include/linux/memcontrol.h
and mm/memcontrol.c
$ cat pc/memory-controller-move-to-own-slab.pc
mm/memcontrol.c
include/linux/memcontrol.h
But refpatch generates linux/memcontrol.h. I am using diffstat v1.41. I'll
reboot to FC8 and see if that makes any difference.
--
Warm Regards,
Balbir Singh
Linux Technology Center
IBM, ISTL
--
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: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 14+ messages in thread
end of thread, other threads:[~2008-03-11 5:09 UTC | newest]
Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-03-11 4:31 [PATCH] Move memory controller allocations to their own slabs Balbir Singh
2008-03-11 4:31 ` Balbir Singh
2008-03-11 4:41 ` Andrew Morton
2008-03-11 4:41 ` Andrew Morton
2008-03-11 4:45 ` Balbir Singh
2008-03-11 4:45 ` Balbir Singh
2008-03-11 4:45 ` KAMEZAWA Hiroyuki
2008-03-11 4:45 ` KAMEZAWA Hiroyuki
2008-03-11 4:46 ` Balbir Singh
2008-03-11 4:46 ` Balbir Singh
2008-03-11 5:00 ` + KOSAKI Motohiro
2008-03-11 5:00 ` + KOSAKI Motohiro
2008-03-11 5:07 ` + Balbir Singh
2008-03-11 5:07 ` + Balbir Singh
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.