Re: [PATCH] Avoid use of the old CPU macros

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, May 09, 2018 at 06:26:16PM +0200, Stanislav Brabec wrote:
> Michael Matz wrote:
> > On Wed, 9 May 2018, Stanislav Brabec wrote:
> >>  	for (cpu = 0; cpu < setsize; cpu++) {
> >> -		if (!CPU_ISSET(cpu, cpu_set))
> >> +		if (!CPU_ISSET_S(cpu, setsize, cpu_set))
> > 
> > Careful, the _S macros count the size in _bytes_, the above loop iterates 
> > in nr-of-cpus (i.e. bits), or alternatively if the caller really gives a 
> > byte size then the loop iterations don't catch all CPUs.  More instances 
> > follow.
> 
> setsize passed to the function is CPU_ALLOC_SIZE(maxcpus).
> 
> Do I understand correctly that the new !CPU_ISSET_S is correct, but the
> loop limit should be maxcpus?

I think so, setsize is aligned (in bytes) to handle maxsize (bits).
The loop is incorrect, should be maxcpus. I'll fix.

    Karel


-- 
 Karel Zak  <kzak@xxxxxxxxxx>
 http://karelzak.blogspot.com
--
To unsubscribe from this list: send the line "unsubscribe util-linux" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux