[PATCH] i386: Implement smp_processor_id() with the PDA

Use the cpu_number in the PDA to implement raw_smp_processor_id.  This is a
little simpler than using thread_info, though the cpu field in thread_info
cannot be removed since it is used for things other than getting the current
CPU in common code.

Signed-off-by: Jeremy Fitzhardinge <[email protected]>
Signed-off-by: Andi Kleen <[email protected]>
Cc: Chuck Ebbert <[email protected]>
Cc: Zachary Amsden <[email protected]>
Cc: Jan Beulich <[email protected]>
Cc: Andi Kleen <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
This commit is contained in:
Jeremy Fitzhardinge 2006-12-07 02:14:03 +01:00 • committed by Andi Kleen
commit b2938f8808
5 changed files with 10 additions and 4 deletions

View file

@ -11,6 +11,8 @@
struct i386_pda
{
struct i386_pda *_pda; /* pointer to self */
int cpu_number;
};
extern struct i386_pda *_cpu_pda[];

View file

@ -8,6 +8,7 @@
#include <linux/kernel.h>
#include <linux/threads.h>
#include <linux/cpumask.h>
#include <asm/pda.h>
#endif
#ifdef CONFIG_X86_LOCAL_APIC
@ -56,7 +57,7 @@ extern void cpu_uninit(void);
* from the initial startup. We map APIC_BASE very early in page_setup(),
* so this is correct in the x86 case.
*/
#define raw_smp_processor_id() (current_thread_info()->cpu)
#define raw_smp_processor_id() (read_pda(cpu_number))
extern cpumask_t cpu_callout_map;
extern cpumask_t cpu_callin_map;