From: Jamie Lokier <jamie@shareable.org>
To: inaky.perez-gonzalez@intel.com
Cc: linux-kernel@vger.kernel.org, robustmutexes@lists.osdl.org
Subject: Re: [RFC/PATCH] FUSYN Realtime & Robust mutexes for Linux try 2
Date: Thu, 4 Dec 2003 04:12:28 +0000 [thread overview]
Message-ID: <20031204041228.GE1216@mail.shareable.org> (raw)
In-Reply-To: <0312030051.PbYaFa~d8c8cGbebAaFaPbibda2c0cgd25502@intel.com>
Here's my first thoughts, on reading Documentation/fusyn.txt.
- Everything here can be implemented on top of regular futex, but
that doesn't mean the implementation will be efficient or robust.
(This is because, in general, any kind of futex/fuqueue/whatever
implementation can be moved from kernel space to userspace, using
the real kernel futexes to simulate the waitqueues and spinlocks
that are called in futex.c).
There are some good ideas in here, for people who need the features:
- Priority inheritence is ok _when_ you want it.
Sometimes if task A with high priority wants a resource which is
locked by task B with lower priority, that should be an error
condition: it can be dangerous to promote the priority of task B,
if task B is not safe to run at a high priority.
- The data structures and priority callbacks which are used to
implement priority inheritance, protection and highest-priority
wakeup are fine.
But highest-priority wakeup (at least) shouldn't be just for
fuqueues: it should be implemented at a lower level, directly in
the kernel's waitqueues. Meaning: wake_up() should wake the
highest priority task, not the first one queued, if that is
appropriate for the queue or waker.
- I like the method of detecting dead mutex holders, and the ability
to handle recovery of inconsistent data.
- Is there a method for passing the locked state to another task?
Compare-and-swap old-pid -> new-pid works when there isn't any
contention, but a kernel call is needed in any of the
kernel-controlled states.
- It's very unpleasant that rwlocks enter the kernel when there is
more than one reader. Hashed rwlocks can be implemented in
userspace to reduce this (readers take one rwlock from a hashed
set; writers take them all in order), but it isn't wonderful.
- For architectures which can't do compare-and-swap, a system call
which does the equivalent (i.e. disables preemption, does
compare-and-swap, enables preemption again) would be quite useful.
Not for maximum performance, but to allow architecture-independent
locking strategies to be written portably.
- Similarly, it would be good for the VFULOCK_ flags to depend on
only 31 bits of the word, i.e. ignoring one of them. Then
architectures which don't have compare-and-swap but which do have
test-and-set-bit can use that.
- Does the owner field have to be the pid or can a fulock use any
kind of key value, as long as it isn't one of the reserved values,
that's convenient to the application.
- It's nice that you use separate syscalls for each operation.
Futex should do this too; multiplexing syscalls like the one in
futex.c should be banned :)
- It's a huge patch. A nice thing about futex.c is that it's
relatively small (your patch is 9 times larger). The original
futex design was more complicated, and written specifically for
mutexes. Then it was made simpler and I think smaller at the same
time. Perhaps putting some of the RT priority capabilities
directly into kernel waitqueues would help with this.
-- Jamie
next prev parent reply other threads:[~2003-12-04 4:12 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-12-03 8:51 [RFC/PATCH] FUSYN Realtime & Robust mutexes for Linux try 2 inaky.perez-gonzalez
2003-12-03 8:51 ` [RFC/PATCH] FUSYN 1/10: documentation files inaky.perez-gonzalez
2003-12-03 8:51 ` [RFC/PATCH] FUSYN 2/10: modifications to the core inaky.perez-gonzalez
2003-12-03 8:51 ` [RFC/PATCH] FUSYN 3/10: Support for i386 inaky.perez-gonzalez
2003-12-04 4:12 ` Jamie Lokier [this message]
-- strict thread matches above, loose matches on Subject: below --
2003-12-04 4:57 [RFC/PATCH] FUSYN Realtime & Robust mutexes for Linux try 2 Perez-Gonzalez, Inaky
2003-12-04 5:51 ` Jamie Lokier
2003-12-04 9:27 Perez-Gonzalez, Inaky
2003-12-07 1:15 Perez-Gonzalez, Inaky
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20031204041228.GE1216@mail.shareable.org \
--to=jamie@shareable.org \
--cc=inaky.perez-gonzalez@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=robustmutexes@lists.osdl.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox