From owner-freebsd-threads@FreeBSD.ORG Wed May 7 13:16:14 2003 Return-Path: Delivered-To: freebsd-threads@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 6D46237B401; Wed, 7 May 2003 13:16:14 -0700 (PDT) Received: from sccrmhc03.attbi.com (sccrmhc03.attbi.com [204.127.202.63]) by mx1.FreeBSD.org (Postfix) with ESMTP id 92A0143F3F; Wed, 7 May 2003 13:16:13 -0700 (PDT) (envelope-from julian@elischer.org) Received: from interjet.elischer.org (12-232-168-4.client.attbi.com[12.232.168.4]) by attbi.com (sccrmhc03) with ESMTP id <2003050720161100300bd147e>; Wed, 7 May 2003 20:16:12 +0000 Received: from localhost (localhost.elischer.org [127.0.0.1]) by InterJet.elischer.org (8.9.1a/8.9.1) with ESMTP id NAA47706; Wed, 7 May 2003 13:16:09 -0700 (PDT) Date: Wed, 7 May 2003 13:16:08 -0700 (PDT) From: Julian Elischer To: David Xu In-Reply-To: <003001c313a3$0de7d500$f001a8c0@davidw2k> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII cc: threads@freebsd.org cc: Daniel Eischen Subject: Re: kern_threads.c.. upcall question.. X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 May 2003 20:16:14 -0000 On Tue, 6 May 2003, David Xu wrote: > > > > > > This is quantum preemptive for userland, it is used when statclock > > > interrupt hit in userland, if thread quantum is exhausted, > > > it must unbind upcall from current thread, and schedule an upcall, > > > you can think it is an implicit syscall triggered by CPU automatically > > > which just means to swap out current thread. > > > > > > ah.. > > I was thinking that we could delay most of thread_user_enter() > > until we need it.. > > i.e why read the mailbox until we need it.. > > > > I think fuword is very fast, at least in i386, there is > few instructions in fuword, please read its code in > /sys/i386/i386/support.s, optimizing it may be not worth to do. > Beside this, you can not fetch mailbox pointer on damand, > thread_schedule_upcall is protected under sched lock, it > can not handle page fault at that time, and kse_thr_interrupt > need a mailbox pointer to indentify thread in kernel, delaying > it will cause problem. Currently we cannot identify threads that are getting pagefaults or other reasons to enter the kernel except for syscall. I think there are probably ways that this can be optimised, but it is not important to do it now. > > > >