Re: [patch 04/13] syslets: core code

Davide Libenzi
2007-02-24T22:25:22Z

On Sat, 24 Feb 2007, Kyle Moffett wrote:

> On Feb 24, 2007, at 16:10:33, Davide Libenzi wrote:
> > On Sat, 24 Feb 2007, Ingo Molnar wrote:
> > > the on/off calls are shaped in a way that makes them ultimately
> > > vsyscall-able - the kernel only needs to know about the fact that we are
> > > in a threadlet (so that the scheduler can do its special
> > > push-head-to-another-context thing) - and this can be signalled via a
> > > small user-space-side info structure as well, put into the TLS.
> >
> > IMO it's not a matter of speed. We'll have those two new syscalls, that I
> > don't see other practical use for. IMO the best thing would be to hide all
> > inside the sys_threadlet_exec (or whatever name).
>
> No, it absolutely is a matter of speed. The reason to have those two
> implemented that way is so that they can be implemented as vsyscalls
> completely in userspace. This means that on most modern platforms you can
> implement the "make a threadlet when I block" semantic without even touching
> kernel-mode. The way it's set up all you'd have to do is save some
> parameters, set up a new callstack, and poke a "1" into a memory address in
> the TLS. To stop, you effectively just poke a "0" into the spot in the TLS
> and either return or terminate the thread.

Right. I don't why but I got the implression Ingo's threadlet_exec example
was just sketch code to be moved in a syscall. That's why I was talking
about a sys_threadlet_exec. But yeah, it makes a lot of sense to turn
threadlet_exec in a glibc thing, and play everything in userspace at that
point.

- Davide