Skip to contentSkip to conversation

cpumask: make cpumask.h eat its own dogfood.

DISCUSSION Andrew Morton 1 participant 1 message Jan 15, 2009 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw
Quoted 10 lines · On Sat, 3 Jan 2009 21:08:26 GMT Linux Kernel Mailing List…
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 <[email protected]>
AuthorDate: Tue Dec 30 09:05:15 2008 +1030
Committer:  Rusty Russell <[email protected]>
CommitDate: Tue Dec 30 09:05:15 2008 +1030

cpumask: make cpumask.h eat its own dogfood.

Quoted 7 lines

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?

Quoted 4 lines
(quoted diff) +0 -4
-#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)

Review

Quoted 10 lines
(quoted diff) +7 -3
-#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'.