linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [cleanup][PATCH -mmotm 1/2] memcg: remove redundant codes
@ 2010-06-07  5:52 Daisuke Nishimura
  2010-06-07  5:53 ` [cleanup][PATCH -mmotm 2/2] memcg: remove mem from arg of charge_common Daisuke Nishimura
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Daisuke Nishimura @ 2010-06-07  5:52 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Balbir Singh, KAMEZAWA Hiroyuki, LKML, linux-mm,
	Daisuke Nishimura

These patches are based on mmotm-2010-06-03-16-36 + some already merged patches
for memcg.

===
From: Daisuke Nishimura <nishimura@mxp.nes.nec.co.jp>

- try_get_mem_cgroup_from_mm() calls rcu_read_lock/unlock by itself, so we
  don't have to call them in task_in_mem_cgroup().
- *mz is not used in __mem_cgroup_uncharge_common().
- we don't have to call lookup_page_cgroup() in mem_cgroup_end_migration()
  after we've cleared PCG_MIGRATION of @oldpage.
- remove empty comment.
- remove redundant empty line in mem_cgroup_cache_charge().

Signed-off-by: Daisuke Nishimura <nishimura@mxp.nes.nec.co.jp>
---
 mm/memcontrol.c |   10 ----------
 1 files changed, 0 insertions(+), 10 deletions(-)

diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 9c1d227..7146055 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -840,9 +840,7 @@ int task_in_mem_cgroup(struct task_struct *task, const struct mem_cgroup *mem)
 	struct mem_cgroup *curr = NULL;
 
 	task_lock(task);
-	rcu_read_lock();
 	curr = try_get_mem_cgroup_from_mm(task->mm);
-	rcu_read_unlock();
 	task_unlock(task);
 	if (!curr)
 		return 0;
@@ -2099,7 +2097,6 @@ int mem_cgroup_cache_charge(struct page *page, struct mm_struct *mm,
 	if (!(gfp_mask & __GFP_WAIT)) {
 		struct page_cgroup *pc;
 
-
 		pc = lookup_page_cgroup(page);
 		if (!pc)
 			return 0;
@@ -2293,7 +2290,6 @@ __mem_cgroup_uncharge_common(struct page *page, enum charge_type ctype)
 {
 	struct page_cgroup *pc;
 	struct mem_cgroup *mem = NULL;
-	struct mem_cgroup_per_zone *mz;
 
 	if (mem_cgroup_disabled())
 		return NULL;
@@ -2347,7 +2343,6 @@ __mem_cgroup_uncharge_common(struct page *page, enum charge_type ctype)
 	 * special functions.
 	 */
 
-	mz = page_cgroup_zoneinfo(pc);
 	unlock_page_cgroup(pc);
 
 	memcg_check_events(mem, page);
@@ -2659,11 +2654,8 @@ void mem_cgroup_end_migration(struct mem_cgroup *mem,
 	ClearPageCgroupMigration(pc);
 	unlock_page_cgroup(pc);
 
-	if (unused != oldpage)
-		pc = lookup_page_cgroup(unused);
 	__mem_cgroup_uncharge_common(unused, MEM_CGROUP_CHARGE_TYPE_FORCE);
 
-	pc = lookup_page_cgroup(used);
 	/*
 	 * If a page is a file cache, radix-tree replacement is very atomic
 	 * and we can skip this check. When it was an Anon page, its mapcount
@@ -3807,8 +3799,6 @@ static int mem_cgroup_oom_control_read(struct cgroup *cgrp,
 	return 0;
 }
 
-/*
- */
 static int mem_cgroup_oom_control_write(struct cgroup *cgrp,
 	struct cftype *cft, u64 val)
 {
-- 
1.6.5.2

--
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 related	[flat|nested] 5+ messages in thread

* [cleanup][PATCH -mmotm 2/2] memcg: remove mem from arg of charge_common
  2010-06-07  5:52 [cleanup][PATCH -mmotm 1/2] memcg: remove redundant codes Daisuke Nishimura
@ 2010-06-07  5:53 ` Daisuke Nishimura
  2010-06-07  6:05   ` KAMEZAWA Hiroyuki
  2010-06-07  6:02 ` [cleanup][PATCH -mmotm 1/2] memcg: remove redundant codes KAMEZAWA Hiroyuki
  2010-06-07  6:54 ` Balbir Singh
  2 siblings, 1 reply; 5+ messages in thread
From: Daisuke Nishimura @ 2010-06-07  5:53 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Balbir Singh, KAMEZAWA Hiroyuki, LKML, linux-mm,
	Daisuke Nishimura

From: Daisuke Nishimura <nishimura@mxp.nes.nec.co.jp>

mem_cgroup_charge_common() is always called with @mem = NULL, so it's
meaningless. This patch removes it.

Signed-off-by: Daisuke Nishimura <nishimura@mxp.nes.nec.co.jp>
---
 mm/memcontrol.c |   17 ++++++++---------
 1 files changed, 8 insertions(+), 9 deletions(-)

diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 7146055..8f57ec2 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -2025,10 +2025,9 @@ out:
  * < 0 if the cgroup is over its limit
  */
 static int mem_cgroup_charge_common(struct page *page, struct mm_struct *mm,
-				gfp_t gfp_mask, enum charge_type ctype,
-				struct mem_cgroup *memcg)
+				gfp_t gfp_mask, enum charge_type ctype)
 {
-	struct mem_cgroup *mem;
+	struct mem_cgroup *mem = NULL;
 	struct page_cgroup *pc;
 	int ret;
 
@@ -2038,7 +2037,6 @@ static int mem_cgroup_charge_common(struct page *page, struct mm_struct *mm,
 		return 0;
 	prefetchw(pc);
 
-	mem = memcg;
 	ret = __mem_cgroup_try_charge(mm, gfp_mask, &mem, true);
 	if (ret || !mem)
 		return ret;
@@ -2066,7 +2064,7 @@ int mem_cgroup_newpage_charge(struct page *page,
 	if (unlikely(!mm))
 		mm = &init_mm;
 	return mem_cgroup_charge_common(page, mm, gfp_mask,
-				MEM_CGROUP_CHARGE_TYPE_MAPPED, NULL);
+				MEM_CGROUP_CHARGE_TYPE_MAPPED);
 }
 
 static void
@@ -2076,7 +2074,6 @@ __mem_cgroup_commit_charge_swapin(struct page *page, struct mem_cgroup *ptr,
 int mem_cgroup_cache_charge(struct page *page, struct mm_struct *mm,
 				gfp_t gfp_mask)
 {
-	struct mem_cgroup *mem = NULL;
 	int ret;
 
 	if (mem_cgroup_disabled())
@@ -2108,22 +2105,24 @@ int mem_cgroup_cache_charge(struct page *page, struct mm_struct *mm,
 		unlock_page_cgroup(pc);
 	}
 
-	if (unlikely(!mm && !mem))
+	if (unlikely(!mm))
 		mm = &init_mm;
 
 	if (page_is_file_cache(page))
 		return mem_cgroup_charge_common(page, mm, gfp_mask,
-				MEM_CGROUP_CHARGE_TYPE_CACHE, NULL);
+				MEM_CGROUP_CHARGE_TYPE_CACHE);
 
 	/* shmem */
 	if (PageSwapCache(page)) {
+		struct mem_cgroup *mem = NULL;
+
 		ret = mem_cgroup_try_charge_swapin(mm, page, gfp_mask, &mem);
 		if (!ret)
 			__mem_cgroup_commit_charge_swapin(page, mem,
 					MEM_CGROUP_CHARGE_TYPE_SHMEM);
 	} else
 		ret = mem_cgroup_charge_common(page, mm, gfp_mask,
-					MEM_CGROUP_CHARGE_TYPE_SHMEM, mem);
+					MEM_CGROUP_CHARGE_TYPE_SHMEM);
 
 	return ret;
 }
-- 
1.6.5.2

--
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 related	[flat|nested] 5+ messages in thread

* Re: [cleanup][PATCH -mmotm 1/2] memcg: remove redundant codes
  2010-06-07  5:52 [cleanup][PATCH -mmotm 1/2] memcg: remove redundant codes Daisuke Nishimura
  2010-06-07  5:53 ` [cleanup][PATCH -mmotm 2/2] memcg: remove mem from arg of charge_common Daisuke Nishimura
@ 2010-06-07  6:02 ` KAMEZAWA Hiroyuki
  2010-06-07  6:54 ` Balbir Singh
  2 siblings, 0 replies; 5+ messages in thread
From: KAMEZAWA Hiroyuki @ 2010-06-07  6:02 UTC (permalink / raw)
  To: Daisuke Nishimura; +Cc: Andrew Morton, Balbir Singh, LKML, linux-mm

On Mon, 7 Jun 2010 14:52:39 +0900
Daisuke Nishimura <nishimura@mxp.nes.nec.co.jp> wrote:

> These patches are based on mmotm-2010-06-03-16-36 + some already merged patches
> for memcg.
> 
> ===
> From: Daisuke Nishimura <nishimura@mxp.nes.nec.co.jp>
> 
> - try_get_mem_cgroup_from_mm() calls rcu_read_lock/unlock by itself, so we
>   don't have to call them in task_in_mem_cgroup().
> - *mz is not used in __mem_cgroup_uncharge_common().
> - we don't have to call lookup_page_cgroup() in mem_cgroup_end_migration()
>   after we've cleared PCG_MIGRATION of @oldpage.
> - remove empty comment.
> - remove redundant empty line in mem_cgroup_cache_charge().
> 
> Signed-off-by: Daisuke Nishimura <nishimura@mxp.nes.nec.co.jp>
Acked-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>


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

* Re: [cleanup][PATCH -mmotm 2/2] memcg: remove mem from arg of charge_common
  2010-06-07  5:53 ` [cleanup][PATCH -mmotm 2/2] memcg: remove mem from arg of charge_common Daisuke Nishimura
@ 2010-06-07  6:05   ` KAMEZAWA Hiroyuki
  0 siblings, 0 replies; 5+ messages in thread
From: KAMEZAWA Hiroyuki @ 2010-06-07  6:05 UTC (permalink / raw)
  To: Daisuke Nishimura; +Cc: Andrew Morton, Balbir Singh, LKML, linux-mm

On Mon, 7 Jun 2010 14:53:37 +0900
Daisuke Nishimura <nishimura@mxp.nes.nec.co.jp> wrote:

> From: Daisuke Nishimura <nishimura@mxp.nes.nec.co.jp>
> 
> mem_cgroup_charge_common() is always called with @mem = NULL, so it's
> meaningless. This patch removes it.
> 
> Signed-off-by: Daisuke Nishimura <nishimura@mxp.nes.nec.co.jp>

Acked-by: KAMEZAWA Hioryuki <kamezawa.hiroyu@jp.fujitsu.com>

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

* Re: [cleanup][PATCH -mmotm 1/2] memcg: remove redundant codes
  2010-06-07  5:52 [cleanup][PATCH -mmotm 1/2] memcg: remove redundant codes Daisuke Nishimura
  2010-06-07  5:53 ` [cleanup][PATCH -mmotm 2/2] memcg: remove mem from arg of charge_common Daisuke Nishimura
  2010-06-07  6:02 ` [cleanup][PATCH -mmotm 1/2] memcg: remove redundant codes KAMEZAWA Hiroyuki
@ 2010-06-07  6:54 ` Balbir Singh
  2 siblings, 0 replies; 5+ messages in thread
From: Balbir Singh @ 2010-06-07  6:54 UTC (permalink / raw)
  To: Daisuke Nishimura; +Cc: Andrew Morton, KAMEZAWA Hiroyuki, LKML, linux-mm

* nishimura@mxp.nes.nec.co.jp <nishimura@mxp.nes.nec.co.jp> [2010-06-07 14:52:39]:

> These patches are based on mmotm-2010-06-03-16-36 + some already merged patches
> for memcg.
> 
> ===
> From: Daisuke Nishimura <nishimura@mxp.nes.nec.co.jp>
> 
> - try_get_mem_cgroup_from_mm() calls rcu_read_lock/unlock by itself, so we
>   don't have to call them in task_in_mem_cgroup().
> - *mz is not used in __mem_cgroup_uncharge_common().
> - we don't have to call lookup_page_cgroup() in mem_cgroup_end_migration()
>   after we've cleared PCG_MIGRATION of @oldpage.
> - remove empty comment.
> - remove redundant empty line in mem_cgroup_cache_charge().
> 
> Signed-off-by: Daisuke Nishimura <nishimura@mxp.nes.nec.co.jp>


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

-- 
	Three Cheers,
	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] 5+ messages in thread

end of thread, other threads:[~2010-06-07  6:54 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-06-07  5:52 [cleanup][PATCH -mmotm 1/2] memcg: remove redundant codes Daisuke Nishimura
2010-06-07  5:53 ` [cleanup][PATCH -mmotm 2/2] memcg: remove mem from arg of charge_common Daisuke Nishimura
2010-06-07  6:05   ` KAMEZAWA Hiroyuki
2010-06-07  6:02 ` [cleanup][PATCH -mmotm 1/2] memcg: remove redundant codes KAMEZAWA Hiroyuki
2010-06-07  6:54 ` Balbir Singh

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).