All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michal Hocko <mhocko@suse.cz>
To: Johannes Weiner <hannes@cmpxchg.org>
Cc: Tim Chen <tim.c.chen@linux.intel.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Mel Gorman <mel@csn.ul.ie>,
	KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>,
	Minchan Kim <minchan@kernel.org>,
	"Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>,
	"andi.kleen" <andi.kleen@intel.com>,
	linux-mm <linux-mm@kvack.org>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] Cgroup: Fix memory accounting scalability in shrink_page_list
Date: Fri, 20 Jul 2012 18:31:15 +0200	[thread overview]
Message-ID: <20120720163115.GA20765@tiehlicka.suse.cz> (raw)
In-Reply-To: <20120720151216.GB1426@cmpxchg.org>

On Fri 20-07-12 17:12:16, Johannes Weiner wrote:
> On Fri, Jul 20, 2012 at 04:38:48PM +0200, Michal Hocko wrote:
> > On Fri 20-07-12 16:16:25, Johannes Weiner wrote:
> > > On Fri, Jul 20, 2012 at 03:53:29PM +0200, Michal Hocko wrote:
> > > > On Thu 19-07-12 16:34:26, Tim Chen wrote:
> > > > [...]
> > > > > diff --git a/mm/vmscan.c b/mm/vmscan.c
> > > > > index 33dc256..aac5672 100644
> > > > > --- a/mm/vmscan.c
> > > > > +++ b/mm/vmscan.c
> > > > > @@ -779,6 +779,7 @@ static unsigned long shrink_page_list(struct list_head *page_list,
> > > > >  
> > > > >  	cond_resched();
> > > > >  
> > > > > +	mem_cgroup_uncharge_start();
> > > > >  	while (!list_empty(page_list)) {
> > > > >  		enum page_references references;
> > > > >  		struct address_space *mapping;
> > > > 
> > > > Is this safe? We have a scheduling point few lines below. What prevents
> > > > from task move while we are in the middle of the batch?
> > > 
> > > The batch is accounted in task_struct, so moving a batching task to
> > > another CPU shouldn't be a problem.
> > 
> > But it could also move to a different group, right?
> 
> The batch-uncharging task will remember the memcg of the first page it
> processes, then pile every subsequent page belonging to the same memcg
> on top.  It doesn't matter which group the task is in.

Ahh, you are right. I have missed if (batch->memcg != memcg) at the end
of mem_cgroup_do_uncharge.
Thanks!

-- 
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/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

WARNING: multiple messages have this Message-ID (diff)
From: Michal Hocko <mhocko@suse.cz>
To: Johannes Weiner <hannes@cmpxchg.org>
Cc: Tim Chen <tim.c.chen@linux.intel.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Mel Gorman <mel@csn.ul.ie>,
	KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>,
	Minchan Kim <minchan@kernel.org>,
	"Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>,
	"andi.kleen" <andi.kleen@intel.com>,
	linux-mm <linux-mm@kvack.org>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] Cgroup: Fix memory accounting scalability in shrink_page_list
Date: Fri, 20 Jul 2012 18:31:15 +0200	[thread overview]
Message-ID: <20120720163115.GA20765@tiehlicka.suse.cz> (raw)
In-Reply-To: <20120720151216.GB1426@cmpxchg.org>

On Fri 20-07-12 17:12:16, Johannes Weiner wrote:
> On Fri, Jul 20, 2012 at 04:38:48PM +0200, Michal Hocko wrote:
> > On Fri 20-07-12 16:16:25, Johannes Weiner wrote:
> > > On Fri, Jul 20, 2012 at 03:53:29PM +0200, Michal Hocko wrote:
> > > > On Thu 19-07-12 16:34:26, Tim Chen wrote:
> > > > [...]
> > > > > diff --git a/mm/vmscan.c b/mm/vmscan.c
> > > > > index 33dc256..aac5672 100644
> > > > > --- a/mm/vmscan.c
> > > > > +++ b/mm/vmscan.c
> > > > > @@ -779,6 +779,7 @@ static unsigned long shrink_page_list(struct list_head *page_list,
> > > > >  
> > > > >  	cond_resched();
> > > > >  
> > > > > +	mem_cgroup_uncharge_start();
> > > > >  	while (!list_empty(page_list)) {
> > > > >  		enum page_references references;
> > > > >  		struct address_space *mapping;
> > > > 
> > > > Is this safe? We have a scheduling point few lines below. What prevents
> > > > from task move while we are in the middle of the batch?
> > > 
> > > The batch is accounted in task_struct, so moving a batching task to
> > > another CPU shouldn't be a problem.
> > 
> > But it could also move to a different group, right?
> 
> The batch-uncharging task will remember the memcg of the first page it
> processes, then pile every subsequent page belonging to the same memcg
> on top.  It doesn't matter which group the task is in.

Ahh, you are right. I have missed if (batch->memcg != memcg) at the end
of mem_cgroup_do_uncharge.
Thanks!

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

  reply	other threads:[~2012-07-20 16:31 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-19 23:34 [PATCH] Cgroup: Fix memory accounting scalability in shrink_page_list Tim Chen
2012-07-19 23:34 ` Tim Chen
2012-07-20  3:19 ` Kamezawa Hiroyuki
2012-07-20  3:19   ` Kamezawa Hiroyuki
2012-07-20  4:25   ` Minchan Kim
2012-07-20  4:25     ` Minchan Kim
2012-07-20 16:38   ` Tim Chen
2012-07-20 16:38     ` Tim Chen
2012-07-20  6:27 ` Johannes Weiner
2012-07-20  6:27   ` Johannes Weiner
2012-07-20 11:19 ` Kirill A. Shutemov
2012-07-20 13:53 ` Michal Hocko
2012-07-20 13:53   ` Michal Hocko
2012-07-20 14:16   ` Johannes Weiner
2012-07-20 14:16     ` Johannes Weiner
2012-07-20 14:38     ` Michal Hocko
2012-07-20 14:38       ` Michal Hocko
2012-07-20 15:12       ` Johannes Weiner
2012-07-20 15:12         ` Johannes Weiner
2012-07-20 16:31         ` Michal Hocko [this message]
2012-07-20 16:31           ` Michal Hocko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20120720163115.GA20765@tiehlicka.suse.cz \
    --to=mhocko@suse.cz \
    --cc=akpm@linux-foundation.org \
    --cc=andi.kleen@intel.com \
    --cc=hannes@cmpxchg.org \
    --cc=kamezawa.hiroyu@jp.fujitsu.com \
    --cc=kirill.shutemov@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mel@csn.ul.ie \
    --cc=minchan@kernel.org \
    --cc=tim.c.chen@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.