public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Eric Valette <eric.valette@free.fr>
To: drepper@redhat.com
Cc: Andrew Morton <akpm@osdl.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [RFC/PATCH] FUSYN Realtime & robust mutexes for Linux, v2.3.1
Date: Thu, 05 Aug 2004 10:39:40 +0200	[thread overview]
Message-ID: <4111F24C.3050803@free.fr> (raw)

Ulrich Drepper wote

>> How large is the slowdown, and on what workloads?
> 
> The fast path for all locking primitives etc in nptl today is entirely
> at userlevel. Normally just a single atomic operation with a dozen
> other instructions. With the fusyn stuff each and every locking
> operation needs a system call to register/unregister the thread as it
> locks/unlocks mutex/rwlocks/etc. Go figure how well this works. We are
> talking about making the fast path of the locking primitives
> two/three/four orders of magnitude more expensive. And this for
> absolutely no benefit for 99.999% of all the code which uses threads.

Frankly, there is no way you can escape calling the kernel to perform 
anything usefull related to respect of scheduling priorities and of 
course it cost more than a user spec only thing. But programming RT 
application correctly if priority invesion due to locking occurs is 
almost _impossible_. So most RT systems (including Open Source ones) 
have two kind of primitives (e.g Jaluna (mutex/semaphore (hint hint), 
RTEMS various kind of semaphore), the users level only one. Most of the 
time people are readdy to pay the price for determinism.

>> Passing the lock to a non-rt task when there's an rt-task waiting for it
>> seems pretty poor form, too.

Exactly.

> No no, that's not what is wanted. Robust mutexes are a special kind of
> mutex and not related to rt issues. Lockers of robust mutexes have to
> register with the kernel (i.e., the locking must actually be performed
> by the kernel) so that in case the thread goes away or the entire
> process dies, the mutex is unlocked and other waiters (other threads, in
> the same or other processes) can get the lock. This is very useful for
> normal operations where mutexes are used inter-process. This is the
> part which is independent from rt but it also must not be the default
> mode (i.e., normal pthread_mutex_t code must not be replaced) since it
> is significantly slower.

Robust mutext could also then be used then for dealing with priority 
inversion, handling of thread priorities when dequeing, ... But if you 
cannot access theses functionnality without going away of posix API, 
that's a pity.

> The rest of the extensions like all the priority handling is not of
> general interest. POSIX describes how a thread's priority would be
> temporarily raised if it holds a mutex which has a higher-priority
> waiter. But this is all functionality of a realtime profile and widely
> not part of the normal implementation.

I guess you do not read linuxdevices often enough : linux is becoming a
major player in the embeeded market place and RT behavior is important 
here. Given the work that already occured on reducing scheduling latency 
and continue with the voluntary premption patche trial, I guess it is 
time to make application at least able to benefit of theses enhancements.

Question for Andrew : I have seen the IRQ handler -> IRQ thread handler 
conversion patch and for me this will go about nowhere (from experience) 
but I'm wondering why nobody actually proposed as way to define logical 
interrupt priorities (e.g by applying a mask on the 8259 rather than 
just masking the current interrupt). More details at 
<http://www.rtems.org/cgi-bin/viewcvs.cgi/rtems/c/src/lib/libbsp/i386/shared/irq/> 


Defining a generic API, is very complicated and has been given up by 
almost RTOS vendor but defining priorities among interrupts is important 
and threads simply too costly for interrupt driven applications :-)

-- 
    __
   /  `                   	Eric Valette
  /--   __  o _.          	6 rue Paul Le Flem
(___, / (_(_(__         	35740 Pace

Tel: +33 (0)2 99 85 26 76	Fax: +33 (0)2 99 85 26 76
E-mail: eric.valette@free.fr




             reply	other threads:[~2004-08-05  8:40 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-08-05  8:39 Eric Valette [this message]
  -- strict thread matches above, loose matches on Subject: below --
2004-08-05 18:39 [RFC/PATCH] FUSYN Realtime & robust mutexes for Linux, v2.3.1 Perez-Gonzalez, Inaky
2004-08-05 18:39 Perez-Gonzalez, Inaky
2004-08-05 18:37 Perez-Gonzalez, Inaky
2004-08-05 18:22 Perez-Gonzalez, Inaky
2004-08-05 18:16 Perez-Gonzalez, Inaky
2004-08-05 18:16 Perez-Gonzalez, Inaky
2004-08-05 18:16 Perez-Gonzalez, Inaky
2004-08-04  9:13 Perez-Gonzalez, Inaky
2004-08-05  6:21 ` Andrew Morton
2004-08-05  7:06   ` Ulrich Drepper
2004-08-05  7:17     ` Andrew Morton
2004-08-05  7:37       ` Ulrich Drepper
2004-08-05  7:40         ` Andrew Morton
2004-08-05  8:22           ` Ulrich Drepper
2004-08-05 10:42         ` Ingo Molnar
2004-08-05 11:48         ` Rusty Russell
2004-08-05 13:23           ` Linh Dang
2004-08-05 13:26         ` Linh Dang
2004-08-05 14:02         ` Chris Friesen
2004-08-05 10:34 ` Ingo Molnar
2004-08-05 10:59   ` Ingo Molnar

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=4111F24C.3050803@free.fr \
    --to=eric.valette@free.fr \
    --cc=akpm@osdl.org \
    --cc=drepper@redhat.com \
    --cc=linux-kernel@vger.kernel.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