vfs_aio.c is still not safe

David Xu davidxu at freebsd.org
Wed Jan 25 18:24:41 PST 2006


Julian Elischer wrote:
> 
> David Xu wrote:
> 
>> Dag-Erling Smørgrav wrote:
>>
>>> 3) Rewrite the aio code to use kthreads attached to each process, so
>>>   problems with one process's aio does not propagate to other
>>>   processes.
>>>
>>>  
>>>
>> This is not a complete solution, it shifts the problem to another side,
>> allow user to kill process.
> 
> 
> A kernel thread cannot be "killed" by the user. it can only
> agree to kill itself.
> 

By attaching kthreads to each process, there still has an serious issue,
if I allow max queued AIO requests to be 1000 (sysctl can adjust this),
then I will allow 1000 aio threads to be created and be blocked for each
process, otherwise, it defeats the purpose of aio, this is why aio
thread should not be blocked on sockets, fifo, pipe, and then they can
be reused.
Using fixed number of aio threads for disk file is ok, since disk data
will be availble in foreseeable period.

If a user process got a signal which will bring it down, thread_single()
call in exit1() should cause the kthreads to exit, this can be done.
This also reminds me another problem, if all user threads exited by
calling e.g: thr_exit or kse_exit, now, these kthreads should exit too,
so the code should be adjusted,not only ptrace code.



More information about the freebsd-arch mailing list