Patch from "Martin J. Bligh" I've had it with kgdb remaning schedule to do_schedule, even when it's disabled ... makes it hard to merge other scheduler diag patches, and harder to compare profiles. It also seems to introduce an extra call into the schedule call path (even when disabled). Grrr. Patch below fixes it ... booted without kgdb, and with kgdb+threads. Would be nice if you'd merge it into your kgdb patch so we can sync up .... Nearly all the bits I'm fiddling with are the same as the original patch was changing, so it shouldn't make it bigger or harder to maintain. arch/i386/kernel/entry.S | 4 ++++ arch/ppc64/kernel/entry.S | 2 +- arch/sparc64/kernel/rtrap.S | 4 ++++ arch/x86_64/kernel/entry.S | 4 ++++ include/linux/sched.h | 12 ++++++++---- kernel/ksyms.c | 4 +++- kernel/sched.c | 8 +++++--- 7 files changed, 29 insertions(+), 9 deletions(-) diff -puN arch/i386/kernel/entry.S~kgdb-cleanup arch/i386/kernel/entry.S --- 25/arch/i386/kernel/entry.S~kgdb-cleanup 2003-03-16 22:20:55.000000000 -0800 +++ 25-akpm/arch/i386/kernel/entry.S 2003-03-16 22:20:55.000000000 -0800 @@ -49,6 +49,10 @@ #include #include "irq_vectors.h" +#ifndef CONFIG_KGDB_THREAD +#define user_schedule schedule +#endif + EBX = 0x00 ECX = 0x04 EDX = 0x08 diff -puN arch/sparc64/kernel/rtrap.S~kgdb-cleanup arch/sparc64/kernel/rtrap.S --- 25/arch/sparc64/kernel/rtrap.S~kgdb-cleanup 2003-03-16 22:20:55.000000000 -0800 +++ 25-akpm/arch/sparc64/kernel/rtrap.S 2003-03-16 22:20:55.000000000 -0800 @@ -15,6 +15,10 @@ #include #include +#ifndef CONFIG_KGDB_THREAD +#define user_schedule schedule +#endif + #define RTRAP_PSTATE (PSTATE_RMO|PSTATE_PEF|PSTATE_PRIV|PSTATE_IE) #define RTRAP_PSTATE_IRQOFF (PSTATE_RMO|PSTATE_PEF|PSTATE_PRIV) #define RTRAP_PSTATE_AG_IRQOFF (PSTATE_RMO|PSTATE_PEF|PSTATE_PRIV|PSTATE_AG) diff -puN arch/x86_64/kernel/entry.S~kgdb-cleanup arch/x86_64/kernel/entry.S --- 25/arch/x86_64/kernel/entry.S~kgdb-cleanup 2003-03-16 22:20:55.000000000 -0800 +++ 25-akpm/arch/x86_64/kernel/entry.S 2003-03-16 22:20:55.000000000 -0800 @@ -46,6 +46,10 @@ #define PDAREF(field) %gs:field +#ifndef CONFIG_KGDB_THREAD +#define user_schedule schedule +#endif + #ifdef CONFIG_PREEMPT #define preempt_stop cli #else diff -puN include/linux/sched.h~kgdb-cleanup include/linux/sched.h --- 25/include/linux/sched.h~kgdb-cleanup 2003-03-16 22:20:55.000000000 -0800 +++ 25-akpm/include/linux/sched.h 2003-03-16 22:20:55.000000000 -0800 @@ -166,9 +166,13 @@ extern unsigned long cache_decay_ticks; #define MAX_SCHEDULE_TIMEOUT LONG_MAX extern signed long FASTCALL(schedule_timeout(signed long timeout)); -asmlinkage void do_schedule(void); -asmlinkage void kern_schedule(void); -asmlinkage void kern_do_schedule(struct pt_regs); +#ifdef CONFIG_KGDB_THREAD + asmlinkage void do_schedule(void); + asmlinkage void kern_schedule(void); + asmlinkage void kern_do_schedule(struct pt_regs); +#else + asmlinkage void schedule(void); +#endif struct namespace; @@ -685,7 +689,7 @@ extern void unhash_process(struct task_s #ifdef CONFIG_KGDB_THREAD #define schedule() kern_schedule() #else -#define schedule() do_schedule() +#define user_schedule() schedule() #endif /* Protects ->fs, ->files, ->mm, and synchronises with wait4(). Nests inside tasklist_lock */ diff -puN kernel/ksyms.c~kgdb-cleanup kernel/ksyms.c --- 25/kernel/ksyms.c~kgdb-cleanup 2003-03-16 22:20:55.000000000 -0800 +++ 25-akpm/kernel/ksyms.c 2003-03-16 22:20:55.000000000 -0800 @@ -465,9 +465,11 @@ EXPORT_SYMBOL(sleep_on); EXPORT_SYMBOL(sleep_on_timeout); EXPORT_SYMBOL(interruptible_sleep_on); EXPORT_SYMBOL(interruptible_sleep_on_timeout); -EXPORT_SYMBOL(do_schedule); #ifdef CONFIG_KGDB_THREAD EXPORT_SYMBOL(kern_schedule); +EXPORT_SYMBOL(do_schedule); +#else +EXPORT_SYMBOL(schedule); #endif #ifdef CONFIG_PREEMPT EXPORT_SYMBOL(preempt_schedule); diff -puN kernel/sched.c~kgdb-cleanup kernel/sched.c --- 25/kernel/sched.c~kgdb-cleanup 2003-03-16 22:20:55.000000000 -0800 +++ 25-akpm/kernel/sched.c 2003-03-16 22:20:55.000000000 -0800 @@ -1270,7 +1270,11 @@ void scheduling_functions_start_here(voi /* * schedule() is the main scheduler function. */ +#ifdef CONFIG_KGDB_THREAD asmlinkage void do_schedule(void) +#else +asmlinkage void schedule(void) +#endif { task_t *prev, *next; runqueue_t *rq; @@ -1504,15 +1508,13 @@ void complete_all(struct completion *x) spin_unlock_irqrestore(&x->wait.lock, flags); } +#ifdef CONFIG_KGDB_THREAD asmlinkage void user_schedule(void) { -#ifdef CONFIG_KGDB_THREAD current->thread.kgdbregs = NULL; -#endif do_schedule(); } -#ifdef CONFIG_KGDB_THREAD asmlinkage void kern_do_schedule(struct pt_regs regs) { current->thread.kgdbregs = ®s; diff -puN arch/ppc64/kernel/entry.S~kgdb-cleanup arch/ppc64/kernel/entry.S --- 25/arch/ppc64/kernel/entry.S~kgdb-cleanup 2003-03-16 22:20:55.000000000 -0800 +++ 25-akpm/arch/ppc64/kernel/entry.S 2003-03-16 22:20:55.000000000 -0800 @@ -427,7 +427,7 @@ do_work: andi. r0,r3,_TIF_NEED_RESCHED beq 1f - bl .do_schedule + bl .schedule b recheck 1: andi. r0,r3,_TIF_SIGPENDING _