Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 26 Nov 2001 09:43:30 -0800 (PST)
From:      John Baldwin <jhb@FreeBSD.org>
To:        Luigi Rizzo <rizzo@aciri.org>
Cc:        current@FreeBSD.org
Subject:   Re: where is the idle_loop in current ?
Message-ID:  <XFMail.011126094330.jhb@FreeBSD.org>
In-Reply-To: <20011123151522.B58238@iguana.aciri.org>

next in thread | previous in thread | raw e-mail | index | archive | help

On 23-Nov-01 Luigi Rizzo wrote:
> In order to port my network polling stuff to current, I was looking
> at ways to do things within the "idle loop", and was pointed to
> the idle_proc() or vm_pagezero() .  I am listing below the code
> for these kernel threads (I hope the name is the correct one).
> 
> I do not follow, however, the reason why these two threads periodically
> give up the CPU, given that their priority is (i guess) lower than
> any other thread in the system, so any event that should wake up
> a thread would immediately cause their preemption.
> Where am i wrong ?

We don't do preemption in the kernel yet, so they need to yield the CPU when
another thread is available.  The page zeroing thread does this wrong as it
should check procrunnable() instead of switching after doing N pages.  The idle
loop idle_proc() can't do any work w/o breaking priority propagation.  If you
wish to do low priority work, create a idle priority kthread to do it and make
sure it yields when there is other work to do of higher priority.

-- 

John Baldwin <jhb@FreeBSD.org>  <><  http://www.FreeBSD.org/~jhb/
"Power Users Use the Power to Serve!"  -  http://www.FreeBSD.org/

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?XFMail.011126094330.jhb>