Re: [patch] Real-Time Preemption, -RT-2.6.9-rc4-mm1-U8

From: Thomas Gleixner
Date: Thu Oct 21 2004 - 19:54:01 EST


On Fri, 2004-10-22 at 00:42, Timothy Miller wrote:
> Bill Huey (hui) wrote:
> > You use a semaphore to protect data, a completion isn't protecting data
> > but preserving a certain kind of wait ordering in the code. The
> > possibility of overloading the current mutex_t for PI makes for a conceptual
> > mismatch when used in this case since having a kind of priority for
> > completions is a bit odd. It's better to flat out use a completion
> > instead, IMO.
> >
>
>
> Could you please define "completion" for me in this context?

A triggers B to exit and must wait until B has exited. It waits for
completion of exit.

A triggers B to execute a command and must wait until B has done so. It
waits for completion of the command.

Mutexes are used for that, but that's not the intended functionality of
a mutex. Of course it works as long as you do no owner checks on the
mutexes.

A {
init_MUTEX_LOCKED(m)
trigger B
down(m) <----- recursion, because A owns it already
}

The completion is designed for that and should be used IMHO. Mutexe were
used for that, because the ancestors of completion, sleep_on...(), are
racy.

tglx


-
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/