[PATCH] Add the infrastructure for supporting an infinite number of CPUs

Attilio Rao attilio at freebsd.org
Thu Jun 2 13:02:46 UTC 2011

2011/6/2 Ivan Voras <ivoras at freebsd.org>:
> On 02/06/2011 14:23, Ivan Voras wrote:
>> On 01/06/2011 20:21, Attilio Rao wrote:
>>> Current maximum number of CPUs supported by the FreeBSD kernel is 32.
>>> That number cames from indirectly by the fact that we have a cpumask_t
>>> type, representing a mask of CPUs, which is an unsigned int right now.
>>> I then made a patch that removes the cpumask_t type and uses cpuset_t
>>> type for characterizing a generic mask of CPUs:
>>> http://www.freebsd.org/~attilio/largeSMP/largeSMP-patchset-beta-0.diff
>> Hi,
>> I'm just wandering: what is the expected overhead of this, compared to
>> using a simple atomic integer (32-bit on i386, 64-bit on amd64)? I
>> assume that this will introduce more work, like locking, in
>> performance-critical code like the scheduler, etc.?

Once the cleanup of this code is finished (read one of the point of my
patches) only some global variables will still be needed to be used as
cpuset_t whole operation (all_cpus, for example) and they are all used
rarely enough that should be negligible.

FreeBSD right now uses the cpuset_t mostly for these things:
- pcpu masks (pc_cpumask, pc_other_cpus)
- pmap pm_active
- global masks for tracking online CPU, HTT, etc.

The second type is just accessed on a bit basis, so it doesn't apply.
The first one will be optimized in the next round of changes.
As said, just the third type will remain and really is a minor factor
in performance.

> The reason why I'm asking is this:
> http://msdn.microsoft.com/en-us/library/dd405503%28v=vs.85%29.aspx
> It's not necessarily a good approach, but it does have the benefit of
> keeping the CPU mask operations atomic... (I don't know if the benefits of
> this are big enough).

Well, it is just actually bypassing the problem and also I'm not
entirely sure it is a great idea from other point of views. In
particular, I've never seen so far a 64 cpus system offering
homogeinity among them, I wonder how you can consider a single
schedule entity something like 8 x 4 x 4(htt)?


Peace can only be achieved by understanding - A. Einstein

More information about the freebsd-current mailing list