* Daniel Walker <dwalker@xxxxxxxxxx> wrote:
> > The whole point of using a semaphore in the pagebuf is because there
> > is no tracking of who "owns" the lock so we can actually release it
> > in a different context. Semaphores were invented for this purpose,
> > and we use them in the way they were intended. ;)
>
> Where is the that semaphore spec, is that posix ? There is a new
> construct called "complete" that is good for this type of stuff too.
> No owner needed , just something running, and something waiting till
> it completes.
wrt. posix, we dont really care about that for kernel-internal
primitives like struct semaphore. So whether it's posix or not has no
relevance.
wrt. 'struct completion' - completions should indeed be slightly faster
for that particular purpose (IO completion, log transaction completion,
etc.). [ And it's in no way a 'must have' change - these are problems
introduced by PREEMPT_RT, and are solved within that patch. If upstream
code decides to convert certain types of semaphore uses to completions,
that will help -RT, but it's an opt-in process. ]
it's easy to test the semaphore usage that -RT doesnt like: just revert
one of the 'struct compat_semaphore' declarations to 'struct semaphore',
enable RT_DEADLOCK_DETECT, and create & mount an XFS partition and do
some simple file ops on it. That was enough for me to trigger the
warnings which prompted the compat_semaphore changes. You'll get a
verbose lock trace whenever something outside of the -RT kernel's
expecations happens.
Ingo
|