[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YboxjUM+D9Kg52mO@hirez.programming.kicks-ass.net>
Date: Wed, 15 Dec 2021 19:18:53 +0100
From: Peter Zijlstra <peterz@...radead.org>
To: Peter Oskolkov <posk@...k.io>
Cc: Ingo Molnar <mingo@...hat.com>,
Thomas Gleixner <tglx@...utronix.de>, juri.lelli@...hat.com,
Vincent Guittot <vincent.guittot@...aro.org>,
dietmar.eggemann@....com, Steven Rostedt <rostedt@...dmis.org>,
Ben Segall <bsegall@...gle.com>, mgorman@...e.de,
bristot@...hat.com,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
Linux Memory Management List <linux-mm@...ck.org>,
linux-api@...r.kernel.org, x86@...nel.org,
Paul Turner <pjt@...gle.com>, Peter Oskolkov <posk@...gle.com>,
Andrei Vagin <avagin@...gle.com>, Jann Horn <jannh@...gle.com>,
Thierry Delisle <tdelisle@...terloo.ca>
Subject: Re: [RFC][PATCH 0/3] sched: User Managed Concurrency Groups
On Wed, Dec 15, 2021 at 09:56:06AM -0800, Peter Oskolkov wrote:
> > Right, so the problem I'm having is that a single idle server ptr like
> > before can trivially miss waking annother idle server.
>
> I believe the approach I used in my patchset, suggested by Thierry
> Delisle, works.
>
> In short, there is a single idle server ptr for the kernel to work
> with. The userspace maintains a list of idle servers. If the ptr is
> NULL, the list is empty. When the kernel wakes the idle server it
> sees, the server reaps the runnable worker list and wakes another idle
> server from the userspace list, if available. This newly woken idle
> server repoints the ptr to itself, checks the runnable worker list, to
> avoid missing a woken worker, then goes to sleep.
>
> Why do you think this approach is not OK?
Suppose at least 4 servers, 2 idle, 2 working.
Now, the first of the working servers (lets call it S0) gets a wakeup
(say Ta), it finds the idle server (say S3) and consumes it, sticking Ta
on S3 and kicking it alive.
Concurrently and loosing the race the other working server (S1) gets a
wake-up from Tb, like said, it lost, no idle server, so Tb goes on the
queue of S1.
So then S3 wakes, finds Ta and they live happily ever after.
While S2 and Tb fail to meet one another and both linger in sadness.
Powered by blists - more mailing lists