lkml.org 
[lkml]   [2007]   [Mar]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [patch 00/13] Syslets, "Threadlets", generic AIO support, v3
On Fri, 2 Mar 2007, Ingo Molnar wrote:

>
> * Davide Libenzi <davidel@xmailserver.org> wrote:
>
> > I think that the "dirty" FPU context must, at least, follow the new
> > head. That's what the userspace sees, and you don't want an async_exec
> > to re-emerge with a different FPU context.
>
> well. I think there's some confusion about terminology, so please let me
> describe everything in detail. This is how execution goes:
>
> outer loop() {
> call_threadlet();
> }
>
> this all runs in the 'head' context. call_threadlet() always switches to
> the 'threadlet stack'. The 'outer context' runs in the 'head stack'. If,
> while executing the threadlet function, we block, then the
> threadlet-thread gets to keep the task (the threadlet stack and also the
> FPU), and blocks - and we pick a 'new head' from the thread pool and
> continue executing in that context - right after the call_threadlet()
> function, in the 'old' head's stack. I.e. it's as if we returned
> immediately from call_threadlet(), with a return code that signals that
> the 'threadlet went async'.
>
> now, the FPU state that was when the threadlet blocked is totally
> meaningless to the 'new head' - that FPU state is from the middle of the
> threadlet execution.

For threadlets, it might be. Now think about a task wanting to dispatch N
parallel AIO requests as N independent syslets.
Think about this task having USEDFPU set, so the FPU context is dirty.
When it returns from async_exec, with one of the requests being become
sleepy, it needs to have the same FPU context it had when it entered,
otherwise it won't prolly be happy.
For the same reason a schedule() must preserve/sync the "prev" FPU
context, to be reloaded at the next FPU fault.




> > So, IMO, if the USEDFPU bit is set, we need to sync the dirty FPU
> > context with an early unlazy_fpu(), *and* copy the sync'd FPU context
> > to the new head. This should really be a fork of the dirty FPU context
> > IMO, and should only happen if the USEDFPU bit is set.
>
> why? The only effect this will have is a slowdown :) The FPU context
> from the middle of the threadlet function is totally meaningless to the
> 'new head'. It might be anything. (although in practice system calls are
> almost never called with a truly in-use FPU.)

See above ;)



- Davide


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2007-03-02 21:57    [W:0.211 / U:0.440 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site