[PATCH 1/2] turn c_idle into a pointer

From: Glauber Costa
Date: Thu Feb 21 2008 - 15:51:29 EST


This is not useful by itself, but part of making the
underlying work_struct have a static address.

Signed-off-by: Glauber Costa <gcosta@xxxxxxxxxx>
---
arch/x86/kernel/smpboot_64.c | 37 +++++++++++++++++++------------------
1 files changed, 19 insertions(+), 18 deletions(-)

diff --git a/arch/x86/kernel/smpboot_64.c b/arch/x86/kernel/smpboot_64.c
index d53bd6f..f15b774 100644
--- a/arch/x86/kernel/smpboot_64.c
+++ b/arch/x86/kernel/smpboot_64.c
@@ -553,11 +553,12 @@ static int __cpuinit do_boot_cpu(int cpu
unsigned long boot_error;
int timeout;
unsigned long start_rip;
- struct create_idle c_idle = {
- .work = __WORK_INITIALIZER(c_idle.work, do_fork_idle),
+ struct create_idle create_idle = {
+ .work = __WORK_INITIALIZER(create_idle.work, do_fork_idle),
.cpu = cpu,
- .done = COMPLETION_INITIALIZER_ONSTACK(c_idle.done),
+ .done = COMPLETION_INITIALIZER_ONSTACK(create_idle.done),
};
+ struct create_idle *c_idle = &create_idle;

/* allocate memory for gdts of secondary cpus. Hotplug is considered */
if (!cpu_gdt_descr[cpu].address &&
@@ -584,12 +585,12 @@ static int __cpuinit do_boot_cpu(int cpu

alternatives_smp_switch(1);

- c_idle.idle = get_idle_for_cpu(cpu);
+ c_idle->idle = get_idle_for_cpu(cpu);

- if (c_idle.idle) {
- c_idle.idle->thread.sp = (unsigned long) (((struct pt_regs *)
- (THREAD_SIZE + task_stack_page(c_idle.idle))) - 1);
- init_idle(c_idle.idle, cpu);
+ if (c_idle->idle) {
+ c_idle->idle->thread.sp = (unsigned long) (((struct pt_regs *)
+ (THREAD_SIZE + task_stack_page(c_idle->idle))) - 1);
+ init_idle(c_idle->idle, cpu);
goto do_rest;
}

@@ -604,29 +605,29 @@ static int __cpuinit do_boot_cpu(int cpu
* thread.
*/
if (!keventd_up() || current_is_keventd())
- c_idle.work.func(&c_idle.work);
+ c_idle->work.func(&c_idle->work);
else {
- schedule_work(&c_idle.work);
- wait_for_completion(&c_idle.done);
+ schedule_work(&c_idle->work);
+ wait_for_completion(&c_idle->done);
}

- if (IS_ERR(c_idle.idle)) {
+ if (IS_ERR(c_idle->idle)) {
printk("failed fork for CPU %d\n", cpu);
- return PTR_ERR(c_idle.idle);
+ return PTR_ERR(c_idle->idle);
}

- set_idle_for_cpu(cpu, c_idle.idle);
+ set_idle_for_cpu(cpu, c_idle->idle);

do_rest:

- cpu_pda(cpu)->pcurrent = c_idle.idle;
+ cpu_pda(cpu)->pcurrent = c_idle->idle;

start_rip = setup_trampoline();

- init_rsp = c_idle.idle->thread.sp;
- load_sp0(&per_cpu(init_tss, cpu), &c_idle.idle->thread);
+ init_rsp = c_idle->idle->thread.sp;
+ load_sp0(&per_cpu(init_tss, cpu), &c_idle->idle->thread);
initial_code = start_secondary;
- clear_tsk_thread_flag(c_idle.idle, TIF_FORK);
+ clear_tsk_thread_flag(c_idle->idle, TIF_FORK);

printk(KERN_INFO "Booting processor %d/%d APIC 0x%x\n", cpu,
cpus_weight(cpu_present_map),
--
1.4.2

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/