[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20100228123313.GA5495@redhat.com>
Date: Sun, 28 Feb 2010 13:33:13 +0100
From: Oleg Nesterov <oleg@...hat.com>
To: Tejun Heo <tj@...nel.org>
Cc: torvalds@...ux-foundation.org, mingo@...e.hu, peterz@...radead.org,
awalls@...ix.net, linux-kernel@...r.kernel.org, jeff@...zik.org,
akpm@...ux-foundation.org, jens.axboe@...cle.com,
rusty@...tcorp.com.au, cl@...ux-foundation.org,
dhowells@...hat.com, arjan@...ux.intel.com, avi@...hat.com,
johannes@...solutions.net, andi@...stfloor.org,
Mike Galbraith <efault@....de>
Subject: Re: [PATCH 07/43] sched: implement try_to_wake_up_local()
Wow ;)
I didn't read the whole series yet, still I'd like to ask a couple
of questions right now. Tejun, I am just trying to understand this
code.
On 02/26, Tejun Heo wrote:
>
> @@ -2438,6 +2438,10 @@ static inline void ttwu_post_activation(struct task_struct *p, struct rq *rq,
> rq->idle_stamp = 0;
> }
> #endif
> + /*
> + * Wake up is complete, fire wake up notifier. This allows
> + * try_to_wake_up_local() to be called from wake up notifiers.
> + */
> if (success)
> fire_sched_notifiers(p, wakeup);
Could you explain the comment? ttwu_post_activation() sets state = TASK_RUNNING
few lines above, what try_to_wake_up_local() can do if called from ->wakeup()
notifier ?
> +bool try_to_wake_up_local(struct task_struct *p, unsigned int state,
> + int wake_flags)
> +{
> ...
> + if (!p->se.on_rq) {
> + if (likely(!task_running(rq, p))) {
> + schedstat_inc(rq, ttwu_count);
> + schedstat_inc(rq, ttwu_local);
> + }
> + ttwu_activate(p, rq, wake_flags & WF_SYNC, false, true);
> + success = true;
> + }
Shouldn't try_to_wake_up_local() check task_contributes_to_load() to
account ->nr_uninterruptible?
> @@ -5498,6 +5549,11 @@ need_resched_nonpreemptible:
> if (unlikely(signal_pending_state(prev->state, prev))) {
> prev->state = TASK_RUNNING;
> } else {
> + /*
> + * Fire sleep notifier before changing any scheduler
> + * state. This allows try_to_wake_up_local() to be
> + * called from sleep notifiers.
> + */
> fire_sched_notifiers(prev, sleep);
> deactivate_task(rq, prev, 1);
Again, I don't understand the comment... If ->sleep() notifier wakes up
this task, we shouldn't do deactivate_task() ?
Probably both comment mean a notifier could wake up another task bound
to this rq, in this case it looks a bit confusing, imho.
Off-topic, but it is a bit sad wait_task_inactive() can not use ->sleep()
notifier to avoid schedule_timeout(), afaics we can't add the notifier
to !current task.
Oleg.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists