[Devel] Re: [PATCH 1/2] memcg: dirty pages accounting and limiting infrastructure

2010-03-30 Thread Andrea Righi
On Sun, Feb 21, 2010 at 01:28:35PM -0800, David Rientjes wrote: [snip] +static struct mem_cgroup *get_mem_cgroup_from_page(struct page *page) +{ + struct page_cgroup *pc; + struct mem_cgroup *mem = NULL; + + pc = lookup_page_cgroup(page); + if (unlikely(!pc)) +

[Devel] Re: [PATCH 1/2] memcg: dirty pages accounting and limiting infrastructure

2010-03-30 Thread Andrea Righi
On Mon, Feb 22, 2010 at 09:44:42PM +0530, Balbir Singh wrote: [snip] +void mem_cgroup_charge_dirty(struct page *page, + enum zone_stat_item idx, int charge) +{ + struct mem_cgroup *mem; + struct mem_cgroup_stat_cpu *cpustat; + unsigned long flags; + int cpu;

[Devel] Re: [PATCH 1/2] memcg: dirty pages accounting and limiting infrastructure

2010-02-25 Thread Minchan Kim
Hi On Tue, Feb 23, 2010 at 8:58 PM, Andrea Righi ari...@develer.com wrote: On Mon, Feb 22, 2010 at 01:07:32PM -0500, Vivek Goyal wrote: +unsigned long mem_cgroup_dirty_bytes(void) +{ +       struct mem_cgroup *memcg; +       unsigned long dirty_bytes; + +       if

[Devel] Re: [PATCH 1/2] memcg: dirty pages accounting and limiting infrastructure

2010-02-25 Thread KAMEZAWA Hiroyuki
On Fri, 26 Feb 2010 00:36:15 +0900 Minchan Kim minchan@gmail.com wrote: Hi On Tue, Feb 23, 2010 at 8:58 PM, Andrea Righi ari...@develer.com wrote: On Mon, Feb 22, 2010 at 01:07:32PM -0500, Vivek Goyal wrote: +unsigned long mem_cgroup_dirty_bytes(void) +{ +       struct

[Devel] Re: [PATCH 1/2] memcg: dirty pages accounting and limiting infrastructure

2010-02-25 Thread Minchan Kim
Hi, Kame. On Fri, Feb 26, 2010 at 9:23 AM, KAMEZAWA Hiroyuki kamezawa.hir...@jp.fujitsu.com wrote: On Fri, 26 Feb 2010 00:36:15 +0900 Minchan Kim minchan@gmail.com wrote: Hi On Tue, Feb 23, 2010 at 8:58 PM, Andrea Righi ari...@develer.com wrote: On Mon, Feb 22, 2010 at 01:07:32PM

[Devel] Re: [PATCH 1/2] memcg: dirty pages accounting and limiting infrastructure

2010-02-25 Thread KAMEZAWA Hiroyuki
Hi, On Fri, 26 Feb 2010 13:50:04 +0900 Minchan Kim minchan@gmail.com wrote: Hm ? I don't read the whole thread but can_attach() is called under cgroup_mutex(). So, it doesn't need to use RCU. Vivek mentioned memcg is protected by RCU if I understand his intention right. So I

[Devel] Re: [PATCH 1/2] memcg: dirty pages accounting and limiting infrastructure

2010-02-25 Thread Minchan Kim
On Fri, Feb 26, 2010 at 2:01 PM, KAMEZAWA Hiroyuki kamezawa.hir...@jp.fujitsu.com wrote: Hi, On Fri, 26 Feb 2010 13:50:04 +0900 Minchan Kim minchan@gmail.com wrote: Hm ? I don't read the whole thread but can_attach() is called under cgroup_mutex(). So, it doesn't need to use RCU.

[Devel] Re: [PATCH 1/2] memcg: dirty pages accounting and limiting infrastructure

2010-02-25 Thread KAMEZAWA Hiroyuki
On Fri, 26 Feb 2010 14:53:39 +0900 Minchan Kim minchan@gmail.com wrote: On Fri, Feb 26, 2010 at 2:01 PM, KAMEZAWA Hiroyuki kamezawa.hir...@jp.fujitsu.com wrote: Hi, On Fri, 26 Feb 2010 13:50:04 +0900 Minchan Kim minchan@gmail.com wrote: Hm ? I don't read the whole thread

[Devel] Re: [PATCH 1/2] memcg: dirty pages accounting and limiting infrastructure

2010-02-25 Thread Minchan Kim
On Fri, Feb 26, 2010 at 3:15 PM, KAMEZAWA Hiroyuki kamezawa.hir...@jp.fujitsu.com wrote: On Fri, 26 Feb 2010 14:53:39 +0900 Minchan Kim minchan@gmail.com wrote: On Fri, Feb 26, 2010 at 2:01 PM, KAMEZAWA Hiroyuki kamezawa.hir...@jp.fujitsu.com wrote: Hi, On Fri, 26 Feb 2010 13:50:04

[Devel] Re: [PATCH 1/2] memcg: dirty pages accounting and limiting infrastructure

2010-02-23 Thread KAMEZAWA Hiroyuki
On Tue, 23 Feb 2010 10:28:53 +0100 Andrea Righi ari...@develer.com wrote: On Mon, Feb 22, 2010 at 09:44:42PM +0530, Balbir Singh wrote: [snip] +void mem_cgroup_charge_dirty(struct page *page, + enum zone_stat_item idx, int charge) +{ + struct mem_cgroup *mem; +

[Devel] Re: [PATCH 1/2] memcg: dirty pages accounting and limiting infrastructure

2010-02-22 Thread Vivek Goyal
On Sun, Feb 21, 2010 at 04:18:44PM +0100, Andrea Righi wrote: Infrastructure to account dirty pages per cgroup + add memory.dirty_bytes limit in cgroupfs. Signed-off-by: Andrea Righi ari...@develer.com --- include/linux/memcontrol.h | 31 ++ mm/memcontrol.c| 218

[Devel] Re: [PATCH 1/2] memcg: dirty pages accounting and limiting infrastructure

2010-02-22 Thread Balbir Singh
* Andrea Righi ari...@develer.com [2010-02-21 16:18:44]: Infrastructure to account dirty pages per cgroup + add memory.dirty_bytes limit in cgroupfs. Signed-off-by: Andrea Righi ari...@develer.com --- include/linux/memcontrol.h | 31 ++ mm/memcontrol.c| 218

[Devel] Re: [PATCH 1/2] memcg: dirty pages accounting and limiting infrastructure

2010-02-22 Thread Balbir Singh
* Vivek Goyal vgo...@redhat.com [2010-02-22 10:58:40]: We seem to be doing same operation as existing mem_cgroup_update_file_mapped function is doing to udpate some stats. Can we just reuse that? We probably can create one core function which take index of stat to update and

[Devel] Re: [PATCH 1/2] memcg: dirty pages accounting and limiting infrastructure

2010-02-22 Thread Vivek Goyal
On Sun, Feb 21, 2010 at 11:17:01PM +0100, Andrea Righi wrote: On Sun, Feb 21, 2010 at 01:28:35PM -0800, David Rientjes wrote: [snip] +static struct mem_cgroup *get_mem_cgroup_from_page(struct page *page) +{ + struct page_cgroup *pc; + struct mem_cgroup *mem = NULL; + + pc =

[Devel] Re: [PATCH 1/2] memcg: dirty pages accounting and limiting infrastructure

2010-02-22 Thread Vivek Goyal
On Mon, Feb 22, 2010 at 09:22:42AM +0900, KAMEZAWA Hiroyuki wrote: [..] +static int mem_cgroup_dirty_bytes_write(struct cgroup *cgrp, struct cftype *cft, + u64 val) +{ + struct mem_cgroup *memcg = mem_cgroup_from_cont(cgrp); + struct mem_cgroup

[Devel] Re: [PATCH 1/2] memcg: dirty pages accounting and limiting infrastructure

2010-02-22 Thread David Rientjes
On Mon, 22 Feb 2010, Andrea Righi wrote: Hmm...do we need spinlock ? You use unsigned long, then, read-write is always atomic if not read-modify-write. I think I simply copypaste the memcg-swappiness case. But I agree, read-write should be atomic. We don't need memcg-reclaim_param_lock

[Devel] Re: [PATCH 1/2] memcg: dirty pages accounting and limiting infrastructure

2010-02-21 Thread David Rientjes
On Sun, 21 Feb 2010, Andrea Righi wrote: diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h index 1f9b119..ba3fe0d 100644 --- a/include/linux/memcontrol.h +++ b/include/linux/memcontrol.h @@ -25,6 +25,16 @@ struct page_cgroup; struct page; struct mm_struct; +/*

[Devel] Re: [PATCH 1/2] memcg: dirty pages accounting and limiting infrastructure

2010-02-21 Thread KAMEZAWA Hiroyuki
On Sun, 21 Feb 2010 16:18:44 +0100 Andrea Righi ari...@develer.com wrote: Infrastructure to account dirty pages per cgroup + add memory.dirty_bytes limit in cgroupfs. Signed-off-by: Andrea Righi ari...@develer.com Looks clean in general. But some confliction with memcg in mmotm. And