Messages in this thread | | | Date | Wed, 8 Jun 2011 21:28:59 +0800 | Subject | Re: [PATCH] sched: remove unreliable pointer in mutex_spin_on_owner() | From | Hillf Danton <> |
| |
On Wed, Jun 8, 2011 at 8:58 PM, Steven Rostedt <rostedt@goodmis.org> wrote: > On Wed, Jun 08, 2011 at 08:49:53PM +0800, Hillf Danton wrote: >> The dereference of unreliable owner pointer is unnecessary in owner_running(), >> though under RCU protection, because the true result is only determined by >> checking the validity of lock owner, as the comment says, due to likely heavy >> lock contention, which has little to do with whether owner->on_cpu is false. >> >> If owner->on_cpu is really false, only the owner_running loop is shortened, >> but also returns incorrect result, since the lock owner is not changed, though >> maybe changed soon. >> > > Hillf, have you read anything that I posted before? >
I have, but
> We don't want to spin if the owner of the lock sleeps. If it sleeps, > then the owner's on_cpu will be zero. That's the point of checking it. > not understand the point of checking owner->on_cpu, and the code's icy beauty blows me down again.
Please thaw another hard to understand in rt_mutex_setprio(),
if (running) p->sched_class->set_curr_task(rq); if (on_rq) - enqueue_task(rq, p, oldprio < prio ? ENQUEUE_HEAD : 0); + enqueue_task(rq, p, oldprio > prio ? ENQUEUE_HEAD : 0);
check_class_changed(rq, p, prev_class, oldprio);
thanks Hillf
> The patch you just added would devastate the performance of the system. > Now if we have contention on a lock, and the owner sleeps, we continue > to spin. If the spinner is an RT task, this could also cause a deadlock, > especially if the owner is bound to the same CPU that the RT task is on. > > -- Steve
| |