From owner-freebsd-current@FreeBSD.ORG Tue Feb 1 16:53:35 2005 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 280A716A4CE for ; Tue, 1 Feb 2005 16:53:35 +0000 (GMT) Received: from ylpvm15.prodigy.net (ylpvm15-ext.prodigy.net [207.115.57.46]) by mx1.FreeBSD.org (Postfix) with ESMTP id CECF643D45 for ; Tue, 1 Feb 2005 16:53:34 +0000 (GMT) (envelope-from nate@root.org) Received: from [10.0.0.34] (adsl-67-119-74-222.dsl.sntc01.pacbell.net [67.119.74.222])j11GnFbs025225; Tue, 1 Feb 2005 11:49:15 -0500 Message-ID: <41FFB40A.2000507@root.org> Date: Tue, 01 Feb 2005 08:53:30 -0800 From: Nate Lawson User-Agent: Mozilla Thunderbird 1.0RC1 (X11/20041205) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Joseph Koshy References: <41FF280F.1050102@root.org> <84dead720501312315319a5647@mail.gmail.com> In-Reply-To: <84dead720501312315319a5647@mail.gmail.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit cc: FreeBSD Current Subject: Re: patch: please test buildkernel X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Feb 2005 16:53:35 -0000 Joseph Koshy wrote: >>+#ifdef SMP >>+ /* Schedule ourselves on the indicated cpu. */ >>+ mtx_lock_spin(&sched_lock); >>+ sched_bind(curthread, cpu_id); >>+ mtx_unlock_spin(&sched_lock); >>+#endif > > ... > >>+#ifdef SMP >>+ mtx_lock_spin(&sched_lock); >>+ sched_unbind(curthread); >>+ mtx_unlock_spin(&sched_lock); >>+#endif > > > This will break if 'curthread' is already bound. > > I ended up solving this problem with a new interface 'sched_is_bound()': > > http://perforce.freebsd.org/changeView.cgi?CH=63367 > > The cleaner alternative would probably have 'sched_bind()' return the > previous CPU binding state. Not a problem for me since no code in the kernel calls this interface after sched_bind(). I agree this is a general problem that should be solved but I think it's fine to bring in cpufreq without solving it first. -- Nate