linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] memcg: make memcg's file mapped consistent with global VM
@ 2009-10-28  3:16 KAMEZAWA Hiroyuki
  2009-10-28  6:37 ` Daisuke Nishimura
  2009-10-28  7:18 ` Balbir Singh
  0 siblings, 2 replies; 6+ messages in thread
From: KAMEZAWA Hiroyuki @ 2009-10-28  3:16 UTC (permalink / raw)
  To: linux-kernel; +Cc: linux-mm, balbir, nishimura, akpm

Based on mmotm-Oct13 + some patches in -mm queue.

==
From: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>

memcg-cleanup-file-mapped-consistent-with-globarl-vm-stat.patch

In global VM, FILE_MAPPED is used but memcg uses MAPPED_FILE.
This makes grep difficult. Replace memcg's MAPPED_FILE with FILE_MAPPED

And in global VM, mapped shared memory is accounted into FILE_MAPPED.
But memcg doesn't. fix it.
Note:
  page_is_file_cache() just checks SwapBacked or not.
  So, we need to check PageAnon.

Cc: Balbir Singh <balbir@in.ibm.com>
Cc: Daisuke Nishimura <nishimura@mxp.nes.nec.co.jp>
Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
---
 include/linux/memcontrol.h |    4 ++--
 mm/memcontrol.c            |   21 +++++++++------------
 mm/rmap.c                  |    4 ++--
 3 files changed, 13 insertions(+), 16 deletions(-)

Index: mm-test-kernel/mm/memcontrol.c
===================================================================
--- mm-test-kernel.orig/mm/memcontrol.c
+++ mm-test-kernel/mm/memcontrol.c
@@ -67,7 +67,7 @@ enum mem_cgroup_stat_index {
 	 */
 	MEM_CGROUP_STAT_CACHE, 	   /* # of pages charged as cache */
 	MEM_CGROUP_STAT_RSS,	   /* # of pages charged as anon rss */
-	MEM_CGROUP_STAT_MAPPED_FILE,  /* # of pages charged as file rss */
+	MEM_CGROUP_STAT_FILE_MAPPED,  /* # of pages charged as file rss */
 	MEM_CGROUP_STAT_PGPGIN_COUNT,	/* # of pages paged in */
 	MEM_CGROUP_STAT_PGPGOUT_COUNT,	/* # of pages paged out */
 	MEM_CGROUP_STAT_EVENTS,	/* sum of pagein + pageout for internal use */
@@ -1227,7 +1227,7 @@ static void record_last_oom(struct mem_c
  * Currently used to update mapped file statistics, but the routine can be
  * generalized to update other statistics as well.
  */
-void mem_cgroup_update_mapped_file_stat(struct page *page, int val)
+void mem_cgroup_update_file_mapped(struct page *page, int val)
 {
 	struct mem_cgroup *mem;
 	struct mem_cgroup_stat *stat;
@@ -1235,9 +1235,6 @@ void mem_cgroup_update_mapped_file_stat(
 	int cpu;
 	struct page_cgroup *pc;
 
-	if (!page_is_file_cache(page))
-		return;
-
 	pc = lookup_page_cgroup(page);
 	if (unlikely(!pc))
 		return;
@@ -1257,7 +1254,7 @@ void mem_cgroup_update_mapped_file_stat(
 	stat = &mem->stat;
 	cpustat = &stat->cpustat[cpu];
 
-	__mem_cgroup_stat_add_safe(cpustat, MEM_CGROUP_STAT_MAPPED_FILE, val);
+	__mem_cgroup_stat_add_safe(cpustat, MEM_CGROUP_STAT_FILE_MAPPED, val);
 done:
 	unlock_page_cgroup(pc);
 }
@@ -1654,18 +1651,18 @@ static int mem_cgroup_move_account(struc
 	mem_cgroup_charge_statistics(from, pc, false);
 
 	page = pc->page;
-	if (page_is_file_cache(page) && page_mapped(page)) {
+	if (page_mapped(page) && !PageAnon(page)) {
 		cpu = smp_processor_id();
 		/* Update mapped_file data for mem_cgroup "from" */
 		stat = &from->stat;
 		cpustat = &stat->cpustat[cpu];
-		__mem_cgroup_stat_add_safe(cpustat, MEM_CGROUP_STAT_MAPPED_FILE,
+		__mem_cgroup_stat_add_safe(cpustat, MEM_CGROUP_STAT_FILE_MAPPED,
 						-1);
 
 		/* Update mapped_file data for mem_cgroup "to" */
 		stat = &to->stat;
 		cpustat = &stat->cpustat[cpu];
-		__mem_cgroup_stat_add_safe(cpustat, MEM_CGROUP_STAT_MAPPED_FILE,
+		__mem_cgroup_stat_add_safe(cpustat, MEM_CGROUP_STAT_FILE_MAPPED,
 						1);
 	}
 
@@ -2887,7 +2884,7 @@ static int mem_cgroup_reset(struct cgrou
 enum {
 	MCS_CACHE,
 	MCS_RSS,
-	MCS_MAPPED_FILE,
+	MCS_FILE_MAPPED,
 	MCS_PGPGIN,
 	MCS_PGPGOUT,
 	MCS_SWAP,
@@ -2931,8 +2928,8 @@ static int mem_cgroup_get_local_stat(str
 	s->stat[MCS_CACHE] += val * PAGE_SIZE;
 	val = mem_cgroup_read_stat(&mem->stat, MEM_CGROUP_STAT_RSS);
 	s->stat[MCS_RSS] += val * PAGE_SIZE;
-	val = mem_cgroup_read_stat(&mem->stat, MEM_CGROUP_STAT_MAPPED_FILE);
-	s->stat[MCS_MAPPED_FILE] += val * PAGE_SIZE;
+	val = mem_cgroup_read_stat(&mem->stat, MEM_CGROUP_STAT_FILE_MAPPED);
+	s->stat[MCS_FILE_MAPPED] += val * PAGE_SIZE;
 	val = mem_cgroup_read_stat(&mem->stat, MEM_CGROUP_STAT_PGPGIN_COUNT);
 	s->stat[MCS_PGPGIN] += val;
 	val = mem_cgroup_read_stat(&mem->stat, MEM_CGROUP_STAT_PGPGOUT_COUNT);
Index: mm-test-kernel/include/linux/memcontrol.h
===================================================================
--- mm-test-kernel.orig/include/linux/memcontrol.h
+++ mm-test-kernel/include/linux/memcontrol.h
@@ -122,7 +122,7 @@ static inline bool mem_cgroup_disabled(v
 }
 
 extern bool mem_cgroup_oom_called(struct task_struct *task);
-void mem_cgroup_update_mapped_file_stat(struct page *page, int val);
+void mem_cgroup_update_file_mapped(struct page *page, int val);
 unsigned long mem_cgroup_soft_limit_reclaim(struct zone *zone, int order,
 						gfp_t gfp_mask, int nid,
 						int zid);
@@ -287,7 +287,7 @@ mem_cgroup_print_oom_info(struct mem_cgr
 {
 }
 
-static inline void mem_cgroup_update_mapped_file_stat(struct page *page,
+static inline void mem_cgroup_update_file_mapped(struct page *page,
 							int val)
 {
 }
Index: mm-test-kernel/mm/rmap.c
===================================================================
--- mm-test-kernel.orig/mm/rmap.c
+++ mm-test-kernel/mm/rmap.c
@@ -711,7 +711,7 @@ void page_add_file_rmap(struct page *pag
 {
 	if (atomic_inc_and_test(&page->_mapcount)) {
 		__inc_zone_page_state(page, NR_FILE_MAPPED);
-		mem_cgroup_update_mapped_file_stat(page, 1);
+		mem_cgroup_update_file_mapped(page, 1);
 	}
 }
 
@@ -743,8 +743,8 @@ void page_remove_rmap(struct page *page)
 		__dec_zone_page_state(page, NR_ANON_PAGES);
 	} else {
 		__dec_zone_page_state(page, NR_FILE_MAPPED);
+		mem_cgroup_update_file_mapped(page, -1);
 	}
-	mem_cgroup_update_mapped_file_stat(page, -1);
 	/*
 	 * It would be tidy to reset the PageAnon mapping here,
 	 * but that might overwrite a racing page_add_anon_rmap

--
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] 6+ messages in thread

* Re: [PATCH] memcg: make memcg's file mapped consistent with global VM
  2009-10-28  3:16 [PATCH] memcg: make memcg's file mapped consistent with global VM KAMEZAWA Hiroyuki
@ 2009-10-28  6:37 ` Daisuke Nishimura
  2009-10-28  7:18 ` Balbir Singh
  1 sibling, 0 replies; 6+ messages in thread
From: Daisuke Nishimura @ 2009-10-28  6:37 UTC (permalink / raw)
  To: KAMEZAWA Hiroyuki; +Cc: linux-kernel, linux-mm, balbir, akpm, Daisuke Nishimura

Hi.

On Wed, 28 Oct 2009 12:16:19 +0900, KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> wrote:
> Based on mmotm-Oct13 + some patches in -mm queue.
> 
> ==
> From: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
> 
> memcg-cleanup-file-mapped-consistent-with-globarl-vm-stat.patch
> 
> In global VM, FILE_MAPPED is used but memcg uses MAPPED_FILE.
> This makes grep difficult. Replace memcg's MAPPED_FILE with FILE_MAPPED
> 
> And in global VM, mapped shared memory is accounted into FILE_MAPPED.
> But memcg doesn't. fix it.
> Note:
>   page_is_file_cache() just checks SwapBacked or not.
>   So, we need to check PageAnon.
> 
> Cc: Balbir Singh <balbir@in.ibm.com>
> Cc: Daisuke Nishimura <nishimura@mxp.nes.nec.co.jp>
> Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
> ---
>  include/linux/memcontrol.h |    4 ++--
>  mm/memcontrol.c            |   21 +++++++++------------
>  mm/rmap.c                  |    4 ++--
>  3 files changed, 13 insertions(+), 16 deletions(-)
> 
> Index: mm-test-kernel/mm/memcontrol.c
> ===================================================================
> --- mm-test-kernel.orig/mm/memcontrol.c
> +++ mm-test-kernel/mm/memcontrol.c
> @@ -67,7 +67,7 @@ enum mem_cgroup_stat_index {
>  	 */
>  	MEM_CGROUP_STAT_CACHE, 	   /* # of pages charged as cache */
>  	MEM_CGROUP_STAT_RSS,	   /* # of pages charged as anon rss */
> -	MEM_CGROUP_STAT_MAPPED_FILE,  /* # of pages charged as file rss */
> +	MEM_CGROUP_STAT_FILE_MAPPED,  /* # of pages charged as file rss */
>  	MEM_CGROUP_STAT_PGPGIN_COUNT,	/* # of pages paged in */
>  	MEM_CGROUP_STAT_PGPGOUT_COUNT,	/* # of pages paged out */
>  	MEM_CGROUP_STAT_EVENTS,	/* sum of pagein + pageout for internal use */
> @@ -1227,7 +1227,7 @@ static void record_last_oom(struct mem_c
>   * Currently used to update mapped file statistics, but the routine can be
>   * generalized to update other statistics as well.
>   */
> -void mem_cgroup_update_mapped_file_stat(struct page *page, int val)
> +void mem_cgroup_update_file_mapped(struct page *page, int val)
>  {
>  	struct mem_cgroup *mem;
>  	struct mem_cgroup_stat *stat;
> @@ -1235,9 +1235,6 @@ void mem_cgroup_update_mapped_file_stat(
>  	int cpu;
>  	struct page_cgroup *pc;
>  
> -	if (!page_is_file_cache(page))
> -		return;
> -
I think it would be better to add VM_BUG_ON(PageAnon(page)) here.
Otherwise looks good to me.

	Reviewed-by: Daisuke Nishimura <nishimura@mxp.nes.nec.co.jp>

Thanks,
Daisuke Nishimura.

>  	pc = lookup_page_cgroup(page);
>  	if (unlikely(!pc))
>  		return;
> @@ -1257,7 +1254,7 @@ void mem_cgroup_update_mapped_file_stat(
>  	stat = &mem->stat;
>  	cpustat = &stat->cpustat[cpu];
>  
> -	__mem_cgroup_stat_add_safe(cpustat, MEM_CGROUP_STAT_MAPPED_FILE, val);
> +	__mem_cgroup_stat_add_safe(cpustat, MEM_CGROUP_STAT_FILE_MAPPED, val);
>  done:
>  	unlock_page_cgroup(pc);
>  }
> @@ -1654,18 +1651,18 @@ static int mem_cgroup_move_account(struc
>  	mem_cgroup_charge_statistics(from, pc, false);
>  
>  	page = pc->page;
> -	if (page_is_file_cache(page) && page_mapped(page)) {
> +	if (page_mapped(page) && !PageAnon(page)) {
>  		cpu = smp_processor_id();
>  		/* Update mapped_file data for mem_cgroup "from" */
>  		stat = &from->stat;
>  		cpustat = &stat->cpustat[cpu];
> -		__mem_cgroup_stat_add_safe(cpustat, MEM_CGROUP_STAT_MAPPED_FILE,
> +		__mem_cgroup_stat_add_safe(cpustat, MEM_CGROUP_STAT_FILE_MAPPED,
>  						-1);
>  
>  		/* Update mapped_file data for mem_cgroup "to" */
>  		stat = &to->stat;
>  		cpustat = &stat->cpustat[cpu];
> -		__mem_cgroup_stat_add_safe(cpustat, MEM_CGROUP_STAT_MAPPED_FILE,
> +		__mem_cgroup_stat_add_safe(cpustat, MEM_CGROUP_STAT_FILE_MAPPED,
>  						1);
>  	}
>  
> @@ -2887,7 +2884,7 @@ static int mem_cgroup_reset(struct cgrou
>  enum {
>  	MCS_CACHE,
>  	MCS_RSS,
> -	MCS_MAPPED_FILE,
> +	MCS_FILE_MAPPED,
>  	MCS_PGPGIN,
>  	MCS_PGPGOUT,
>  	MCS_SWAP,
> @@ -2931,8 +2928,8 @@ static int mem_cgroup_get_local_stat(str
>  	s->stat[MCS_CACHE] += val * PAGE_SIZE;
>  	val = mem_cgroup_read_stat(&mem->stat, MEM_CGROUP_STAT_RSS);
>  	s->stat[MCS_RSS] += val * PAGE_SIZE;
> -	val = mem_cgroup_read_stat(&mem->stat, MEM_CGROUP_STAT_MAPPED_FILE);
> -	s->stat[MCS_MAPPED_FILE] += val * PAGE_SIZE;
> +	val = mem_cgroup_read_stat(&mem->stat, MEM_CGROUP_STAT_FILE_MAPPED);
> +	s->stat[MCS_FILE_MAPPED] += val * PAGE_SIZE;
>  	val = mem_cgroup_read_stat(&mem->stat, MEM_CGROUP_STAT_PGPGIN_COUNT);
>  	s->stat[MCS_PGPGIN] += val;
>  	val = mem_cgroup_read_stat(&mem->stat, MEM_CGROUP_STAT_PGPGOUT_COUNT);
> Index: mm-test-kernel/include/linux/memcontrol.h
> ===================================================================
> --- mm-test-kernel.orig/include/linux/memcontrol.h
> +++ mm-test-kernel/include/linux/memcontrol.h
> @@ -122,7 +122,7 @@ static inline bool mem_cgroup_disabled(v
>  }
>  
>  extern bool mem_cgroup_oom_called(struct task_struct *task);
> -void mem_cgroup_update_mapped_file_stat(struct page *page, int val);
> +void mem_cgroup_update_file_mapped(struct page *page, int val);
>  unsigned long mem_cgroup_soft_limit_reclaim(struct zone *zone, int order,
>  						gfp_t gfp_mask, int nid,
>  						int zid);
> @@ -287,7 +287,7 @@ mem_cgroup_print_oom_info(struct mem_cgr
>  {
>  }
>  
> -static inline void mem_cgroup_update_mapped_file_stat(struct page *page,
> +static inline void mem_cgroup_update_file_mapped(struct page *page,
>  							int val)
>  {
>  }
> Index: mm-test-kernel/mm/rmap.c
> ===================================================================
> --- mm-test-kernel.orig/mm/rmap.c
> +++ mm-test-kernel/mm/rmap.c
> @@ -711,7 +711,7 @@ void page_add_file_rmap(struct page *pag
>  {
>  	if (atomic_inc_and_test(&page->_mapcount)) {
>  		__inc_zone_page_state(page, NR_FILE_MAPPED);
> -		mem_cgroup_update_mapped_file_stat(page, 1);
> +		mem_cgroup_update_file_mapped(page, 1);
>  	}
>  }
>  
> @@ -743,8 +743,8 @@ void page_remove_rmap(struct page *page)
>  		__dec_zone_page_state(page, NR_ANON_PAGES);
>  	} else {
>  		__dec_zone_page_state(page, NR_FILE_MAPPED);
> +		mem_cgroup_update_file_mapped(page, -1);
>  	}
> -	mem_cgroup_update_mapped_file_stat(page, -1);
>  	/*
>  	 * It would be tidy to reset the PageAnon mapping here,
>  	 * but that might overwrite a racing page_add_anon_rmap
> 

--
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] 6+ messages in thread

* Re: [PATCH] memcg: make memcg's file mapped consistent with global VM
  2009-10-28  3:16 [PATCH] memcg: make memcg's file mapped consistent with global VM KAMEZAWA Hiroyuki
  2009-10-28  6:37 ` Daisuke Nishimura
@ 2009-10-28  7:18 ` Balbir Singh
  2009-10-28  7:24   ` KAMEZAWA Hiroyuki
  1 sibling, 1 reply; 6+ messages in thread
From: Balbir Singh @ 2009-10-28  7:18 UTC (permalink / raw)
  To: KAMEZAWA Hiroyuki; +Cc: linux-kernel, linux-mm, nishimura, akpm

* KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> [2009-10-28 12:16:19]:

> Based on mmotm-Oct13 + some patches in -mm queue.
> 
> ==
> From: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
> 
> memcg-cleanup-file-mapped-consistent-with-globarl-vm-stat.patch
> 
> In global VM, FILE_MAPPED is used but memcg uses MAPPED_FILE.
> This makes grep difficult. Replace memcg's MAPPED_FILE with FILE_MAPPED
> 
> And in global VM, mapped shared memory is accounted into FILE_MAPPED.
> But memcg doesn't. fix it.

I wanted to explicitly avoid this since I wanted to do an iterative
correct accounting of shared memory. The renaming is fine with me
since we don't break ABI in user space.


-- 
	Balbir

--
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] 6+ messages in thread

* Re: [PATCH] memcg: make memcg's file mapped consistent with global VM
  2009-10-28  7:18 ` Balbir Singh
@ 2009-10-28  7:24   ` KAMEZAWA Hiroyuki
  2009-10-28  7:32     ` Balbir Singh
  0 siblings, 1 reply; 6+ messages in thread
From: KAMEZAWA Hiroyuki @ 2009-10-28  7:24 UTC (permalink / raw)
  To: balbir; +Cc: linux-kernel, linux-mm, nishimura, akpm

On Wed, 28 Oct 2009 12:48:54 +0530
Balbir Singh <balbir@linux.vnet.ibm.com> wrote:

> * KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> [2009-10-28 12:16:19]:
> 
> > Based on mmotm-Oct13 + some patches in -mm queue.
> > 
> > ==
> > From: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
> > 
> > memcg-cleanup-file-mapped-consistent-with-globarl-vm-stat.patch
> > 
> > In global VM, FILE_MAPPED is used but memcg uses MAPPED_FILE.
> > This makes grep difficult. Replace memcg's MAPPED_FILE with FILE_MAPPED
> > 
> > And in global VM, mapped shared memory is accounted into FILE_MAPPED.
> > But memcg doesn't. fix it.
> 
> I wanted to explicitly avoid this since I wanted to do an iterative
> correct accounting of shared memory. The renaming is fine with me
> since we don't break ABI in user space.
> 
To do that, FILE_MAPPED is not correct.
Because MAPPED includes shmem in global VM, no valid reason to do different
style of counting.

For shmem, we have a charge type as MEM_CGROUP_CHARGE_TYPE_SHMEM and 
we can set "PCG_SHMEM" flag onto page_cgroup or some.
Then, we can count it in explicit way. 

Thanks,
-Kame

--
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] 6+ messages in thread

* Re: [PATCH] memcg: make memcg's file mapped consistent with global VM
  2009-10-28  7:24   ` KAMEZAWA Hiroyuki
@ 2009-10-28  7:32     ` Balbir Singh
  2009-10-28  7:44       ` KAMEZAWA Hiroyuki
  0 siblings, 1 reply; 6+ messages in thread
From: Balbir Singh @ 2009-10-28  7:32 UTC (permalink / raw)
  To: KAMEZAWA Hiroyuki; +Cc: linux-kernel, linux-mm, nishimura, akpm

* KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> [2009-10-28 16:24:58]:

> On Wed, 28 Oct 2009 12:48:54 +0530
> Balbir Singh <balbir@linux.vnet.ibm.com> wrote:
> 
> > * KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> [2009-10-28 12:16:19]:
> > 
> > > Based on mmotm-Oct13 + some patches in -mm queue.
> > > 
> > > ==
> > > From: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
> > > 
> > > memcg-cleanup-file-mapped-consistent-with-globarl-vm-stat.patch
> > > 
> > > In global VM, FILE_MAPPED is used but memcg uses MAPPED_FILE.
> > > This makes grep difficult. Replace memcg's MAPPED_FILE with FILE_MAPPED
> > > 
> > > And in global VM, mapped shared memory is accounted into FILE_MAPPED.
> > > But memcg doesn't. fix it.
> > 
> > I wanted to explicitly avoid this since I wanted to do an iterative
> > correct accounting of shared memory. The renaming is fine with me
> > since we don't break ABI in user space.
> > 
> To do that, FILE_MAPPED is not correct.
> Because MAPPED includes shmem in global VM, no valid reason to do different
> style of counting.

OK, fair enough! Lets count shmem in FILE_MAPPED

> 
> For shmem, we have a charge type as MEM_CGROUP_CHARGE_TYPE_SHMEM and 
> we can set "PCG_SHMEM" flag onto page_cgroup or some.
> Then, we can count it in explicit way. 
>

Apart from shmem, I want to count all memory that is shared (mapcount > 1),
I'll send out an RFC once I have the implementation. For now, I
want to focus on testing memcg a bit more and start looking at some
aspects of dirty accounting.

-- 
	Balbir

--
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] 6+ messages in thread

* Re: [PATCH] memcg: make memcg's file mapped consistent with global VM
  2009-10-28  7:32     ` Balbir Singh
@ 2009-10-28  7:44       ` KAMEZAWA Hiroyuki
  0 siblings, 0 replies; 6+ messages in thread
From: KAMEZAWA Hiroyuki @ 2009-10-28  7:44 UTC (permalink / raw)
  To: balbir; +Cc: linux-kernel, linux-mm, nishimura, akpm

On Wed, 28 Oct 2009 13:02:12 +0530
Balbir Singh <balbir@linux.vnet.ibm.com> wrote:

> * KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> [2009-10-28 16:24:58]:
> 
> > On Wed, 28 Oct 2009 12:48:54 +0530
> > Balbir Singh <balbir@linux.vnet.ibm.com> wrote:
> > 
> > > * KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> [2009-10-28 12:16:19]:
> > > 
> > > > Based on mmotm-Oct13 + some patches in -mm queue.
> > > > 
> > > > ==
> > > > From: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
> > > > 
> > > > memcg-cleanup-file-mapped-consistent-with-globarl-vm-stat.patch
> > > > 
> > > > In global VM, FILE_MAPPED is used but memcg uses MAPPED_FILE.
> > > > This makes grep difficult. Replace memcg's MAPPED_FILE with FILE_MAPPED
> > > > 
> > > > And in global VM, mapped shared memory is accounted into FILE_MAPPED.
> > > > But memcg doesn't. fix it.
> > > 
> > > I wanted to explicitly avoid this since I wanted to do an iterative
> > > correct accounting of shared memory. The renaming is fine with me
> > > since we don't break ABI in user space.
> > > 
> > To do that, FILE_MAPPED is not correct.
> > Because MAPPED includes shmem in global VM, no valid reason to do different
> > style of counting.
> 
> OK, fair enough! Lets count shmem in FILE_MAPPED
> 
> > 
> > For shmem, we have a charge type as MEM_CGROUP_CHARGE_TYPE_SHMEM and 
> > we can set "PCG_SHMEM" flag onto page_cgroup or some.
> > Then, we can count it in explicit way. 
> >
> 
> Apart from shmem, I want to count all memory that is shared (mapcount > 1),
> I'll send out an RFC once I have the implementation.

I recommend you to start from adding new statistics to global VM to show that.
(Then, we don't need to say "this is a special counter for memcg.....)

> For now, I
> want to focus on testing memcg a bit more and start looking at some
> aspects of dirty accounting.
> 
I'm now cleaning up and test array counter (I posted before.) which works as
vm_stat[] for memcg. Maybe it will be useful.

A bit off-topic, let me show my current TO-DO-LIST.

  - implementing a counter like vm_stat[]
  - wait for Nishimura's task move patches.
  - implementing dirty_page accounting in very simple style.
  - implementing dirty_page limiting or kicking flusher thread for memcg.
  - fix oom-killer related things.
  - some necessary clean-ups.
  - implementing memory usage notifier or oom-notifier to userland.
  - helping I/O controller for buffered I/O tracking.

Because I don't fix priority of each jobs, someone unknown may finish
before I start ;)

Thanks,
-Kame



--
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] 6+ messages in thread

end of thread, other threads:[~2009-10-28  7:47 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-10-28  3:16 [PATCH] memcg: make memcg's file mapped consistent with global VM KAMEZAWA Hiroyuki
2009-10-28  6:37 ` Daisuke Nishimura
2009-10-28  7:18 ` Balbir Singh
2009-10-28  7:24   ` KAMEZAWA Hiroyuki
2009-10-28  7:32     ` Balbir Singh
2009-10-28  7:44       ` KAMEZAWA Hiroyuki

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox