What is prepare_arch_schedule for?
I'm messing around with Linux kernel 2.4 and function schedule() in sched.c uses the macro prepare_arch_schedule, which looks really strange. What is that?
Here's the relevant section
#ifndef prepare_arch_schedule
# define prepare_arch_schedule(prev) do { } while(0)
# define finish_arch_schedule(prev) do { } while(0)
# defin开发者_开发百科e prepare_arch_switch(rq) do { } while(0)
# define finish_arch_switch(rq) spin_unlock_irq(&(rq)->lock)
#endif
I still don't understand why you think it's an infinite loop :) .
It's a "hack" for an empty statement and the reason it's there is because the compiler can complain when it hits an empty statement.
From what I understand, context switch locking is architecture dependent and so, for architectures for which the locking hasn't been defined, this empty statement was defined so that you don't have to modify schedule() for each architecture. Hence the #ifndef...
精彩评论