linux-rt-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Yong Zhang <yong.zhang0@gmail.com>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: Thomas Gleixner <tglx@linutronix.de>,
	LKML <linux-kernel@vger.kernel.org>,
	linux-rt-users <linux-rt-users@vger.kernel.org>,
	Peter Zijlstra <peterz@infradead.org>
Subject: Re: [PATCH -rt] memcg: use migrate_disable()/migrate_enable( ) in memcg_check_events()
Date: Thu, 17 Nov 2011 10:15:38 +0800	[thread overview]
Message-ID: <20111117021538.GB9281@zhy> (raw)
In-Reply-To: <1321452758.4181.18.camel@frodo>

On Wed, Nov 16, 2011 at 09:12:38AM -0500, Steven Rostedt wrote:
> On Wed, 2011-11-16 at 17:16 +0800, Yong Zhang wrote:
> > Looking at commit 4799401f [memcg: Fix race condition in
> > memcg_check_events() with this_cpu usage], we just want
> > to disable migration. So use the right API in -rt. This
> > will cure below warning.
> > 
> 
> >  mm/memcontrol.c |    4 ++--
> >  1 files changed, 2 insertions(+), 2 deletions(-)
> > 
> > diff --git a/mm/memcontrol.c b/mm/memcontrol.c
> > index 6aff93c..afa1954 100644
> > --- a/mm/memcontrol.c
> > +++ b/mm/memcontrol.c
> > @@ -722,7 +722,7 @@ static void __mem_cgroup_target_update(struct mem_cgroup *memcg, int target)
> >   */
> >  static void memcg_check_events(struct mem_cgroup *memcg, struct page *page)
> >  {
> > -	preempt_disable();
> > +	migrate_disable();
> 
> No this won't work. Not even for -rt. If we disable migration but not
> preemption, then two tasks can take this path. And the checks in
> __memcg_event_check() will be corrupted because nothing is protecting
> the updates from two tasks going into the same path.

I assumed that we only care about migration, but obviously I'm wrong.

> 
> Perhaps a local_lock would work.

Yeah, will try tglx's patch later.

Thanks,
Yong

      parent reply	other threads:[~2011-11-17  2:15 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-15  1:15 [ANNOUNCE] 3.2-rc1-rt2 Thomas Gleixner
2011-11-15  8:40 ` Yong Zhang
2011-11-15 13:52   ` Luis Henriques
2011-11-16  9:16   ` [PATCH -rt] memcg: use migrate_disable()/migrate_enable( ) in memcg_check_events() Yong Zhang
2011-11-16 14:12     ` Steven Rostedt
2011-11-16 17:02       ` Thomas Gleixner
2011-11-16 17:18         ` Luis Henriques
2011-11-16 23:48           ` KAMEZAWA Hiroyuki
2011-11-17  0:23             ` Steven Rostedt
2011-11-17  3:03         ` Yong Zhang
2011-11-17 10:25           ` Thomas Gleixner
2011-11-17 11:44             ` Luis Henriques
2011-11-17 11:59               ` Thomas Gleixner
2011-11-18  7:08             ` Yong Zhang
2011-11-17  2:15       ` Yong Zhang [this message]

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=20111117021538.GB9281@zhy \
    --to=yong.zhang0@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rt-users@vger.kernel.org \
    --cc=peterz@infradead.org \
    --cc=rostedt@goodmis.org \
    --cc=tglx@linutronix.de \
    /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 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).