From owner-freebsd-arch@FreeBSD.ORG Thu Jan 26 02:24:41 2006 Return-Path: X-Original-To: arch@freebsd.org Delivered-To: freebsd-arch@FreeBSD.ORG Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 8237916A420 for ; Thu, 26 Jan 2006 02:24:41 +0000 (GMT) (envelope-from davidxu@freebsd.org) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 1FD9243D46; Thu, 26 Jan 2006 02:24:41 +0000 (GMT) (envelope-from davidxu@freebsd.org) Received: from [127.0.0.1] (root@localhost [127.0.0.1]) by freefall.freebsd.org (8.13.4/8.13.4) with ESMTP id k0Q2Ocge058958; Thu, 26 Jan 2006 02:24:39 GMT (envelope-from davidxu@freebsd.org) Message-ID: <43D832F1.6040602@freebsd.org> Date: Thu, 26 Jan 2006 10:24:49 +0800 From: David Xu User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.7.12) Gecko/20050928 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Julian Elischer References: <43D6C3A5.4060100@freebsd.org> <86k6coodch.fsf@xps.des.no> <43D812F7.50808@freebsd.org> <43D825C2.4000004@elischer.org> In-Reply-To: <43D825C2.4000004@elischer.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit Cc: =?ISO-8859-1?Q?Dag-Erling_Sm=F8rgrav?= , arch@freebsd.org Subject: Re: vfs_aio.c is still not safe X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 26 Jan 2006 02:24:41 -0000 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.