svn commit: r208165 - in head/sys: kern mips/conf mips/include mips/mips mips/rmi mips/rmi/dev/xlr

Juli Mallett jmallett at FreeBSD.org
Mon Aug 9 06:12:31 UTC 2010


On Sun, Aug 8, 2010 at 17:01, Attilio Rao <attilio at freebsd.org> wrote:
>> Modified: head/sys/kern/subr_smp.c
>> ==============================================================================
>> --- head/sys/kern/subr_smp.c    Sun May 16 19:25:56 2010        (r208164)
>> +++ head/sys/kern/subr_smp.c    Sun May 16 19:43:48 2010        (r208165)
>> @@ -503,7 +503,10 @@ smp_topo_none(void)
>>        top = &group[0];
>>        top->cg_parent = NULL;
>>        top->cg_child = NULL;
>> -       top->cg_mask = (1 << mp_ncpus) - 1;
>> +       if (mp_ncpus == sizeof(top->cg_mask) * 8)
>> +               top->cg_mask = -1;
>> +       else
>> +               top->cg_mask = (1 << mp_ncpus) - 1;
>>        top->cg_count = mp_ncpus;
>>        top->cg_children = 0;
>>        top->cg_level = CG_SHARE_NONE;
>>
>
> The fix is, however, improper (there is no clear relationship between
> the multiplication and why that happens) thus I would rather use what
> Joe has reported in the PR.

I don't understand how you can say there is no clear relationship
between the multiplication and the problem.  If you have the same
number of CPUs as there are bits in cg_mask, since 1 is an int the
result of the shift and the subtraction will be wrong unless int has
more bits than cg_mask.  Both fixes fail to handle the case of more
CPUs than there are bits in cg_mask, but that's expected.

I agree with you about the nature of the commit message and the
commit, but my complaints (and those of others) back in May went
unacknowledged and I don't expect comments about that this long after
the fact to make an impact.

Juli.


More information about the svn-src-head mailing list