Re: [patch 04/11] mm: memcg: push down PageSwapCache check into uncharge entry functions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Jul 09, 2012 at 11:42:12AM +0900, Kamezawa Hiroyuki wrote:
> (2012/07/05 9:44), Johannes Weiner wrote:
> > @@ -3278,10 +3283,11 @@ void mem_cgroup_end_migration(struct mem_cgroup *memcg,
> >   		unused = oldpage;
> >   	}
> >   	anon = PageAnon(used);
> > -	__mem_cgroup_uncharge_common(unused,
> > -		anon ? MEM_CGROUP_CHARGE_TYPE_ANON
> > -		     : MEM_CGROUP_CHARGE_TYPE_CACHE,
> > -		true);
> > +	if (!PageSwapCache(page))
> > +		__mem_cgroup_uncharge_common(unused,
> > +					     anon ? MEM_CGROUP_CHARGE_TYPE_ANON
> > +					     : MEM_CGROUP_CHARGE_TYPE_CACHE,
> > +					     true);
> 
> !PageSwapCache(unused) ?

Argh, right.

> But I think unused page's PG_swapcache is always dropped. So, the check is
> not necessary.

Oh, this is intentional: the check was in __mem_cgroup_uncharge_common
before, which means it applied to this entry point as well.  This is
supposed to be a mechanical change that does not change any logic.
The check is then removed in the next patch.

---
Subject: mm: memcg: push down PageSwapCache check into uncharge entry functions fix

Signed-off-by: Johannes Weiner <hannes@xxxxxxxxxxx>
---

diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index a3bf414..f4ff18a 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -3283,7 +3283,7 @@ void mem_cgroup_end_migration(struct mem_cgroup *memcg,
 		unused = oldpage;
 	}
 	anon = PageAnon(used);
-	if (!PageSwapCache(page))
+	if (!PageSwapCache(unused))
 		__mem_cgroup_uncharge_common(unused,
 					     anon ? MEM_CGROUP_CHARGE_TYPE_ANON
 					     : MEM_CGROUP_CHARGE_TYPE_CACHE,

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@xxxxxxxxx.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@xxxxxxxxx";> email@xxxxxxxxx </a>


[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]