From: Yong Zhang <yong.zhang0@gmail.com>
To: Oleg Nesterov <oleg@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>,
Frank Rowand <frank.rowand@am.sony.com>,
linux-kernel <linux-kernel@vger.kernel.org>,
users@kernel.org, hch <hch@infradead.org>,
scameron@beardog.cce.hp.com,
"James E.J. Bottomley" <jejb@parisc-linux.org>,
Jens Axboe <jaxboe@fusionio.com>,
Thomas Gleixner <tglx@linutronix.de>
Subject: Re: [kernel.org users] [KORG] Panics on master backend
Date: Mon, 29 Aug 2011 10:29:26 +0800 [thread overview]
Message-ID: <20110829022926.GA10356@zhy> (raw)
In-Reply-To: <20110826135739.GA12565@redhat.com>
On Fri, Aug 26, 2011 at 03:57:39PM +0200, Oleg Nesterov wrote:
> On 08/26, Yong Zhang wrote:
> >
> > On Thu, Aug 25, 2011 at 03:54:29PM +0200, Oleg Nesterov wrote:
> > >
> > > Of course it is not TASK_RUNNING, but it can be running or not.
> >
> > Yup. Before we go beyond ttwu_remote() in ttwu(), 'cpu' is not safe.
> > For example, wait_event() could be preempted in between.
> >
> > But after we go beyond ttwu_remote(), ->pi_lock will stabilize it.
>
> Yes.
>
> > So after we take Oleg's suggestion("task_cpu(p) == smp_processor_id()"),
> > things we left is just how to account stat correctly.
>
> Imho, we don't really care. This race is very unlikely,
Yup.
> and I think
> that the "wrong" cpu argument in ttwu_stat() is harmless.
Hmm, the affected accounting is sched_domain->ttwu_wake_remote.
> > @@ -2696,7 +2697,12 @@ try_to_wake_up(struct task_struct *p, unsigned int state, int wake_flags)
> > success = 1; /* we're going to change ->state */
> > cpu = task_cpu(p);
> >
> > - if (p->on_rq && ttwu_remote(p, wake_flags))
> > + /*
> > + * read cpu for another time if ttwu_remote() success,
> > + * just to prevent task migration in between, otherwise
> > + * we maybe account stat incorrectly.
> > + */
> > + if (p->on_rq && ttwu_remote(p, wake_flags, &cpu))
>
> I don't think this makes the things better. p->on_rq can be already
> false or ttwu_remote() can fail, in this case we still use the result
> of initial task_cpu().
Ah, My code (ttwu_remote(p, wake_flags, &cpu)) just catch the case:
task is dancing with 'p->on_rq == true'.
But forget the case: task has danced with 'p->on_rq == false' in the end.
So we should reread task_cpu(p) if 'p->on_cpu == true &&
__ARCH_WANT_INTERRUPTS_ON_CTXSW == y', but the code will be a little ugly
and it only aims to account stat more correctly.
We need some balance here :)
BTW, I don't think we should care much on the 'incorrect stat' either
if we don't make intolerable mistake.
Thanks,
Yong
next prev parent reply other threads:[~2011-08-29 2:29 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-08-23 18:09 [KORG] Panics on master backend J.H.
2011-08-23 19:52 ` [kernel.org users] " Peter Zijlstra
2011-08-23 21:32 ` James Bottomley
2011-08-24 9:59 ` Peter Zijlstra
2011-08-24 16:08 ` Oleg Nesterov
2011-08-25 10:24 ` Peter Zijlstra
2011-08-25 13:54 ` Oleg Nesterov
2011-08-26 6:01 ` Yong Zhang
2011-08-26 13:57 ` Oleg Nesterov
2011-08-29 2:29 ` Yong Zhang [this message]
2011-08-29 13:06 ` Peter Zijlstra
2011-08-29 14:38 ` Oleg Nesterov
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=20110829022926.GA10356@zhy \
--to=yong.zhang0@gmail.com \
--cc=frank.rowand@am.sony.com \
--cc=hch@infradead.org \
--cc=jaxboe@fusionio.com \
--cc=jejb@parisc-linux.org \
--cc=linux-kernel@vger.kernel.org \
--cc=oleg@redhat.com \
--cc=peterz@infradead.org \
--cc=scameron@beardog.cce.hp.com \
--cc=tglx@linutronix.de \
--cc=users@kernel.org \
/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