Skip to contentSkip to conversation

Linux 2.5.23 cpu_online_map undeclared

DISCUSSION John Weber 4 participants 4 messages Jun 19, 2002 – Jun 20, 2002

lore
Share & tools
lore

John Weber

author
#0 lore raw

I am running on a UP system, so I don't believe that cpu_online_map should be declared. Any suggestions?

gcc -Wp,-MD,./.sched.o.d -D__KERNEL__ -I/usr/src/linux-2.5.23/include
-Wall -Wstrict-prototypes -Wno-trigraphs -O2 -fomit-frame-pointer -fno-strict-aliasing -fno-common -pipe -mpreferred-stack-boundary=2 -march=i686 -nostdinc -iwithprefix include -fno-omit-frame-pointer -DKBUILD_BASENAME=sched -c -o sched.o sched.c
sched.c: In function `sys_sched_setaffinity':
sched.c:1332: `cpu_online_map' undeclared (first use in this function) sched.c:1332: (Each undeclared identifier is reported only once sched.c:1332: for each function it appears in.)
sched.c: In function `sys_sched_getaffinity':
sched.c:1391: `cpu_online_map' undeclared (first use in this function) make[1]: *** [sched.o] Error 1
make[1]: Leaving directory `/usr/src/linux-2.5.23/kernel'
make: *** [kernel] Error 2

-o) J o h n W e b e r
/\\ [email protected]
_\/v http://www.linuxhq.com/people/weber/

#1 lore raw

In article <[email protected]>,

Quoted 2 lines · John Weber

I am running on a UP system, so I don't believe that cpu_online_map should be declared. Any suggestions?

Actually, it _should_ be declared, it's just that on UP it should be defined to the constant 1.

Somehow that #define got dropped by the hotplug-CPU stuff.

To fix, just add a

	#define cpu_online_map		1

to the non-SMP parts of include/linus/smp.h. The patch looks something like the appended (totally untested) thing.

Does that make UP happier?

Linus

include/linux/smp.h +1 -0
@@ -86,6 +86,7 @@
 #define smp_call_function(func,info,retry,wait)	({ 0; })
 static inline void smp_send_reschedule(int cpu) { }
 static inline void smp_send_reschedule_all(void) { }
+#define cpu_online_map				1
 #define cpu_online(cpu)				1
 #define num_online_cpus()			1
 #define __per_cpu_data
#2 lore raw
Quoted 3 lines · Linus Torvalds

static inline void smp_send_reschedule_all(void) { }
+#define cpu_online_map 1
#define cpu_online(cpu) 1

yesterday i've tested a number of UP kernels that had an equivalent fix and this works as expected, nothing else broke.

Ingo

#3 lore raw
In reply to Linus Torvalds
Quoted 4 lines · On Wed, 19 Jun 2002 05:36:08 +0000 (UTC) [email protected] (Linus…

Actually, it _should_ be declared, it's just that on UP it should be defined to the constant 1.

Somehow that #define got dropped by the hotplug-CPU stuff.

Actually, was deliberate. Not exposing the mask when almost everyone just wants to know "are any of these cpus online" was a preemptive strike against NR_CPUS > BITS_PER_LONG (I wouldn't have bothered but I was so close anyway).

My mistake was not noticing that x86 SMP was still exposing it and that scheduler changes since my original patch were using it. Fixed with cpu_online_mask(res, mask) in prior patch.

Apologies, and hope that clarifies,
Rusty.

Signature · 2 lines
   there are those who do and those who hang on and you don't see too
   many doers quoting their contemporaries.  -- Larry McVoy