linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] memcg: avoid unnecessary initialization
@ 2008-05-09  5:59 KAMEZAWA Hiroyuki
  2008-05-09  6:07 ` Li Zefan
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: KAMEZAWA Hiroyuki @ 2008-05-09  5:59 UTC (permalink / raw)
  To: LKML
  Cc: linux-mm@kvack.org, Andrew Morton, balbir@linux.vnet.ibm.com,
	xemul@openvz.org, yamamoto@valinux.co.jp, lizf@cn.fujitsu.com

An easy cut out from memcg: performance improvement patch set.
Tested on: x86-64/linux-2.6.26-rc1-git6

Thanks,
-Kame
==
* remove over-killing initialization (in fast path)
* makeing the condition for PAGE_CGROUP_FLAG_ACTIVE be more obvious.

Signed-off-by: KAMEAZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>

---
 mm/memcontrol.c |   11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

Index: linux-2.6.26-rc1/mm/memcontrol.c
===================================================================
--- linux-2.6.26-rc1.orig/mm/memcontrol.c
+++ linux-2.6.26-rc1/mm/memcontrol.c
@@ -296,7 +296,7 @@ static void __mem_cgroup_remove_list(str
 		MEM_CGROUP_ZSTAT(mz, MEM_CGROUP_ZSTAT_INACTIVE) -= 1;
 
 	mem_cgroup_charge_statistics(pc->mem_cgroup, pc->flags, false);
-	list_del_init(&pc->lru);
+	list_del(&pc->lru);
 }
 
 static void __mem_cgroup_add_list(struct mem_cgroup_per_zone *mz,
@@ -559,7 +559,7 @@ retry:
 	}
 	unlock_page_cgroup(page);
 
-	pc = kmem_cache_zalloc(page_cgroup_cache, gfp_mask);
+	pc = kmem_cache_alloc(page_cgroup_cache, gfp_mask);
 	if (pc == NULL)
 		goto err;
 
@@ -606,9 +606,14 @@ retry:
 	pc->ref_cnt = 1;
 	pc->mem_cgroup = mem;
 	pc->page = page;
-	pc->flags = PAGE_CGROUP_FLAG_ACTIVE;
+	/*
+	 * If a page is accounted as a page cache, insert to inactive list.
+	 * If anon, insert to active list.
+	 */
 	if (ctype == MEM_CGROUP_CHARGE_TYPE_CACHE)
 		pc->flags = PAGE_CGROUP_FLAG_CACHE;
+	else
+		pc->flags = PAGE_CGROUP_FLAG_ACTIVE;
 
 	lock_page_cgroup(page);
 	if (page_get_page_cgroup(page)) {

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

* Re: [PATCH] memcg: avoid unnecessary initialization
  2008-05-09  5:59 [PATCH] memcg: avoid unnecessary initialization KAMEZAWA Hiroyuki
@ 2008-05-09  6:07 ` Li Zefan
  2008-05-09  6:23 ` Balbir Singh
  2008-05-12  9:29 ` Pavel Emelyanov
  2 siblings, 0 replies; 4+ messages in thread
From: Li Zefan @ 2008-05-09  6:07 UTC (permalink / raw)
  To: KAMEZAWA Hiroyuki
  Cc: LKML, linux-mm@kvack.org, Andrew Morton,
	balbir@linux.vnet.ibm.com, xemul@openvz.org,
	yamamoto@valinux.co.jp

KAMEZAWA Hiroyuki wrote:
> An easy cut out from memcg: performance improvement patch set.
> Tested on: x86-64/linux-2.6.26-rc1-git6
> 
> Thanks,
> -Kame
> ==
> * remove over-killing initialization (in fast path)
> * makeing the condition for PAGE_CGROUP_FLAG_ACTIVE be more obvious.
> 
> Signed-off-by: KAMEAZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
> 

Yes we don't need to init or del_init pc->lru.

Reviewed-by: Li Zefan <lizf@cn.fujitsu.com>

> ---
>  mm/memcontrol.c |   11 ++++++++---
>  1 file changed, 8 insertions(+), 3 deletions(-)
> 
> Index: linux-2.6.26-rc1/mm/memcontrol.c
> ===================================================================
> --- linux-2.6.26-rc1.orig/mm/memcontrol.c
> +++ linux-2.6.26-rc1/mm/memcontrol.c
> @@ -296,7 +296,7 @@ static void __mem_cgroup_remove_list(str
>  		MEM_CGROUP_ZSTAT(mz, MEM_CGROUP_ZSTAT_INACTIVE) -= 1;
>  
>  	mem_cgroup_charge_statistics(pc->mem_cgroup, pc->flags, false);
> -	list_del_init(&pc->lru);
> +	list_del(&pc->lru);
>  }
>  
>  static void __mem_cgroup_add_list(struct mem_cgroup_per_zone *mz,
> @@ -559,7 +559,7 @@ retry:
>  	}
>  	unlock_page_cgroup(page);
>  
> -	pc = kmem_cache_zalloc(page_cgroup_cache, gfp_mask);
> +	pc = kmem_cache_alloc(page_cgroup_cache, gfp_mask);
>  	if (pc == NULL)
>  		goto err;
>  
> @@ -606,9 +606,14 @@ retry:
>  	pc->ref_cnt = 1;
>  	pc->mem_cgroup = mem;
>  	pc->page = page;
> -	pc->flags = PAGE_CGROUP_FLAG_ACTIVE;
> +	/*
> +	 * If a page is accounted as a page cache, insert to inactive list.
> +	 * If anon, insert to active list.
> +	 */
>  	if (ctype == MEM_CGROUP_CHARGE_TYPE_CACHE)
>  		pc->flags = PAGE_CGROUP_FLAG_CACHE;
> +	else
> +		pc->flags = PAGE_CGROUP_FLAG_ACTIVE;
>  
>  	lock_page_cgroup(page);
>  	if (page_get_page_cgroup(page)) {
> 
> 
> 

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

* Re: [PATCH] memcg: avoid unnecessary initialization
  2008-05-09  5:59 [PATCH] memcg: avoid unnecessary initialization KAMEZAWA Hiroyuki
  2008-05-09  6:07 ` Li Zefan
@ 2008-05-09  6:23 ` Balbir Singh
  2008-05-12  9:29 ` Pavel Emelyanov
  2 siblings, 0 replies; 4+ messages in thread
From: Balbir Singh @ 2008-05-09  6:23 UTC (permalink / raw)
  To: KAMEZAWA Hiroyuki
  Cc: LKML, linux-mm@kvack.org, Andrew Morton, xemul@openvz.org,
	yamamoto@valinux.co.jp, lizf@cn.fujitsu.com

KAMEZAWA Hiroyuki wrote:
> An easy cut out from memcg: performance improvement patch set.
> Tested on: x86-64/linux-2.6.26-rc1-git6
> 
> Thanks,
> -Kame
> ==
> * remove over-killing initialization (in fast path)
> * makeing the condition for PAGE_CGROUP_FLAG_ACTIVE be more obvious.
> 
> Signed-off-by: KAMEAZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
> 
> ---
>  mm/memcontrol.c |   11 ++++++++---
>  1 file changed, 8 insertions(+), 3 deletions(-)
> 
> Index: linux-2.6.26-rc1/mm/memcontrol.c
> ===================================================================
> --- linux-2.6.26-rc1.orig/mm/memcontrol.c
> +++ linux-2.6.26-rc1/mm/memcontrol.c
> @@ -296,7 +296,7 @@ static void __mem_cgroup_remove_list(str
>  		MEM_CGROUP_ZSTAT(mz, MEM_CGROUP_ZSTAT_INACTIVE) -= 1;
> 
>  	mem_cgroup_charge_statistics(pc->mem_cgroup, pc->flags, false);
> -	list_del_init(&pc->lru);
> +	list_del(&pc->lru);
>  }
> 
>  static void __mem_cgroup_add_list(struct mem_cgroup_per_zone *mz,
> @@ -559,7 +559,7 @@ retry:
>  	}
>  	unlock_page_cgroup(page);
> 
> -	pc = kmem_cache_zalloc(page_cgroup_cache, gfp_mask);
> +	pc = kmem_cache_alloc(page_cgroup_cache, gfp_mask);
>  	if (pc == NULL)
>  		goto err;
> 
> @@ -606,9 +606,14 @@ retry:
>  	pc->ref_cnt = 1;
>  	pc->mem_cgroup = mem;
>  	pc->page = page;
> -	pc->flags = PAGE_CGROUP_FLAG_ACTIVE;
> +	/*
> +	 * If a page is accounted as a page cache, insert to inactive list.
> +	 * If anon, insert to active list.
> +	 */
>  	if (ctype == MEM_CGROUP_CHARGE_TYPE_CACHE)
>  		pc->flags = PAGE_CGROUP_FLAG_CACHE;
> +	else
> +		pc->flags = PAGE_CGROUP_FLAG_ACTIVE;
> 
>  	lock_page_cgroup(page);
>  	if (page_get_page_cgroup(page)) {


Looks good to me

Acked-by: Balbir Singh <balbir@linux.vnet.ibm.com>


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

* Re: [PATCH] memcg: avoid unnecessary initialization
  2008-05-09  5:59 [PATCH] memcg: avoid unnecessary initialization KAMEZAWA Hiroyuki
  2008-05-09  6:07 ` Li Zefan
  2008-05-09  6:23 ` Balbir Singh
@ 2008-05-12  9:29 ` Pavel Emelyanov
  2 siblings, 0 replies; 4+ messages in thread
From: Pavel Emelyanov @ 2008-05-12  9:29 UTC (permalink / raw)
  To: KAMEZAWA Hiroyuki
  Cc: LKML, linux-mm@kvack.org, Andrew Morton,
	balbir@linux.vnet.ibm.com, yamamoto@valinux.co.jp,
	lizf@cn.fujitsu.com

KAMEZAWA Hiroyuki wrote:
> An easy cut out from memcg: performance improvement patch set.
> Tested on: x86-64/linux-2.6.26-rc1-git6
> 
> Thanks,
> -Kame
> ==
> * remove over-killing initialization (in fast path)
> * makeing the condition for PAGE_CGROUP_FLAG_ACTIVE be more obvious.
> 
> Signed-off-by: KAMEAZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>

Acked-by: Pavel Emelyanov <xemul@openvz.org>

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

end of thread, other threads:[~2008-05-12  9:29 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-05-09  5:59 [PATCH] memcg: avoid unnecessary initialization KAMEZAWA Hiroyuki
2008-05-09  6:07 ` Li Zefan
2008-05-09  6:23 ` Balbir Singh
2008-05-12  9:29 ` Pavel Emelyanov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).