Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 01 Feb 2005 08:53:30 -0800
From:      Nate Lawson <nate@root.org>
To:        Joseph Koshy <joseph.koshy@gmail.com>
Cc:        FreeBSD Current <freebsd-current@freebsd.org>
Subject:   Re: patch: please test buildkernel
Message-ID:  <41FFB40A.2000507@root.org>
In-Reply-To: <84dead720501312315319a5647@mail.gmail.com>
References:  <41FF280F.1050102@root.org> <84dead720501312315319a5647@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?41FFB40A.2000507>