[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAPNVh5cokv9un3TAxFfYEkRkA_EM68_2YSCaY_-z+wKzHWY+kw@mail.gmail.com>
Date: Wed, 4 Aug 2021 16:30:05 -0700
From: Peter Oskolkov <posk@...gle.com>
To: Thierry Delisle <tdelisle@...terloo.ca>
Cc: posk@...k.io, avagin@...gle.com, bsegall@...gle.com,
jannh@...gle.com, linux-api@...r.kernel.org,
linux-kernel@...r.kernel.org, mingo@...hat.com,
peterz@...radead.org, pjt@...gle.com, tglx@...utronix.de,
Peter Buhr <pabuhr@...terloo.ca>
Subject: Re: [PATCH 4/4 v0.4] sched/umcg: RFC: implement UMCG syscalls
On Wed, Aug 4, 2021 at 3:05 PM Thierry Delisle <tdelisle@...terloo.ca> wrote:
>
> I have attached an atomic stack implementation I wrote. I believe it would
> be applicable here. It is very similar except the kernel side no longer
> needs a retry loop, the looping is moved to the user-space after the pop.
> Using it instead of the code you have in enqueue_idle_worker means the
> timeout is no longer needed.
Thanks, Thierry! Your implementation seems reasonable - I'll test it
and will use it in the future versions of the patchset if everything
is OK.
>
> > - ``uint64_t idle_server_tid_ptr``: points to a pointer variable in the
> > userspace that points to an idle server, i.e. a server in IDLE
> state waiting
> > in sys_umcg_wait(); read-only; workers must have this field set;
> not used
> > in servers.
> >
> > When a worker's blocking operation in the kernel completes, the kernel
> > changes the worker's state from ``BLOCKED`` to ``IDLE``, adds the
> worker
> > to the list of idle workers, and checks whether
> > ``*idle_server_tid_ptr`` is not zero. If not, the kernel tries to
> cmpxchg()
> > it with zero; if cmpxchg() succeeds, the kernel will then wake the
> server.
> > See `State transitions`_ below for more details.
>
> In this case, I believe cmpxchg is not necessary and xchg suffices.
Right! I'll need to roll another atomic_xchg helper for this and the
atomic stack above...
Powered by blists - more mailing lists