From: William Lee Irwin III <wli@holomorphy.com>
To: Andrew Morton <akpm@osdl.org>
Cc: linux-kernel@vger.kernel.org
Subject: Re: 2.6.8-rc3-mm1
Date: Thu, 5 Aug 2004 20:34:48 -0700 [thread overview]
Message-ID: <20040806033448.GP17188@holomorphy.com> (raw)
In-Reply-To: <20040805031918.08790a82.akpm@osdl.org>
On Thu, Aug 05, 2004 at 03:19:18AM -0700, Andrew Morton wrote:
> ftp://ftp.kernel.org/pub/linux/kernel/people/akpm/patches/2.6/2.6.8-rc3/2.6.8-rc3-mm1/
> - Added David Woodhouse's MTD tree to the "external trees" list
> - Dropped the staircase scheduler, mainly because the schedstats patch broke
> it.
> We learned quite a lot from having staircase in there. Now it's time for
> a new scheduler anyway.
sched-clean-init-idle.patch is still broken. Removing deactivate_task()
from init_idle() breaks the arches that instead of doing copy_process()
do kernel_thread(NULL, NULL, CLONE_IDLETASK), with all of the obvious
consequences of leaving a task with a NULL program counter on one queue
where it may be executed by accident and simultaneously executed on yet
another cpu via the SMP trampoline, even sharing the stack between cpus.
The following applies immediately after sched-clean-init-idle.patch;
I'm not convinced fork_by_hand() is worth the bloat, as a simple
deactivate_task() in init_idle(), would allow all the arches to use the
sparc64 method; however, this is consistent with the theme of the
cleanup patch immediately preceding it. If desired, I can implement the
other alternative, and teach all arches to use kernel_thread(...) and
reinstate the deactivate_task() in init_idle().
It appears that init_idle() and fork_by_hand() could be combined into
a single method that calls init_idle() on behalf of the caller, which
would amount to something like:
task_t * __init fork_idle(int cpu)
{
struct pt_regs regs;
task_t *task;
memset(®s, 0, sizeof(struct pt_regs));
task = copy_process(CLONE_VM|CLONE_IDLETASK, 0, ®s, 0, NULL, NULL);
if (!task)
return ERR_PTR(-ENOMEM);
init_idle(task, cpu);
unhash_process(task);
return task;
}
Then the call to init_idle() in init/main.c would be folded into
sched_init(), and so init_idle() would become private to kernel/sched.c
The following patch is merely what I used to get things working ASAP.
I'll create whatever form of the init_idle() consolidation's correction
is preferred against whatever tree is needed for merging.
-- wli
Index: mm1-2.6.8-rc3/arch/sparc/kernel/sun4m_smp.c
===================================================================
--- mm1-2.6.8-rc3.orig/arch/sparc/kernel/sun4m_smp.c
+++ mm1-2.6.8-rc3/arch/sparc/kernel/sun4m_smp.c
@@ -175,12 +175,9 @@
struct task_struct *p;
int timeout;
- /* Cook up an idler for this guy. */
- kernel_thread(start_secondary, NULL, CLONE_IDLETASK);
-
cpucount++;
- p = prev_task(&init_task);
+ p = fork_by_hand();
init_idle(p, i);
Index: mm1-2.6.8-rc3/arch/i386/kernel/smpboot.c
===================================================================
--- mm1-2.6.8-rc3.orig/arch/i386/kernel/smpboot.c
+++ mm1-2.6.8-rc3/arch/i386/kernel/smpboot.c
@@ -496,16 +496,6 @@
unsigned short ss;
} stack_start;
-static struct task_struct * __init fork_by_hand(void)
-{
- struct pt_regs regs;
- /*
- * don't care about the eip and regs settings since
- * we'll never reschedule the forked task.
- */
- return copy_process(CLONE_VM|CLONE_IDLETASK, 0, ®s, 0, NULL, NULL);
-}
-
#ifdef CONFIG_NUMA
/* which logical CPUs are on which nodes */
Index: mm1-2.6.8-rc3/include/linux/sched.h
===================================================================
--- mm1-2.6.8-rc3.orig/include/linux/sched.h
+++ mm1-2.6.8-rc3/include/linux/sched.h
@@ -885,7 +885,7 @@
extern int do_execve(char *, char __user * __user *, char __user * __user *, struct pt_regs *);
extern long do_fork(unsigned long, unsigned long, struct pt_regs *, unsigned long, int __user *, int __user *);
-extern struct task_struct * copy_process(unsigned long, unsigned long, struct pt_regs *, unsigned long, int __user *, int __user *);
+task_t *fork_by_hand(void);
#ifdef CONFIG_SMP
extern void wait_task_inactive(task_t * p);
Index: mm1-2.6.8-rc3/arch/sparc/kernel/sun4d_smp.c
===================================================================
--- mm1-2.6.8-rc3.orig/arch/sparc/kernel/sun4d_smp.c
+++ mm1-2.6.8-rc3/arch/sparc/kernel/sun4d_smp.c
@@ -204,12 +204,9 @@
int timeout;
int no;
- /* Cook up an idler for this guy. */
- kernel_thread(start_secondary, NULL, CLONE_IDLETASK);
-
cpucount++;
- p = prev_task(&init_task);
+ p = fork_by_hand();
init_idle(p, i);
Index: mm1-2.6.8-rc3/arch/ppc64/kernel/smp.c
===================================================================
--- mm1-2.6.8-rc3.orig/arch/ppc64/kernel/smp.c
+++ mm1-2.6.8-rc3/arch/ppc64/kernel/smp.c
@@ -799,14 +799,11 @@
static void __init smp_create_idle(unsigned int cpu)
{
- struct pt_regs regs;
struct task_struct *p;
/* create a process for the processor */
/* only regs.msr is actually used, and 0 is OK for it */
- memset(®s, 0, sizeof(struct pt_regs));
- p = copy_process(CLONE_VM | CLONE_IDLETASK,
- 0, ®s, 0, NULL, NULL);
+ p = fork_by_hand();
if (IS_ERR(p))
panic("failed fork for CPU %u: %li", cpu, PTR_ERR(p));
Index: mm1-2.6.8-rc3/arch/mips/kernel/smp.c
===================================================================
--- mm1-2.6.8-rc3.orig/arch/mips/kernel/smp.c
+++ mm1-2.6.8-rc3/arch/mips/kernel/smp.c
@@ -254,16 +254,6 @@
cpu_set(0, cpu_callin_map);
}
-static struct task_struct * __init fork_by_hand(void)
-{
- struct pt_regs regs;
- /*
- * don't care about the eip and regs settings since
- * we'll never reschedule the forked task.
- */
- return copy_process(CLONE_VM|CLONE_IDLETASK, 0, ®s, 0, NULL, NULL);
-}
-
/*
* Startup the CPU with this logical number
*/
Index: mm1-2.6.8-rc3/arch/s390/kernel/smp.c
===================================================================
--- mm1-2.6.8-rc3.orig/arch/s390/kernel/smp.c
+++ mm1-2.6.8-rc3/arch/s390/kernel/smp.c
@@ -562,15 +562,13 @@
static void __init smp_create_idle(unsigned int cpu)
{
- struct pt_regs regs;
struct task_struct *p;
/*
* don't care about the psw and regs settings since we'll never
* reschedule the forked task.
*/
- memset(®s, 0, sizeof(struct pt_regs));
- p = copy_process(CLONE_VM | CLONE_IDLETASK, 0, ®s, 0, NULL, NULL);
+ p = fork_by_hand();
if (IS_ERR(p))
panic("failed fork for CPU %u: %li", cpu, PTR_ERR(p));
Index: mm1-2.6.8-rc3/arch/ia64/kernel/smpboot.c
===================================================================
--- mm1-2.6.8-rc3.orig/arch/ia64/kernel/smpboot.c
+++ mm1-2.6.8-rc3/arch/ia64/kernel/smpboot.c
@@ -356,16 +356,6 @@
return cpu_idle();
}
-static struct task_struct * __devinit
-fork_by_hand (void)
-{
- /*
- * Don't care about the IP and regs settings since we'll never reschedule the
- * forked task.
- */
- return copy_process(CLONE_VM|CLONE_IDLETASK, 0, 0, 0, NULL, NULL);
-}
-
struct create_idle {
struct task_struct *idle;
struct completion done;
Index: mm1-2.6.8-rc3/arch/alpha/kernel/smp.c
===================================================================
--- mm1-2.6.8-rc3.orig/arch/alpha/kernel/smp.c
+++ mm1-2.6.8-rc3/arch/alpha/kernel/smp.c
@@ -411,15 +411,6 @@
return 0;
}
-static struct task_struct * __init
-fork_by_hand(void)
-{
- /* Don't care about the contents of regs since we'll never
- reschedule the forked task. */
- struct pt_regs regs;
- return copy_process(CLONE_VM|CLONE_IDLETASK, 0, ®s, 0, NULL, NULL);
-}
-
/*
* Bring one cpu online.
*/
Index: mm1-2.6.8-rc3/arch/ppc/kernel/smp.c
===================================================================
--- mm1-2.6.8-rc3.orig/arch/ppc/kernel/smp.c
+++ mm1-2.6.8-rc3/arch/ppc/kernel/smp.c
@@ -364,15 +364,13 @@
int __cpu_up(unsigned int cpu)
{
- struct pt_regs regs;
struct task_struct *p;
char buf[32];
int c;
/* create a process for the processor */
/* only regs.msr is actually used, and 0 is OK for it */
- memset(®s, 0, sizeof(struct pt_regs));
- p = copy_process(CLONE_VM|CLONE_IDLETASK, 0, ®s, 0, NULL, NULL);
+ p = fork_by_hand();
if (IS_ERR(p))
panic("failed fork for CPU %u: %li", cpu, PTR_ERR(p));
init_idle(p, cpu);
Index: mm1-2.6.8-rc3/arch/sparc64/kernel/smp.c
===================================================================
--- mm1-2.6.8-rc3.orig/arch/sparc64/kernel/smp.c
+++ mm1-2.6.8-rc3/arch/sparc64/kernel/smp.c
@@ -302,9 +302,7 @@
struct task_struct *p;
int timeout, ret, cpu_node;
- kernel_thread(NULL, NULL, CLONE_IDLETASK);
-
- p = prev_task(&init_task);
+ p = fork_by_hand();
init_idle(p, cpu);
Index: mm1-2.6.8-rc3/arch/x86_64/kernel/smpboot.c
===================================================================
--- mm1-2.6.8-rc3.orig/arch/x86_64/kernel/smpboot.c
+++ mm1-2.6.8-rc3/arch/x86_64/kernel/smpboot.c
@@ -392,16 +392,6 @@
extern volatile unsigned long init_rsp;
extern void (*initial_code)(void);
-static struct task_struct * __init fork_by_hand(void)
-{
- struct pt_regs regs;
- /*
- * don't care about the eip and regs settings since
- * we'll never reschedule the forked task.
- */
- return copy_process(CLONE_VM|CLONE_IDLETASK, 0, ®s, 0, NULL, NULL);
-}
-
#if APIC_DEBUG
static inline void inquire_remote_apic(int apicid)
{
Index: mm1-2.6.8-rc3/arch/i386/mach-voyager/voyager_smp.c
===================================================================
--- mm1-2.6.8-rc3.orig/arch/i386/mach-voyager/voyager_smp.c
+++ mm1-2.6.8-rc3/arch/i386/mach-voyager/voyager_smp.c
@@ -523,16 +523,6 @@
return cpu_idle();
}
-static struct task_struct * __init
-fork_by_hand(void)
-{
- struct pt_regs regs;
- /* don't care about the eip and regs settings since we'll
- * never reschedule the forked task. */
- return copy_process(CLONE_VM|CLONE_IDLETASK, 0, ®s, 0, NULL, NULL);
-}
-
-
/* Routine to kick start the given CPU and wait for it to report ready
* (or timeout in startup). When this routine returns, the requested
* CPU is either fully running and configured or known to be dead.
Index: mm1-2.6.8-rc3/kernel/fork.c
===================================================================
--- mm1-2.6.8-rc3.orig/kernel/fork.c
+++ mm1-2.6.8-rc3/kernel/fork.c
@@ -864,7 +864,7 @@
* parts of the process environment (as per the clone
* flags). The actual kick-off is left to the caller.
*/
-struct task_struct *copy_process(unsigned long clone_flags,
+static task_t *copy_process(unsigned long clone_flags,
unsigned long stack_start,
struct pt_regs *regs,
unsigned long stack_size,
@@ -1141,6 +1141,14 @@
goto fork_out;
}
+task_t * __init fork_by_hand(void)
+{
+ struct pt_regs regs;
+
+ memset(®s, 0, sizeof(struct pt_regs));
+ return copy_process(CLONE_VM|CLONE_IDLETASK, 0, ®s, 0, NULL, NULL);
+}
+
static inline int fork_traceflag (unsigned clone_flags)
{
if (clone_flags & (CLONE_UNTRACED | CLONE_IDLETASK))
Index: mm1-2.6.8-rc3/arch/parisc/kernel/smp.c
===================================================================
--- mm1-2.6.8-rc3.orig/arch/parisc/kernel/smp.c
+++ mm1-2.6.8-rc3/arch/parisc/kernel/smp.c
@@ -504,24 +504,6 @@
#if 0
/*
- * Create the idle task for a new Slave CPU. DO NOT use kernel_thread()
- * because that could end up calling schedule(). If it did, the new idle
- * task could get scheduled before we had a chance to remove it from the
- * run-queue...
- */
-static struct task_struct *fork_by_hand(void)
-{
- struct pt_regs regs;
-
- /*
- * don't care about the regs settings since
- * we'll never reschedule the forked task.
- */
- return copy_process(CLONE_VM|CLONE_IDLETASK, 0, ®s, 0, NULL, NULL);
-}
-
-
-/*
* Bring one cpu online.
*/
int __init smp_boot_one_cpu(int cpuid, int cpunum)
Index: mm1-2.6.8-rc3/arch/sh/kernel/smp.c
===================================================================
--- mm1-2.6.8-rc3.orig/arch/sh/kernel/smp.c
+++ mm1-2.6.8-rc3/arch/sh/kernel/smp.c
@@ -98,10 +98,8 @@
int __cpu_up(unsigned int cpu)
{
struct task_struct *tsk;
- struct pt_regs regs;
- memset(®s, 0, sizeof(struct pt_regs));
- tsk = copy_process(CLONE_VM | CLONE_IDLETASK, 0, ®s, 0, 0, 0);
+ tsk = fork_by_hand();
if (IS_ERR(tsk))
panic("Failed forking idle task for cpu %d\n", cpu);
next prev parent reply other threads:[~2004-08-06 3:35 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-08-05 10:19 2.6.8-rc3-mm1 Andrew Morton
2004-08-05 11:18 ` 2.6.8-rc3-mm1: SCHEDSTATS compile error Adrian Bunk
2004-08-05 15:25 ` Martin J. Bligh
2004-08-05 16:49 ` Adrian Bunk
2004-08-05 18:17 ` Rick Lindsley
2004-08-05 18:20 ` Adrian Bunk
2004-08-05 19:15 ` Rick Lindsley
2004-08-05 19:54 ` Luiz Fernando N. Capitulino
2004-08-05 20:20 ` Adrian Bunk
2004-08-09 19:46 ` Bill Davidsen
2004-08-09 19:51 ` Rick Lindsley
2004-08-05 11:20 ` 2.6.8-rc3-mm1 Sean Neakums
2004-08-05 11:49 ` 2.6.8-rc3-mm1: ALSA: vortex_asXtalkGainsAllChan multiple definitions Adrian Bunk
2004-08-05 12:38 ` 2.6.8-rc3-mm1: ip2mainc-add-missing-pci_enable_device breaks compilation Adrian Bunk
2004-08-05 15:45 ` Bjorn Helgaas
2004-08-05 12:50 ` 2.6.8-rc3-mm1 William Lee Irwin III
2004-08-05 13:03 ` 2.6.8-rc3-mm1 William Lee Irwin III
2004-08-05 21:38 ` 2.6.8-rc3-mm1 Andrew Morton
2004-08-06 15:25 ` 2.6.8-rc3-mm1 William Lee Irwin III
2004-08-05 13:24 ` 2.6.8-rc3-mm1 William Lee Irwin III
2004-08-05 13:36 ` 2.6.8-rc3-mm1 William Lee Irwin III
2004-08-05 16:13 ` 2.6.8-rc3-mm1 William Lee Irwin III
2004-08-05 16:42 ` 2.6.8-rc3-mm1 Christoph Hellwig
2004-08-05 20:24 ` 2.6.8-rc3-mm1 Alan Cox
2004-08-05 16:52 ` 2.6.8-rc3-mm1 (compile stats) John Cherry
2004-08-06 3:34 ` William Lee Irwin III [this message]
2004-08-06 4:24 ` 2.6.8-rc3-mm1 William Lee Irwin III
2004-08-06 4:39 ` 2.6.8-rc3-mm1 William Lee Irwin III
2004-08-06 5:17 ` 2.6.8-rc3-mm1 Andrew Morton
[not found] ` <20040806075219.GW17188@holomorphy.com>
2004-08-06 8:11 ` alpha signal race fixes William Lee Irwin III
2004-08-06 12:48 ` 2.6.8-rc3-mm1 Mark Watts
2004-08-06 19:58 ` 2.6.8-rc3-mm1: sk98lin/skge.c compile error with PROC_FS=n Adrian Bunk
2004-08-06 19:58 ` 2.6.8-rc3-mm1: PROC_FS=n link errors Adrian Bunk
2004-08-06 20:24 ` William Lee Irwin III
2004-08-06 20:33 ` William Lee Irwin III
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20040806033448.GP17188@holomorphy.com \
--to=wli@holomorphy.com \
--cc=akpm@osdl.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox