cpuset macro /vs/ inline implementation

Daniel Hellstrom daniel at gaisler.com
Thu Oct 31 11:30:04 UTC 2013


Hello Jennifer,

I think it looks good. I have small comments and nitpicks ;)

I see that the cpu_set_word_t is set to 32-bit which suites most CPUs, there is probably a good reason for it but would it make sens to make it dependent on the architecture? So that 64-bit machines 
have it sized to 64-bits. I'm not sure there are 16-bit SMP machines :) . The rest of the code seems to support it by scaling depending on the size of that type.

> /* fill set */
> static inline void CPU_FILL(cpu_set_t *set)
> {
>    size_t i;
>    for (i = 0; i < _NCPUWORDS; i++)
> -    set->__bits[i] = -1;
> +    set->__bits[i] = ~0;
> }
bits[] is declared as unsigned, the above it perhaps a better solution?


> /* Return 1 is cpu is set in set, 0 otherwise */
> static inline int const CPU_ISSET(size_t cpu, const cpu_set_t *set)
> {
>    return ((set->__bits[__cpuset_index(cpu)] & __cpuset_mask(cpu)) != 0);
> }
Return 1 *if* cpu..


> /* return the number of set cpus in set */
> static inline int const CPU_COUNT(const cpu_set_t *set)
> {
>    size_t i;
>    int    count = 0;
indent error.
>
>    for (i=0; i < _NCPUWORDS; i++)
>      if (CPU_ISSET(i, set) != 0)
>        count++;
>    return count;
> }

Another unimportant note, I see that some of the arguments are separated with a space and some not.. unless its my email clients work.

Thanks for a good job in defining and implementing the cpuset API!

Daniel




On 10/28/2013 06:23 PM, Jennifer Averett wrote:
> I attached the latest cpuset.  From the  discussions
> we are going with the inline version and I think I have incorporated
> all previous comments into the file.
>
> Are there any more comments or discussion?
>
> Jennifer Averett
> On-Line Applications Research
>
>
> _______________________________________________
> rtems-devel mailing list
> rtems-devel at rtems.org
> http://www.rtems.org/mailman/listinfo/rtems-devel




More information about the devel mailing list