From owner-freebsd-arch@FreeBSD.ORG Sun Oct 3 07:04:56 2004 Return-Path: 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 D927E16A4CE for ; Sun, 3 Oct 2004 07:04:56 +0000 (GMT) Received: from ylpvm15.prodigy.net (ylpvm15-ext.prodigy.net [207.115.57.46]) by mx1.FreeBSD.org (Postfix) with ESMTP id 92F8A43D1D for ; Sun, 3 Oct 2004 07:04:56 +0000 (GMT) (envelope-from julian@elischer.org) Received: from elischer.org (adsl-67-124-49-205.dsl.snfc21.pacbell.net [67.124.49.205])i93752qM004216; Sun, 3 Oct 2004 03:05:03 -0400 Message-ID: <415FA496.6000902@elischer.org> Date: Sun, 03 Oct 2004 00:04:54 -0700 From: Julian Elischer User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.4b) Gecko/20030524 X-Accept-Language: en, hu MIME-Version: 1.0 To: Stephan Uphoff References: <1096489576.3733.1868.camel@palm.tree.com> <200409291652.29990.jhb@FreeBSD.org> <1096496057.3733.2163.camel@palm.tree.com> <1096603981.21577.195.camel@palm.tree.com> <1096608201.21577.203.camel@palm.tree.com> <20041001141040.GA1556@peter.osted.lan> <1096647194.27811.12.camel@palm.tree.com> <20041001192551.GA3381@peter.osted.lan> <20041002053351.GA6259@peter.osted.lan> <415EEFFE.5080309@elischer.org> <20041002183120.GA1202@peter.osted.lan> <1096760257.34527.14.camel@palm.tree.com> In-Reply-To: <1096760257.34527.14.camel@palm.tree.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit cc: Peter Holm cc: "freebsd-arch@freebsd.org" Subject: Re: scheduler (sched_4bsd) questions X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Oct 2004 07:04:57 -0000 Stephan Uphoff wrote: > On Sat, 2004-10-02 at 14:31, Peter Holm wrote: > >>OK, right now I'm testing with all of Stephan's patches + the >>MUTEX_WAKE_ALL flag. Uptime is 3 3/4 hour and looking good. > > > Great. > > Your attached diff contained all the fixes needed and I don't see the > need to post a cumulative patch. > > The only thing left to do is migrate a critical sections from > kern_mutex.c to subr_turnstile.c for readability. > (no functional changes) > > Maybe it would also better to just force MUTEX_WAKE_ALL in > kern_mutex.c (#ifndef MUTEX_WAKE_ALL \n#define MUTEX_WAKE_ALL\n#endif) > to avoid temporary configuration file pollution? > > Stephan > > Hi stephan. Just reading your patch(es).. What's the logic behind adding the critical sections around the priority changes in the turnstyle code? can you give an example of the timeline you are avoidning? I presume it involves an interrupt setting another thread running. Why do you think that it is unacceptible to allow a thread with a lower priority to continue to run on another cpu (or this cpu) (maybe_preempt_in_ksegrp()) Can you show the reason that this is "critical" and not just suboptimal? If you are going to preempt threads from the same KSEGRP why not preempt threads from other ksegrps? BTW an available slot count going -ve might not be a disaster.. it's just a count.. I guess you must have KSEG_PEEMPT_BEST_CPU always set because preempting the "not best" cpu would lead to teh same inversion problem that you are trying to avoid, when you leave a thread running on another CPU that has less priority (numerically greater than) than the one that you are preempting.. Where is the critical_enter that matches the extra critical_exit() you put in sched_switch()? I haven' been able to yet figure out how you don't get a double exit. but I've only looked for a few minutes. regarding the ksegrp runq. For some time I have wanted to split it into 3 queues and the threads will move between them. (in the ksegrp sched-private section) queue 1.. threads that are running queue 2.. threads that are on the system run queue. queue 3.. threads that do not yet have a slot. what do you think? it should simplify the slot counting stuff.