1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-04 09:09:56 +00:00

The r208165 fixed a bug related to unsigned integer overflowing for the

number of CPUs detection.
However, that was not mention at all, the problem was not reported, the
patch has not been MFCed and the fix is mostly improper.

Fix the original overflow (caused when 32 CPUs must be detected) by
just using a different mathematical computation (it also makes more
explicit the size of operands involved, which is good in the moment
waiting for a more complete support for a large number of CPUs).

PR:		kern/148698
Submitted by:	Joe Landers <jlanders at vmware dot com>
Tested by:	gianni
MFC after:	10 days
This commit is contained in:
Attilio Rao 2010-08-09 00:23:57 +00:00
parent 743149d2ab
commit 2d8b420b9f
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=211087

View File

@ -504,10 +504,7 @@ smp_topo_none(void)
top = &group[0];
top->cg_parent = NULL;
top->cg_child = NULL;
if (mp_ncpus == sizeof(top->cg_mask) * 8)
top->cg_mask = -1;
else
top->cg_mask = (1 << mp_ncpus) - 1;
top->cg_mask = ~0U >> (32 - mp_ncpus);
top->cg_count = mp_ncpus;
top->cg_children = 0;
top->cg_level = CG_SHARE_NONE;