New cpu macro and i386 cleanup
Quoted 1 line · Robert Love
I like, although I am not hot on the name, but that is just taste.
I found myself wishing for C++ just for the function overloading so it could be 'is_current(cpu)' or similar.
Quoted 1 line
One minor nit: it is not preempt-safe.
I was wondering whether the code I converted was running with preempt disabled or not but didn't check. (The very thought of preempt on SMP scares me anyway, so I avoid it.)
smp_processor_id() is not preempt-safe either, since the id could change before you even get a chance to use the value. How many thousands of lines of code remain that were written assuming things would not change underneath them in kernel mode?
Quoted 1 line
Maybe put a comment above it like:
How about one for the whole kernel?
/**********
* WARNING: Use preempt at your own risk.
**********/ --
Chuck
I am not a number!
Quoted 3 lines · Chuck Ebbert
I was wondering whether the code I converted was running with preempt disabled or not but didn't check. (The very thought of preempt on SMP scares me anyway, so I avoid it.)
On a glance, it looked like at least some of them were.
Quoted 4 lines
smp_processor_id()is not preempt-safe either, since the id could change before you even get a chance to use the value. How many thousands of lines of code remain that were written assuming things would not change underneath them in kernel mode?
Code that needs the processor number to remain fixed now uses get_cpu() and put_cpu() which disable preemption.
Quoted 8 lines
Quoted 1 line
Maybe put a comment above it like:
How about one for the whole kernel?
/********** * WARNING: Use preempt at your own risk. **********/
No :)
Robert Love