Re: cpumask: make cpumask.h eat its own dogfood.

From: Andrew Morton
Date: Thu Jan 15 2009 - 16:49:46 EST


On Sat, 3 Jan 2009 21:08:26 GMT
Linux Kernel Mailing List <linux-kernel@xxxxxxxxxxxxxxx> wrote:

> Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=ae7a47e72e1a0b5e2b46d1596bc2c22942a73023
> Commit: ae7a47e72e1a0b5e2b46d1596bc2c22942a73023
> Parent: b3199c025d1646e25e7d1d640dd605db251dccf8
> Author: Rusty Russell <rusty@xxxxxxxxxxxxxxx>
> AuthorDate: Tue Dec 30 09:05:15 2008 +1030
> Committer: Rusty Russell <rusty@xxxxxxxxxxxxxxx>
> CommitDate: Tue Dec 30 09:05:15 2008 +1030
>
> cpumask: make cpumask.h eat its own dogfood.
>
> Changes:
> 1) cpumask_t to struct cpumask,
> 2) cpus_weight_nr to cpumask_weight,
> 3) cpu_isset to cpumask_test_cpu,
> 4) ->bits to cpumask_bits()
> 5) cpu_*_map to cpu_*_mask.
> 6) for_each_cpu_mask_nr to for_each_cpu

I can't find this commit (by this title) on linux-kernel to reply to.
Please try real hard to prevent this from occurring?

> -#define num_online_cpus() cpus_weight_nr(cpu_online_map)
> -#define num_possible_cpus() cpus_weight_nr(cpu_possible_map)
> -#define num_present_cpus() cpus_weight_nr(cpu_present_map)
> -#define cpu_online(cpu) cpu_isset((cpu), cpu_online_map)
> -#define cpu_possible(cpu) cpu_isset((cpu), cpu_possible_map)
> -#define cpu_present(cpu) cpu_isset((cpu), cpu_present_map)
> -#define cpu_active(cpu) cpu_isset((cpu), cpu_active_map)
> +#define num_online_cpus() cpumask_weight(cpu_online_mask)
> +#define num_possible_cpus() cpumask_weight(cpu_possible_mask)
> +#define num_present_cpus() cpumask_weight(cpu_present_mask)
> +#define cpu_online(cpu) cpumask_test_cpu((cpu), cpu_online_mask)
> +#define cpu_possible(cpu) cpumask_test_cpu((cpu), cpu_possible_mask)
> +#define cpu_present(cpu) cpumask_test_cpu((cpu), cpu_present_mask)
> +#define cpu_active(cpu) cpumask_test_cpu((cpu), cpu_active_mask)

These alterations secretly changed the return type of these macros from
"int" to "unsigned int".

This has caused a couple of compile-time warnings from min() and max().
Hopefully there won't be any more serious fallout.

I think it's a _good_ change - there's no logical reason for these
macros to return negative numbers. But I suspect it was an accidental
change.

But everything is now all screwed up. cpumask_weight() and friends
return `unsigned int', but cpus_weight() and bitmap_weight() return
`int'.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/