From owner-cvs-src@FreeBSD.ORG Wed Jan 24 06:12:35 2007 Return-Path: X-Original-To: cvs-src@FreeBSD.org Delivered-To: cvs-src@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 7FCBE16A401; Wed, 24 Jan 2007 06:12:35 +0000 (UTC) (envelope-from jroberson@chesapeake.net) Received: from webaccess-cl.virtdom.com (webaccess-cl.virtdom.com [216.240.101.25]) by mx1.freebsd.org (Postfix) with ESMTP id 2DB4513C459; Wed, 24 Jan 2007 06:12:35 +0000 (UTC) (envelope-from jroberson@chesapeake.net) Received: from [10.0.0.1] (63-226-247-187.tukw.qwest.net [63.226.247.187]) (authenticated bits=0) by webaccess-cl.virtdom.com (8.13.6/8.13.6) with ESMTP id l0O6CTnp009602 (version=TLSv1/SSLv3 cipher=DHE-DSS-AES256-SHA bits=256 verify=NO); Wed, 24 Jan 2007 01:12:31 -0500 (EST) (envelope-from jroberson@chesapeake.net) Date: Tue, 23 Jan 2007 22:12:49 -0800 (PST) From: Jeff Roberson X-X-Sender: jroberson@10.0.0.1 To: David Xu In-Reply-To: <45B6E2A5.6080404@freebsd.org> Message-ID: <20070123220934.H564@10.0.0.1> References: <200701230850.l0N8oZV2065483@repoman.freebsd.org> <200701241147.17846.davidxu@freebsd.org> <20070123200041.Y564@10.0.0.1> <45B6E2A5.6080404@freebsd.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: src-committers@FreeBSD.org, jhb@FreeBSD.org, cvs-src@FreeBSD.org, Jeff Roberson , cvs-all@FreeBSD.org, Julian Elischer Subject: Re: cvs commit: src/sys/kern sched_ule.c X-BeenThere: cvs-src@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: CVS commit messages for the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Jan 2007 06:12:35 -0000 On Wed, 24 Jan 2007, David Xu wrote: > Jeff Roberson wrote: > >>> if idlethread is preempted, who will clear its idle bit in idle_cpus_mask >>> ? >> >> >> idle_cpus_mask was broken before for all schedulers. This commit didn't >> change that. ULE doesn't use idle_cpus_mask and it's idlethread doesn't >> set or clear it. The idle thread for the other schedulers remains >> unchanged. >> > I havn't read ULE code, but 4BSD has following code: > This is the very same code that was there before. I didn't change it. I just moved it into the schedulers. It was always broken with preemption. I tried to use idle_cpus_mask in ULE but found that it always was set for most CPUs. You will find that IPI_PREEMPT also had no effect but I fixed that recently. Jeff > void > sched_idletd(void *dummy) > { > struct proc *p; > struct thread *td; > #ifdef SMP > cpumask_t mycpu; > #endif > > td = curthread; > p = td->td_proc; > #ifdef SMP > mycpu = PCPU_GET(cpumask); > mtx_lock_spin(&sched_lock); > idle_cpus_mask |= mycpu; > mtx_unlock_spin(&sched_lock); > #endif > for (;;) { > mtx_assert(&Giant, MA_NOTOWNED); > > > how about if the idlethread is preempted here ? mycpu is not cleared. > > > while (sched_runnable() == 0) > cpu_idle(); > > mtx_lock_spin(&sched_lock); > #ifdef SMP > idle_cpus_mask &= ~mycpu; > #endif > mi_switch(SW_VOL, NULL); > #ifdef SMP > idle_cpus_mask |= mycpu; > #endif > mtx_unlock_spin(&sched_lock); > } > } > >> Julian wants to set idle_cpus_mask in sched_switch() which would make it >> accurate no matter how idlethread switched out. that seems much more >> reasonable to me. >> > > I haven't seen sched_switch clears it, so at least, it should be fixed for > current 4BSD scheduler. > >> Cheers, >> Jeff > > Regards, > David Xu >