Re: [RFC][RT][PATCH 3/4] rtmutex: Revert Optimize rt lock wakeup

From: Steven Rostedt
Date: Tue Jan 04 2011 - 10:48:09 EST


On Tue, 2011-01-04 at 08:19 -0700, Peter W. Morreale wrote:
> On Mon, 2011-01-03 at 15:22 -0500, Steven Rostedt wrote:
> > On Mon, 2011-01-03 at 14:06 -0500, Steven Rostedt wrote:
> >
> > >
> > > if (adaptive_wait(&waiter, orig_owner))
> > > sleep = 1;
> > > else
> > > sleep = 0;
> > >
> > > if (sleep)
> >
> >
> > > raw_spin_lock(&lock->wait_lock);
> > > saved_state = rt_set_current_block_state(saved_state);
> > > if (!lock->owner && &waiter == rt_mutex_top_waiter(lock))
> > > sleep = 0;
> > > raw_spin_unlock(&lock->wait_lock);
> >
> > I may be able to remove the above locks and replace it with:
> >
> > saved_state = rt_set_current_blocked_state(saved_state);
> > if (orig_owner == rt_mutex_owner(lock))
> > schedule_rt_mutex(lock);
> >
> > -- Steve
>
> Isn't it possible to miss a wakeup here if the waiter becomes preempted?

Why? Preemption doesn't change the task state.

>
> Recall that adaptive wait is a preemptive wait. Hence the (I believe)
> original reason we did the adaptive spin in a (transitioning) sleep
> state.

Yes it is a preemptive wait, I would not have accepted the patches if it
was anything else. But preemption is not affected by the state of the
task. A task could be TASK_RUNNING or TASK_INTERRUPTIBLE or
TASK_UNINTERRUPTIBLE, and that would not affect how it acts when it is
preempted.

-- Steve


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/