From owner-freebsd-current@FreeBSD.ORG Mon Jan 23 22:49:20 2006 Return-Path: X-Original-To: freebsd-current@freebsd.org Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 99FD716A41F; Mon, 23 Jan 2006 22:49:20 +0000 (GMT) (envelope-from rwatson@FreeBSD.org) Received: from cyrus.watson.org (cyrus.watson.org [209.31.154.42]) by mx1.FreeBSD.org (Postfix) with ESMTP id EDAD244345; Mon, 23 Jan 2006 22:49:09 +0000 (GMT) (envelope-from rwatson@FreeBSD.org) Received: from fledge.watson.org (fledge.watson.org [209.31.154.41]) by cyrus.watson.org (Postfix) with ESMTP id 3CD4E46B0C; Mon, 23 Jan 2006 17:49:03 -0500 (EST) Date: Mon, 23 Jan 2006 22:50:17 +0000 (GMT) From: Robert Watson X-X-Sender: robert@fledge.watson.org To: Julian Elischer In-Reply-To: <43D55739.80608@elischer.org> Message-ID: <20060123224756.R48094@fledge.watson.org> References: <43D05151.5070409@elischer.org> <200601231616.49140.jhb@freebsd.org> <43D55739.80608@elischer.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: freebsd-current@freebsd.org Subject: Re: kernel thread as real threads.. X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 23 Jan 2006 22:49:20 -0000 On Mon, 23 Jan 2006, Julian Elischer wrote: > John Baldwin wrote: > >> On Thursday 19 January 2006 21:56, Julian Elischer wrote: >> >>> some progrsss.. >>> as the first few lines show, it's not quite perfect yet but it's most of >>> the way there.. >>> (Like proc 1 isn't init) >> >> One other note, watch out for the AIO daemons. They have to be kernel >> procs and not kthreads because they borrow the vmspace of the user process >> when performing AIO on another process' behalf. >> > yeah I found that and the patches account for that. > > However I would like to suggest that we change the way that aio works.. > > My suggestion is that when a process does AIO, that we "fork a ksegroup" and > attach it to the process, and assign it a (or some) worker thread to do the > aio work. The userland process would be oblivious of the extra (kernel) > threads in that kseg and they would be independently schedulable. They would > however automatically have full access to the correct address space. While I think that, in principle, this is the right thing to do, I'm a bit worried about doing it in practice. One of the things I like about the current aio code is the degree to which the the aio daemon processes are independent of the original requesting process -- we acquire references to vmspaces, creds, file descriptors, etc, but don't keep accessing the ones of the process. This means that if a process changes its uid, changes its threading, etc, while aio is running, aio is relatively unaffected. I worry that if we allow tighter integration of the two, we open up the door to security related race conditions. Also, we introduce concerns about the run-down when single-threading, exiting, execing, etc. Robert N M Watson