From: Joel Fernandes <joel@joelfernandes.org>
To: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Cc: Qais Yousef <qais.yousef@arm.com>,
Peter Zijlstra <peterz@infradead.org>,
LKML <linux-kernel@vger.kernel.org>,
Steven Rostedt <rostedt@goodmis.org>,
juri.lelli@redhat.com, vincent.guittot@linaro.org,
Youssef Esmat <youssefesmat@google.com>,
Dietmar Eggemann <dietmar.eggemann@arm.com>,
Thomas Gleixner <tglx@linutronix.de>,
bristot@redhat.com, clark.williams@gmail.com,
"Paul E. McKenney" <paulmck@kernel.org>
Subject: Re: Sum of weights idea for CFS PI
Date: Tue, 4 Oct 2022 10:43:33 -0400 [thread overview]
Message-ID: <f453e273-26b6-77c3-5511-6dc4fd5054db@joelfernandes.org> (raw)
In-Reply-To: <YzweGw5l3HxQVcGN@linutronix.de>
On 10/4/2022 7:50 AM, Sebastian Andrzej Siewior wrote:
> On 2022-09-30 13:34:49 [-0400], Joel Fernandes wrote:
>> In this case, there is no lock involved yet you have a dependency. But I don't
>> mean to sound depressing, and just because there are cases like this does not
>> mean we should not solve the lock-based ones. When I looked at Android, I saw
>> that it uses futex directly from Android Runtime code instead of using pthread.
>> So perhaps this can be trivially converted to FUTEX_LOCK_PI and then what we do
>> in the kernel will JustWork(Tm) ?
>
> The easy part is just to replace the lock/unlock functions with
> FUTEX_LOCK_PI/UNLOCK_PI syscalls. The slightly advanced part is where
> you use an atomic operation to replace 0 with threads's ID in the lock
> path to avoid going into the kernel for locking if the lock is not
> contended. If it is, then you need to use the syscall.
>
> …
>>> Proxy execution seems to be the nice solution to all of these problems, but
>>> it's a long way away. I'm interested to learn how this inheritance will be
>>> implemented. And whether there are any userspace conversion issues. i.e: do
>>> we need to convert all locks to rt-mutex locks?
>>
>> I am not an expert on FUTEX_LOCK_PI and this could be a good time for tglx to
>> weigh in, but I think converting all userspace locks to use FUTEX_LOCK_PI sounds
>> reasonable to me.
>
> Based on my understanding with proxy-execution, all in-kernel locks
> should be covered.
> Priority inheritance (PI) works only with FUTEX_LOCK_PI for userpace and
> rtmutex for the in-kernel locks. Regular FUTEX_LOCK does only wait/wake
> in userspace so there is no way for the kernel to "help". Ah and for PI
> to work you need priorities that you can inherit. With two threads
> running as SCHED_OTHER there will be just "normal" sleep+wake in the
> kernel. If the blocking thread is SCHED_FIFO then it will inherit its
> priority to the lock owner.
Hi Sebastian, I agree with your thoughts on this. Yes proxy execution idea
should cover this. Basically, any primitive that allows userspace to let the
kernel know is a dependency can use this AFAICS, FUTEX_LOCK_PI being a prime
example. Perhaps Android's binder being another where A sends a message to C and
blocks till C responds. Meanwhile medium prio B blocks C.
thanks,
- Joel
prev parent reply other threads:[~2022-10-04 14:43 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-29 20:38 Sum of weights idea for CFS PI Joel Fernandes
2022-09-30 13:49 ` Qais Yousef
2022-09-30 15:44 ` Youssef Esmat
2022-09-30 17:42 ` Joel Fernandes
2022-09-30 18:10 ` Youssef Esmat
2022-09-30 18:45 ` Joel Fernandes
2022-09-30 17:34 ` Joel Fernandes
2022-10-03 16:14 ` Qais Yousef
2022-10-03 16:27 ` Joel Fernandes
2022-10-04 16:30 ` Qais Yousef
2022-10-04 19:48 ` Joel Fernandes
2022-10-05 9:31 ` Qais Yousef
2022-10-04 20:27 ` Joel Fernandes
2022-10-05 10:04 ` Qais Yousef
2022-10-06 13:53 ` Joel Fernandes
2022-10-06 19:40 ` Youssef Esmat
2022-10-08 15:04 ` Joel Fernandes
2022-10-10 14:46 ` Qais Yousef
2022-10-10 15:11 ` Joel Fernandes
2022-10-12 14:30 ` Qais Yousef
2022-10-04 11:50 ` Sebastian Andrzej Siewior
2022-10-04 14:43 ` Joel Fernandes [this message]
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=f453e273-26b6-77c3-5511-6dc4fd5054db@joelfernandes.org \
--to=joel@joelfernandes.org \
--cc=bigeasy@linutronix.de \
--cc=bristot@redhat.com \
--cc=clark.williams@gmail.com \
--cc=dietmar.eggemann@arm.com \
--cc=juri.lelli@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=paulmck@kernel.org \
--cc=peterz@infradead.org \
--cc=qais.yousef@arm.com \
--cc=rostedt@goodmis.org \
--cc=tglx@linutronix.de \
--cc=vincent.guittot@linaro.org \
--cc=youssefesmat@google.com \
/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;
as well as URLs for NNTP newsgroup(s).