Skip to contentSkip to conversation

percpu: use INT_MAX as sentinel value of unit_map

PATCH In review Namhyung Kim 2 participants 2 messages Aug 10, 2010

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 percpu: use INT_MAX as sentinel value of unit_map

unit_map is a pointer to int so it would be more reasonable to use INT_MAX as sentinel value.

---
 mm/percpu.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
mm/percpu.c +3 -3
index 6470e77..9581f84 100644
@@ -1390,7 +1390,7 @@ int __init pcpu_setup_first_chunk(const struct pcpu_alloc_info *ai,
 	unit_off = alloc_bootmem(nr_cpu_ids * sizeof(unit_off[0]));
 
 	for (cpu = 0; cpu < nr_cpu_ids; cpu++)
-		unit_map[cpu] = UINT_MAX;
+		unit_map[cpu] = INT_MAX;
 	pcpu_first_unit_cpu = NR_CPUS;
 
 	for (group = 0, unit = 0; group < ai->nr_groups; group++, unit += i) {
@@ -1406,7 +1406,7 @@ int __init pcpu_setup_first_chunk(const struct pcpu_alloc_info *ai,
 
 			PCPU_SETUP_BUG_ON(cpu > nr_cpu_ids);
 			PCPU_SETUP_BUG_ON(!cpu_possible(cpu));
-			PCPU_SETUP_BUG_ON(unit_map[cpu] != UINT_MAX);
+			PCPU_SETUP_BUG_ON(unit_map[cpu] != INT_MAX);
 
 			unit_map[cpu] = unit + i;
 			unit_off[cpu] = gi->base_offset + i * ai->unit_size;
@@ -1419,7 +1419,7 @@ int __init pcpu_setup_first_chunk(const struct pcpu_alloc_info *ai,
 	pcpu_nr_units = unit;
 
 	for_each_possible_cpu(cpu)
-		PCPU_SETUP_BUG_ON(unit_map[cpu] == UINT_MAX);
+		PCPU_SETUP_BUG_ON(unit_map[cpu] == INT_MAX);
 
 	/* we're done parsing the input, undefine BUG macro and dump config */
 #undef PCPU_SETUP_BUG_ON
Signature · 1 line
1.7.0.4
maintainer
#1 lore raw
Quoted 4 lines · Namhyung Kim

unit_map is a pointer to int so it would be more reasonable to use INT_MAX as sentinel value.

Hmmm... yeah unit_map used to be uint. I'd much prefer -1 (which would actually result in the same code BTW) over INT_MAX tho.

Thanks.

Signature · 1 line
tejun