From owner-freebsd-current Sun Nov 25 15:51:26 2001 Delivered-To: freebsd-current@freebsd.org Received: from peter3.wemm.org (c1315225-a.plstn1.sfba.home.com [24.14.150.180]) by hub.freebsd.org (Postfix) with ESMTP id 5C3E137B41A; Sun, 25 Nov 2001 15:51:22 -0800 (PST) Received: from overcee.netplex.com.au (overcee.wemm.org [10.0.0.3]) by peter3.wemm.org (8.11.0/8.11.0) with ESMTP id fAPNpMM69299; Sun, 25 Nov 2001 15:51:22 -0800 (PST) (envelope-from peter@wemm.org) Received: from wemm.org (localhost [127.0.0.1]) by overcee.netplex.com.au (Postfix) with ESMTP id 0FD1238CC; Sun, 25 Nov 2001 15:51:22 -0800 (PST) (envelope-from peter@wemm.org) X-Mailer: exmh version 2.5 07/13/2001 with nmh-1.0.4 To: Luigi Rizzo Cc: Bruce Evans , Mike Smith , John Baldwin , current@FreeBSD.ORG Subject: Re: where is the idle_loop in current ? In-Reply-To: <20011125064458.A76206@iguana.aciri.org> Date: Sun, 25 Nov 2001 15:51:22 -0800 From: Peter Wemm Message-Id: <20011125235122.0FD1238CC@overcee.netplex.com.au> Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Luigi Rizzo wrote: > Now, the whole problem here seems to be that kernel threads > are not preemptable, which is something that worries me a > bit because in CURRENT we use them for interrupt handlers as > well, and those used to be preemptable (subject to spl masks) > in RELENG_4. No, the kernel in general isn't preemptable in that a higher priority process that becomes runnable will not run until the lower priority process either blocks, returns to userland, or yields the cpu. Interrupt threads are special in that they will preempt a process that is in kernel context. This is not the same as a higher priority process being woken up with wakeup(). The problems in vm_zeroidle come from trying to avoid changing both the mechanism and the work algorithm at the same time. The mechanism got switched over, and now it is time to fix the algorithms to deal with that. Bruce has written about this elsewhere. Interrupts still preempt just like on releng_4, but subject to the &Giant. Obviously this means that a non-mpsafe interrupt cannot do anything useful if it interrupts non-mpsafe code as it will immediately block on &Giant. Audio is an example of something that *is* mpsafe though and can preempt just about anything in the kernel, even on another CPU. The idle processes are special in -current. What I said about them not being able to do anything isn't quite correct. The restriction is that they cannot, and must not, block. This means they cannot tsleep or get a mutex. And since they run outside Giant, that means they cannot go anywhere near the non-mpsafe parts of the kernel, such as the network stack or drivers. That means, unfortunately, that you have no choice in -current. It has to be and idle priority process. A side effect of that means that there is no longer a reason that it cannot be machine independent and SMP safe. > On the other hand, if preemptable threads are implemented > (which one of the messages in this thread suggests might > occur), then things will improve even wrt RELENG_4 It simplifies things a lot. It means that the ugly hacks to yield the cpu in things like vm_pagezero can go away entirely. It makes life a lot easier for people wanting to do idle priority work. > On Sun, Nov 25, 2001 at 09:26:51PM +1100, Bruce Evans wrote: > > > Anyway, I think luigi wants the non-process benefits of hacking on the > > old idle loop. Sorry, the only way to get these seems to be to upgrade > > to RELENG_4. > > which, funnily, I have already... This thread came out because in > order to import my polling stuff in the tree (see my yet-unanswered > request to -core), having a CURRENT version seems useful to lower > resistance. Because we haven't seen the cleaned up, -current version yet. We told you before that we had issues with the style bugs etc. We cant give you a blanket commit approval without seeing it first. > I don't mind having spent the time for doing it, in the process i > certainly learned something on the internals of CURRENT, but this > seems to be about the only useful result of this additional work :) > > cheers > luigi > ----------------------------------+----------------------------------------- > Luigi RIZZO, luigi@iet.unipi.it . ACIRI/ICSI (on leave from Univ. di Pisa) > http://www.iet.unipi.it/~luigi/ . 1947 Center St, Berkeley CA 94704 > Phone: (510) 666 2927 > ----------------------------------+----------------------------------------- > > Cheers, -Peter -- Peter Wemm - peter@FreeBSD.org; peter@yahoo-inc.com; peter@netplex.com.au "All of this is for nothing if we don't go to the stars" - JMS/B5 To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message