Re: 2.6.8-rc4-mm1

William Lee Irwin III
2004-08-10T23:04:09Z

On Tue, Aug 10, 2004 at 03:43:08PM -0700, William Lee Irwin III wrote:
>> This still doesn't eliminate the branch in ia64's copy_thread().
>> The best solution possible would be to redo the whole affair as an
>> ia64-specific cleanup pass, and to find some initial setting of regs
>> that works for all architectures (it seems memset(&regs, 0, ...) doesn't).

On Tue, Aug 10, 2004 at 03:45:32PM -0700, William Lee Irwin III wrote:
> "whole affair" == NULL check in copy_thread(). Except this is a nop, so
> I think we're just looking for something that survives copy_thread().

I have an even better fix:

Index: mm1-2.6.8-rc4/arch/ia64/kernel/smpboot.c
===================================================================
--- mm1-2.6.8-rc4.orig/arch/ia64/kernel/smpboot.c 2004-08-10 15:32:08.000000000 -0700
+++ mm1-2.6.8-rc4/arch/ia64/kernel/smpboot.c 2004-08-10 15:55:28.902437225 -0700
@@ -356,6 +356,11 @@
return cpu_idle();
}

+struct pt_regs * __init idle_regs(struct pt_regs *regs)
+{
+ return NULL;
+}
+
struct create_idle {
struct task_struct *idle;
struct completion done;
Index: mm1-2.6.8-rc4/kernel/fork.c
===================================================================
--- mm1-2.6.8-rc4.orig/kernel/fork.c 2004-08-10 15:32:08.000000000 -0700
+++ mm1-2.6.8-rc4/kernel/fork.c 2004-08-10 16:01:24.383878183 -0700
@@ -1190,13 +1190,18 @@
goto fork_out;
}

+struct pt_regs * __init __attribute__((weak)) idle_regs(struct pt_regs *regs)
+{
+ memset(regs, 0, sizeof(struct pt_regs));
+ return regs;
+}
+
task_t * __init fork_idle(int cpu)
{
task_t *task;
struct pt_regs regs;

- memset(&regs, 0, sizeof(struct pt_regs));
- task = copy_process(CLONE_VM, 0, &regs, 0, NULL, NULL, 0);
+ task = copy_process(CLONE_VM, 0, idle_regs(&regs), 0, NULL, NULL, 0);
if (!task)
return ERR_PTR(-ENOMEM);
init_idle(task, cpu);