mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: linux@horizon.com
To: linux-kernel@vger.kernel.org
Cc: inaky.perez-gonzalez@intel.com
Subject: RE: [PATCH] Abstracted Priority Inheritance for RT
Date: 2 Jun 2005 00:52:59 -0000	[thread overview]
Message-ID: <20050602005259.10673.qmail@science.horizon.com> (raw)

>>> Do you plan to use that callback for priority inheritance?
>>> If so: It would lead to an recursive algorithm. That is not very nice in
>>> the kernel with a limited call-stack. It is not so much a problem if the
>>> mechanism is used in the kernel only, but if it is used for user-space
>>> locking, which can have unlimited neesting, it is potential problem.
>>
>> I'm not sure I see how this could become recursive, could you explain
>> more?
?
> Maybe he is referring to the case?
> 
> A owns M
> B owns N and is waiting for M
> A is trying to wait for N

No, that's just a straight deadlock and a bug whether you have PI oir not.
The recursive concern is the following case:

Process priorities: A < B < C < ...

Process A holds lock 1
Process B holds lock 2 and is trying for lock 1
Process C holds lock 3 and is trying for lock 2
Process D holds lock 4 and is trying for lock 3

Now see what happens when high-priority process E tries to
take lock 4.  We need to push its priority all the way down
the chain to process A.

If a process is only allowed to try for one lock at a time, that could,
in theory, be done iteratively, but it might take some care.


Actually, the tricky part of priority inheritance implementation is
usually dropping the priority properly when locks are released.

For example, with priorities A < B < C:
Process A holds locks 1 and 2
Process B is trying for lock 1
Process C is trying for lock 2

Now, if process A were to drop lock 1, its priority would stay
elevated to C's level.  But if it were to drop lock 2, its
proproty would drop to B's level, and C would preempt it.
You can come up with some very perverse priority trees this way.

             reply	other threads:[~2005-06-02  0:53 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-06-02  0:52 linux [this message]
  -- strict thread matches above, loose matches on Subject: below --
2005-06-02  1:22 Perez-Gonzalez, Inaky
2005-06-02  5:43 ` john cooper
2005-06-03  0:54   ` Bill Huey
2005-06-03  1:10     ` Sven Dietrich
2005-06-02  1:21 Perez-Gonzalez, Inaky
2005-06-02  0:10 Perez-Gonzalez, Inaky
2005-06-02  0:25 ` Daniel Walker
2005-06-01  2:57 Daniel Walker
2005-06-01  3:35 ` Steven Rostedt
2005-06-01  7:54 ` Ingo Molnar
2005-06-01 12:57   ` Daniel Walker
2005-06-01 14:07     ` Esben Nielsen
2005-06-01 23:58       ` Daniel Walker
2005-06-02  8:25         ` Esben Nielsen
2005-06-02 15:11           ` Daniel Walker
2005-06-02 15:18             ` Esben Nielsen
2005-06-02 17:31               ` Daniel Walker
2005-06-02 20:27                 ` Esben Nielsen
2005-06-02 21:50                   ` Daniel Walker
2005-06-03  9:08                     ` Esben Nielsen

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=20050602005259.10673.qmail@science.horizon.com \
    --to=linux@horizon.com \
    --cc=inaky.perez-gonzalez@intel.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

Powered by JetHome