linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [patch] mm: memcg: update the correct soft limit tree during migration
@ 2012-01-13 15:41 Johannes Weiner
  2012-01-13 15:59 ` Michal Hocko
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Johannes Weiner @ 2012-01-13 15:41 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Hugh Dickins, KAMEZAWA Hiroyuki, Michal Hocko, linux-mm,
	linux-kernel

end_migration() passes the old page instead of the new page to commit
the charge.  This page descriptor is not used for committing itself,
though, since we also pass the (correct) page_cgroup descriptor.  But
it's used to find the soft limit tree through the page's zone, so the
soft limit tree of the old page's zone is updated instead of that of
the new page's, which might get slightly out of date until the next
charge reaches the ratelimit point.

This glitch has been present since '5564e88 memcg: condense
page_cgroup-to-page lookup points'.

Reported-by: Hugh Dickins <hughd@google.com>
Signed-off-by: Johannes Weiner <hannes@cmpxchg.org>
---
 mm/memcontrol.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

This fixes a bug that I introduced in 2.6.38.  It's benign enough (to
my knowledge) that we probably don't want this for stable.

diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 602207b..7a292a5 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -3247,7 +3247,7 @@ int mem_cgroup_prepare_migration(struct page *page,
 		ctype = MEM_CGROUP_CHARGE_TYPE_CACHE;
 	else
 		ctype = MEM_CGROUP_CHARGE_TYPE_SHMEM;
-	__mem_cgroup_commit_charge(memcg, page, 1, pc, ctype);
+	__mem_cgroup_commit_charge(memcg, newpage, 1, pc, ctype);
 	return ret;
 }
 
-- 
1.7.7.5

--
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/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [patch] mm: memcg: update the correct soft limit tree during migration
  2012-01-13 15:41 [patch] mm: memcg: update the correct soft limit tree during migration Johannes Weiner
@ 2012-01-13 15:59 ` Michal Hocko
  2012-01-16  5:48 ` KAMEZAWA Hiroyuki
  2012-01-16 12:43 ` Kirill A. Shutemov
  2 siblings, 0 replies; 4+ messages in thread
From: Michal Hocko @ 2012-01-13 15:59 UTC (permalink / raw)
  To: Johannes Weiner
  Cc: Andrew Morton, Hugh Dickins, KAMEZAWA Hiroyuki, linux-mm,
	linux-kernel

On Fri 13-01-12 16:41:31, Johannes Weiner wrote:
> end_migration() passes the old page instead of the new page to commit
> the charge.  This page descriptor is not used for committing itself,
> though, since we also pass the (correct) page_cgroup descriptor.  But
> it's used to find the soft limit tree through the page's zone, so the
> soft limit tree of the old page's zone is updated instead of that of
> the new page's, which might get slightly out of date until the next
> charge reaches the ratelimit point.
> 
> This glitch has been present since '5564e88 memcg: condense
> page_cgroup-to-page lookup points'.
> 
> Reported-by: Hugh Dickins <hughd@google.com>
> Signed-off-by: Johannes Weiner <hannes@cmpxchg.org>

Well spotted.
Acked-by: Michal Hocko <mhocko@suse.cz>

Thanks
> ---
>  mm/memcontrol.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> This fixes a bug that I introduced in 2.6.38.  It's benign enough (to
> my knowledge) that we probably don't want this for stable.
> 
> diff --git a/mm/memcontrol.c b/mm/memcontrol.c
> index 602207b..7a292a5 100644
> --- a/mm/memcontrol.c
> +++ b/mm/memcontrol.c
> @@ -3247,7 +3247,7 @@ int mem_cgroup_prepare_migration(struct page *page,
>  		ctype = MEM_CGROUP_CHARGE_TYPE_CACHE;
>  	else
>  		ctype = MEM_CGROUP_CHARGE_TYPE_SHMEM;
> -	__mem_cgroup_commit_charge(memcg, page, 1, pc, ctype);
> +	__mem_cgroup_commit_charge(memcg, newpage, 1, pc, ctype);
>  	return ret;
>  }
>  
> -- 
> 1.7.7.5
> 

-- 
Michal Hocko
SUSE Labs
SUSE LINUX s.r.o.
Lihovarska 1060/12
190 00 Praha 9    
Czech Republic

--
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/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [patch] mm: memcg: update the correct soft limit tree during migration
  2012-01-13 15:41 [patch] mm: memcg: update the correct soft limit tree during migration Johannes Weiner
  2012-01-13 15:59 ` Michal Hocko
@ 2012-01-16  5:48 ` KAMEZAWA Hiroyuki
  2012-01-16 12:43 ` Kirill A. Shutemov
  2 siblings, 0 replies; 4+ messages in thread
From: KAMEZAWA Hiroyuki @ 2012-01-16  5:48 UTC (permalink / raw)
  To: Johannes Weiner
  Cc: Andrew Morton, Hugh Dickins, Michal Hocko, linux-mm, linux-kernel

On Fri, 13 Jan 2012 16:41:31 +0100
Johannes Weiner <hannes@cmpxchg.org> wrote:

> end_migration() passes the old page instead of the new page to commit
> the charge.  This page descriptor is not used for committing itself,
> though, since we also pass the (correct) page_cgroup descriptor.  But
> it's used to find the soft limit tree through the page's zone, so the
> soft limit tree of the old page's zone is updated instead of that of
> the new page's, which might get slightly out of date until the next
> charge reaches the ratelimit point.
> 
> This glitch has been present since '5564e88 memcg: condense
> page_cgroup-to-page lookup points'.
> 
> Reported-by: Hugh Dickins <hughd@google.com>
> Signed-off-by: Johannes Weiner <hannes@cmpxchg.org>
> ---
>  mm/memcontrol.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> This fixes a bug that I introduced in 2.6.38.  It's benign enough (to
> my knowledge) that we probably don't want this for stable.
> 
> diff --git a/mm/memcontrol.c b/mm/memcontrol.c
> index 602207b..7a292a5 100644
> --- a/mm/memcontrol.c
> +++ b/mm/memcontrol.c
> @@ -3247,7 +3247,7 @@ int mem_cgroup_prepare_migration(struct page *page,
>  		ctype = MEM_CGROUP_CHARGE_TYPE_CACHE;
>  	else
>  		ctype = MEM_CGROUP_CHARGE_TYPE_SHMEM;
> -	__mem_cgroup_commit_charge(memcg, page, 1, pc, ctype);
> +	__mem_cgroup_commit_charge(memcg, newpage, 1, pc, ctype);
>  	return ret;
>  }
>  


Nice Catch.
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/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [patch] mm: memcg: update the correct soft limit tree during migration
  2012-01-13 15:41 [patch] mm: memcg: update the correct soft limit tree during migration Johannes Weiner
  2012-01-13 15:59 ` Michal Hocko
  2012-01-16  5:48 ` KAMEZAWA Hiroyuki
@ 2012-01-16 12:43 ` Kirill A. Shutemov
  2 siblings, 0 replies; 4+ messages in thread
From: Kirill A. Shutemov @ 2012-01-16 12:43 UTC (permalink / raw)
  To: Johannes Weiner
  Cc: Andrew Morton, Hugh Dickins, KAMEZAWA Hiroyuki, Michal Hocko,
	linux-mm, linux-kernel

On Fri, Jan 13, 2012 at 04:41:31PM +0100, Johannes Weiner wrote:
> end_migration() passes the old page instead of the new page to commit
> the charge.  This page descriptor is not used for committing itself,
> though, since we also pass the (correct) page_cgroup descriptor.  But
> it's used to find the soft limit tree through the page's zone, so the
> soft limit tree of the old page's zone is updated instead of that of
> the new page's, which might get slightly out of date until the next
> charge reaches the ratelimit point.
> 
> This glitch has been present since '5564e88 memcg: condense
> page_cgroup-to-page lookup points'.
> 
> Reported-by: Hugh Dickins <hughd@google.com>
> Signed-off-by: Johannes Weiner <hannes@cmpxchg.org>

Acked-by: Kirill A. Shutemov <kirill@shutemov.name>


-- 
 Kirill A. Shutemov

--
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/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
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:[~2012-01-16 12:42 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-01-13 15:41 [patch] mm: memcg: update the correct soft limit tree during migration Johannes Weiner
2012-01-13 15:59 ` Michal Hocko
2012-01-16  5:48 ` KAMEZAWA Hiroyuki
2012-01-16 12:43 ` Kirill A. Shutemov

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