Date: Mon, 9 Aug 2010 00:23:57 +0000 (UTC) From: Attilio Rao <attilio@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r211087 - head/sys/kern Message-ID: <201008090023.o790NvVn021656@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: attilio Date: Mon Aug 9 00:23:57 2010 New Revision: 211087 URL: http://svn.freebsd.org/changeset/base/211087 Log: 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 Modified: head/sys/kern/subr_smp.c Modified: head/sys/kern/subr_smp.c ============================================================================== --- head/sys/kern/subr_smp.c Sun Aug 8 23:24:23 2010 (r211086) +++ head/sys/kern/subr_smp.c Mon Aug 9 00:23:57 2010 (r211087) @@ -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;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201008090023.o790NvVn021656>