lkml.org 
[lkml]   [2010]   [Feb]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [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.



\
 
 \ /
  Last update: 2010-02-28 13:39    [W:0.673 / U:0.144 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site