Make need_resched() take a "struct cpu_info *" argument. This

causes gives a primitive form of processor affinity.  Its use in
roundrobin() still needs some work.
This commit is contained in:
thorpej 2000-08-25 01:04:06 +00:00
parent 8358c07048
commit 4db6fc7542
31 changed files with 86 additions and 87 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: cpu.h,v 1.45 2000/08/21 02:03:12 thorpej Exp $ */ /* $NetBSD: cpu.h,v 1.46 2000/08/25 01:04:06 thorpej Exp $ */
/*- /*-
* Copyright (c) 1998, 1999, 2000 The NetBSD Foundation, Inc. * Copyright (c) 1998, 1999, 2000 The NetBSD Foundation, Inc.
@ -195,14 +195,11 @@ struct clockframe {
/* /*
* Preempt the current process if in interrupt from user mode, * Preempt the current process if in interrupt from user mode,
* or after the current trap/syscall if in system mode. * or after the current trap/syscall if in system mode.
*
* XXXSMP
* need_resched() needs to take a cpu_info *.
*/ */
#define need_resched() \ #define need_resched(ci) \
do { \ do { \
curcpu()->ci_want_resched = 1; \ (ci)->ci_want_resched = 1; \
aston(curcpu()); \ aston(ci); \
} while (/*CONSTCOND*/0) } while (/*CONSTCOND*/0)
/* /*

View File

@ -1,4 +1,4 @@
/* $NetBSD: cpu.h,v 1.49 2000/05/26 21:19:26 thorpej Exp $ */ /* $NetBSD: cpu.h,v 1.50 2000/08/25 01:04:06 thorpej Exp $ */
/* /*
* Copyright (c) 1988 University of Utah. * Copyright (c) 1988 University of Utah.
@ -110,7 +110,7 @@ struct clockframe {
* or after the current trap/syscall if in system mode. * or after the current trap/syscall if in system mode.
*/ */
extern int want_resched; /* resched() was called */ extern int want_resched; /* resched() was called */
#define need_resched() {want_resched = 1; setsoftast();} #define need_resched(ci) {want_resched = 1; setsoftast();}
/* /*
* Give a profiling tick to the current process from the softclock * Give a profiling tick to the current process from the softclock

View File

@ -44,7 +44,7 @@ extern void delay __P((unsigned));
extern __volatile int want_resched; extern __volatile int want_resched;
extern __volatile int astpending; extern __volatile int astpending;
#define need_resched() (want_resched = 1, astpending = 1) #define need_resched(ci) (want_resched = 1, astpending = 1)
#define need_proftick(p) ((p)->p_flag |= P_OWEUPC, astpending = 1) #define need_proftick(p) ((p)->p_flag |= P_OWEUPC, astpending = 1)
#define signotify(p) (astpending = 1) #define signotify(p) (astpending = 1)

View File

@ -1,4 +1,4 @@
/* $NetBSD: except.c,v 1.11 2000/08/22 21:22:50 bjh21 Exp $ */ /* $NetBSD: except.c,v 1.12 2000/08/25 01:04:07 thorpej Exp $ */
/*- /*-
* Copyright (c) 1998, 1999, 2000 Ben Harris * Copyright (c) 1998, 1999, 2000 Ben Harris
* All rights reserved. * All rights reserved.
@ -32,7 +32,7 @@
#include <sys/param.h> #include <sys/param.h>
__KERNEL_RCSID(0, "$NetBSD: except.c,v 1.11 2000/08/22 21:22:50 bjh21 Exp $"); __KERNEL_RCSID(0, "$NetBSD: except.c,v 1.12 2000/08/25 01:04:07 thorpej Exp $");
#include "opt_cputypes.h" #include "opt_cputypes.h"
#include "opt_ddb.h" #include "opt_ddb.h"
@ -708,7 +708,7 @@ setsoftast()
extern int want_resched; /* XXX */ extern int want_resched; /* XXX */
void void
need_resched(void) need_resched(struct cpu_info *ci)
{ {
want_resched = 1; want_resched = 1;
setsoftast(); setsoftast();

View File

@ -1,4 +1,4 @@
/* $NetBSD: intr.h,v 1.2 2000/08/22 21:27:22 bjh21 Exp $ */ /* $NetBSD: intr.h,v 1.3 2000/08/25 01:04:07 thorpej Exp $ */
/*- /*-
* Copyright (c) 1998, 2000 Ben Harris * Copyright (c) 1998, 2000 Ben Harris
* All rights reserved. * All rights reserved.
@ -107,7 +107,8 @@ extern int hardsplx(int);
#define signotify(p) setsoftast() #define signotify(p) setsoftast()
extern void setsoftast(void); extern void setsoftast(void);
extern void need_resched(void); struct cpu_info;
extern void need_resched(struct cpu_info *);
extern void need_proftick(struct proc *); extern void need_proftick(struct proc *);
/* /*

View File

@ -1,4 +1,4 @@
/* $NetBSD: intr.c,v 1.20 2000/07/02 04:40:35 cgd Exp $ */ /* $NetBSD: intr.c,v 1.21 2000/08/25 01:04:07 thorpej Exp $ */
/* /*
* Copyright (c) 1994-1998 Mark Brinicombe. * Copyright (c) 1994-1998 Mark Brinicombe.
@ -115,7 +115,7 @@ setsoftast()
extern int want_resched; extern int want_resched;
void void
need_resched(void) need_resched(struct cpu_info *ci)
{ {
want_resched = 1; want_resched = 1;
setsoftast(); setsoftast();

View File

@ -1,4 +1,4 @@
/* $NetBSD: cpu.h,v 1.21 2000/06/07 04:59:29 matt Exp $ */ /* $NetBSD: cpu.h,v 1.22 2000/08/25 01:04:07 thorpej Exp $ */
/* /*
* Copyright (c) 1994-1996 Mark Brinicombe. * Copyright (c) 1994-1996 Mark Brinicombe.
@ -254,7 +254,7 @@ extern struct cpu_info cpu_info_store;
extern int current_intr_depth; extern int current_intr_depth;
/* stubs.c */ /* stubs.c */
void need_resched __P((void)); void need_resched __P((struct cpu_info *));
void need_proftick __P((struct proc *p)); void need_proftick __P((struct proc *p));
/* locore.S */ /* locore.S */

View File

@ -1,4 +1,4 @@
/* $NetBSD: cpu.h,v 1.33 2000/05/26 21:19:34 thorpej Exp $ */ /* $NetBSD: cpu.h,v 1.34 2000/08/25 01:04:07 thorpej Exp $ */
/* /*
* Copyright (c) 1988 University of Utah. * Copyright (c) 1988 University of Utah.
@ -110,7 +110,7 @@ struct clockframe {
* Preempt the current process if in interrupt from user mode, * Preempt the current process if in interrupt from user mode,
* or after the current trap/syscall if in system mode. * or after the current trap/syscall if in system mode.
*/ */
#define need_resched() {want_resched = 1; setsoftast();} #define need_resched(ci) {want_resched = 1; setsoftast();}
/* /*
* Give a profiling tick to the current process from the softclock * Give a profiling tick to the current process from the softclock

View File

@ -1,4 +1,4 @@
/* $NetBSD: cpu.h,v 1.7 2000/05/26 21:19:36 thorpej Exp $ */ /* $NetBSD: cpu.h,v 1.8 2000/08/25 01:04:07 thorpej Exp $ */
/* /*
* Copyright (C) 1995-1997 Wolfgang Solfrank. * Copyright (C) 1995-1997 Wolfgang Solfrank.
@ -71,7 +71,7 @@ extern void delay __P((unsigned int));
extern volatile int want_resched; extern volatile int want_resched;
extern volatile int astpending; extern volatile int astpending;
#define need_resched() (want_resched = 1, astpending = 1) #define need_resched(ci) (want_resched = 1, astpending = 1)
#define need_proftick(p) ((p)->p_flag |= P_OWEUPC, astpending = 1) #define need_proftick(p) ((p)->p_flag |= P_OWEUPC, astpending = 1)
#define signotify(p) (astpending = 1) #define signotify(p) (astpending = 1)

View File

@ -1,4 +1,4 @@
/* $NetBSD: cpu.h,v 1.35 2000/05/27 21:46:42 he Exp $ */ /* $NetBSD: cpu.h,v 1.36 2000/08/25 01:04:07 thorpej Exp $ */
/* /*
* Copyright (c) 1988 University of Utah. * Copyright (c) 1988 University of Utah.
@ -114,7 +114,7 @@ struct clockframe {
* or after the current trap/syscall if in system mode. * or after the current trap/syscall if in system mode.
*/ */
extern int want_resched; /* resched() was called */ extern int want_resched; /* resched() was called */
#define need_resched() { want_resched++; aston(); } #define need_resched(ci) { want_resched++; aston(); }
/* /*
* Give a profiling tick to the current process when the user profiling * Give a profiling tick to the current process when the user profiling

View File

@ -1,4 +1,4 @@
/* $NetBSD: cpu.h,v 1.64 2000/06/04 21:27:38 mycroft Exp $ */ /* $NetBSD: cpu.h,v 1.65 2000/08/25 01:04:08 thorpej Exp $ */
/*- /*-
* Copyright (c) 1990 The Regents of the University of California. * Copyright (c) 1990 The Regents of the University of California.
@ -94,7 +94,7 @@ extern struct cpu_info cpu_info_store;
* or after the current trap/syscall if in system mode. * or after the current trap/syscall if in system mode.
*/ */
int want_resched; /* resched() was called */ int want_resched; /* resched() was called */
#define need_resched() (want_resched = 1, setsoftast()) #define need_resched(ci) (want_resched = 1, setsoftast())
/* /*
* Give a profiling tick to the current process when the user profiling * Give a profiling tick to the current process when the user profiling

View File

@ -1,4 +1,4 @@
/* $NetBSD: cpu.h,v 1.2 2000/05/26 21:19:48 thorpej Exp $ */ /* $NetBSD: cpu.h,v 1.3 2000/08/25 01:04:08 thorpej Exp $ */
/* /*
* Copyright (c) 1988 University of Utah. * Copyright (c) 1988 University of Utah.
@ -105,7 +105,7 @@ struct clockframe {
* Preempt the current process if in interrupt from user mode, * Preempt the current process if in interrupt from user mode,
* or after the current trap/syscall if in system mode. * or after the current trap/syscall if in system mode.
*/ */
#define need_resched() { want_resched = 1; aston(); } #define need_resched(ci) { want_resched = 1; aston(); }
/* /*
* Give a profiling tick to the current process when the user profiling * Give a profiling tick to the current process when the user profiling

View File

@ -1,4 +1,4 @@
/* $NetBSD: cpu.h,v 1.64 2000/05/26 21:19:50 thorpej Exp $ */ /* $NetBSD: cpu.h,v 1.65 2000/08/25 01:04:08 thorpej Exp $ */
/* /*
* Copyright (c) 1988 University of Utah. * Copyright (c) 1988 University of Utah.
@ -127,7 +127,7 @@ struct clockframe {
* or after the current trap/syscall if in system mode. * or after the current trap/syscall if in system mode.
*/ */
extern int want_resched; /* resched() was called */ extern int want_resched; /* resched() was called */
#define need_resched() { want_resched++; aston(); } #define need_resched(ci) { want_resched++; aston(); }
/* /*
* Give a profiling tick to the current process from the softclock * Give a profiling tick to the current process from the softclock

View File

@ -1,4 +1,4 @@
/* $NetBSD: cpu.h,v 1.43 2000/07/13 07:37:11 jeffs Exp $ */ /* $NetBSD: cpu.h,v 1.44 2000/08/25 01:04:08 thorpej Exp $ */
/*- /*-
* Copyright (c) 1992, 1993 * Copyright (c) 1992, 1993
@ -150,7 +150,7 @@ struct clockframe {
* Preempt the current process if in interrupt from user mode, * Preempt the current process if in interrupt from user mode,
* or after the current trap/syscall if in system mode. * or after the current trap/syscall if in system mode.
*/ */
#define need_resched() { want_resched = 1; aston(); } #define need_resched(ci) { want_resched = 1; aston(); }
/* /*
* Give a profiling tick to the current process when the user profiling * Give a profiling tick to the current process when the user profiling

View File

@ -1,4 +1,4 @@
/* $NetBSD: cpu.h,v 1.17 2000/07/24 11:20:47 scw Exp $ */ /* $NetBSD: cpu.h,v 1.18 2000/08/25 01:04:08 thorpej Exp $ */
/* /*
* Copyright (c) 1988 University of Utah. * Copyright (c) 1988 University of Utah.
@ -110,7 +110,7 @@ struct clockframe {
* or after the current trap/syscall if in system mode. * or after the current trap/syscall if in system mode.
*/ */
extern int want_resched; /* resched() was called */ extern int want_resched; /* resched() was called */
#define need_resched() { want_resched++; aston(); } #define need_resched(ci) { want_resched++; aston(); }
/* /*
* Give a profiling tick to the current process when the user profiling * Give a profiling tick to the current process when the user profiling

View File

@ -1,4 +1,4 @@
/* $NetBSD: cpu.h,v 1.4 2000/05/26 21:20:00 thorpej Exp $ */ /* $NetBSD: cpu.h,v 1.5 2000/08/25 01:04:08 thorpej Exp $ */
/* /*
* Copyright (c) 1988 University of Utah. * Copyright (c) 1988 University of Utah.
@ -130,7 +130,7 @@ struct clockframe {
* or after the current trap/syscall if in system mode. * or after the current trap/syscall if in system mode.
*/ */
extern int want_resched; /* resched() was called */ extern int want_resched; /* resched() was called */
#define need_resched() do { want_resched++; aston(); } while(0) #define need_resched(ci) do { want_resched++; aston(); } while(0)
/* /*
* Give a profiling tick to the current process when the user profiling * Give a profiling tick to the current process when the user profiling

View File

@ -1,4 +1,4 @@
/* $NetBSD: bitmapif.c,v 1.3 1999/02/15 04:36:33 hubertf Exp $ */ /* $NetBSD: bitmapif.c,v 1.4 2000/08/25 01:04:09 thorpej Exp $ */
/* /*
* Copyright (c) 1992, 1993 * Copyright (c) 1992, 1993
* The Regents of the University of California. All rights reserved. * The Regents of the University of California. All rights reserved.
@ -68,9 +68,12 @@ extern SCREEN screen;
extern int bitmap_use; extern int bitmap_use;
#endif #endif
/*
* XXX SHOULD USE yield()
*/
#ifdef CPU_SINGLE #ifdef CPU_SINGLE
#include <machine/cpu.h> #include <machine/cpu.h>
#define PRE_EMPT need_resched() #define PRE_EMPT need_resched(curcpu())
#else #else
#define PRE_EMPT #define PRE_EMPT
#endif #endif

View File

@ -1,4 +1,4 @@
/* $NetBSD: fb_start.c,v 1.5 2000/05/27 04:52:30 thorpej Exp $ */ /* $NetBSD: fb_start.c,v 1.6 2000/08/25 01:04:10 thorpej Exp $ */
/* /*
* Copyright (c) 1992, 1993 * Copyright (c) 1992, 1993
* The Regents of the University of California. All rights reserved. * The Regents of the University of California. All rights reserved.
@ -49,11 +49,14 @@
#include <newsmips/dev/fbdefs.h> #include <newsmips/dev/fbdefs.h>
#define spl7 splhigh #define spl7 splhigh
/*
* XXX SHOULD USE yield().
*/
#ifdef CPU_SINGLE #ifdef CPU_SINGLE
#include <machine/cpu.h> #include <machine/cpu.h>
extern struct tty cons; extern struct tty cons;
extern int cnstart(); extern int cnstart();
#define PRE_EMPT need_resched() #define PRE_EMPT need_resched(curcpu())
#endif #endif
extern void mem_to_mem(); extern void mem_to_mem();

View File

@ -1,4 +1,4 @@
/* $NetBSD: vt100if.c,v 1.3 1999/02/15 04:36:35 hubertf Exp $ */ /* $NetBSD: vt100if.c,v 1.4 2000/08/25 01:04:10 thorpej Exp $ */
/* /*
* Copyright (c) 1992, 1993 * Copyright (c) 1992, 1993
* The Regents of the University of California. All rights reserved. * The Regents of the University of California. All rights reserved.
@ -79,9 +79,12 @@ extern int *gcpu_semadr;
#include <machine/keyboard.h> #include <machine/keyboard.h>
/*
* XXX SHOULD USE yield().
*/
#ifdef CPU_SINGLE #ifdef CPU_SINGLE
#include <machine/cpu.h> #include <machine/cpu.h>
#define PRE_EMPT need_resched() #define PRE_EMPT need_resched(curcpu())
#endif #endif
extern int kbd_read(); extern int kbd_read();

View File

@ -1,4 +1,4 @@
/* $NetBSD: cpu.h,v 1.12 2000/05/26 21:20:03 thorpej Exp $ */ /* $NetBSD: cpu.h,v 1.13 2000/08/25 01:04:10 thorpej Exp $ */
/* /*
* Copyright (c) 1988 University of Utah. * Copyright (c) 1988 University of Utah.
@ -115,8 +115,8 @@ struct clockframe {
* Preempt the current process if in interrupt from user mode, * Preempt the current process if in interrupt from user mode,
* or after the current trap/syscall if in system mode. * or after the current trap/syscall if in system mode.
*/ */
extern int want_resched; /* resched() was called */ extern int want_resched; /* resched() was called */
#define need_resched() { want_resched = 1; aston(); } #define need_resched(ci) { want_resched = 1; aston(); }
/* /*
* Give a profiling tick to the current process when the user profiling * Give a profiling tick to the current process when the user profiling

View File

@ -1,4 +1,4 @@
/* $NetBSD: cpu.h,v 1.9 2000/08/22 19:46:30 thorpej Exp $ */ /* $NetBSD: cpu.h,v 1.10 2000/08/25 01:04:10 thorpej Exp $ */
/* /*
* Copyright (C) 1995-1997 Wolfgang Solfrank. * Copyright (C) 1995-1997 Wolfgang Solfrank.
@ -112,7 +112,7 @@ extern void delay __P((unsigned));
extern __volatile int want_resched; extern __volatile int want_resched;
extern __volatile int astpending; extern __volatile int astpending;
#define need_resched() (want_resched = 1, astpending = 1) #define need_resched(ci) (want_resched = 1, astpending = 1)
#define need_proftick(p) ((p)->p_flag |= P_OWEUPC, astpending = 1) #define need_proftick(p) ((p)->p_flag |= P_OWEUPC, astpending = 1)
#define signotify(p) (astpending = 1) #define signotify(p) (astpending = 1)

View File

@ -1,4 +1,4 @@
/* $NetBSD: cpu.h,v 1.30 2000/05/26 21:20:06 thorpej Exp $ */ /* $NetBSD: cpu.h,v 1.31 2000/08/25 01:04:10 thorpej Exp $ */
/*- /*-
* Copyright (c) 1990 The Regents of the University of California. * Copyright (c) 1990 The Regents of the University of California.
@ -94,8 +94,8 @@ extern struct cpu_info cpu_info_store;
* Preempt the current process if in interrupt from user mode, * Preempt the current process if in interrupt from user mode,
* or after the current trap/syscall if in system mode. * or after the current trap/syscall if in system mode.
*/ */
int want_resched; /* resched() was called */ int want_resched; /* resched() was called */
#define need_resched() (want_resched = 1, setsoftast()) #define need_resched(ci) (want_resched = 1, setsoftast())
/* /*
* Give a profiling tick to the current process from the softclock * Give a profiling tick to the current process from the softclock

View File

@ -1,4 +1,4 @@
/* $NetBSD: cpu.h,v 1.2 2000/05/26 21:20:13 thorpej Exp $ */ /* $NetBSD: cpu.h,v 1.3 2000/08/25 01:04:10 thorpej Exp $ */
/* /*
* Copyright (C) 1995-1997 Wolfgang Solfrank. * Copyright (C) 1995-1997 Wolfgang Solfrank.
@ -71,7 +71,7 @@ extern void delay __P((unsigned int));
extern volatile int want_resched; extern volatile int want_resched;
extern volatile int astpending; extern volatile int astpending;
#define need_resched() (want_resched = 1, astpending = 1) #define need_resched(ci) (want_resched = 1, astpending = 1)
#define need_proftick(p) ((p)->p_flag |= P_OWEUPC, astpending = 1) #define need_proftick(p) ((p)->p_flag |= P_OWEUPC, astpending = 1)
#define signotify(p) (astpending = 1) #define signotify(p) (astpending = 1)

View File

@ -1,4 +1,4 @@
/* $NetBSD: cpu.h,v 1.9 2000/06/07 11:23:17 tsubai Exp $ */ /* $NetBSD: cpu.h,v 1.10 2000/08/25 01:04:10 thorpej Exp $ */
/*- /*-
* Copyright (c) 1990 The Regents of the University of California. * Copyright (c) 1990 The Regents of the University of California.
@ -109,7 +109,7 @@ extern struct cpu_info cpu_info_store;
* or after the current trap/syscall if in system mode. * or after the current trap/syscall if in system mode.
*/ */
int want_resched; /* resched() was called */ int want_resched; /* resched() was called */
#define need_resched() (want_resched = 1, setsoftast()) #define need_resched(ci) (want_resched = 1, setsoftast())
/* /*
* Give a profiling tick to the current process when the user profiling * Give a profiling tick to the current process when the user profiling

View File

@ -1,4 +1,4 @@
/* $NetBSD: cpu.h,v 1.40 2000/06/05 20:47:47 thorpej Exp $ */ /* $NetBSD: cpu.h,v 1.41 2000/08/25 01:04:11 thorpej Exp $ */
/* /*
* Copyright (c) 1992, 1993 * Copyright (c) 1992, 1993
@ -151,7 +151,7 @@ extern int want_ast;
* or after the current trap/syscall if in system mode. * or after the current trap/syscall if in system mode.
*/ */
extern int want_resched; /* resched() was called */ extern int want_resched; /* resched() was called */
#define need_resched() (want_resched = 1, want_ast = 1) #define need_resched(ci) (want_resched = 1, want_ast = 1)
/* /*
* Give a profiling tick to the current process when the user profiling * Give a profiling tick to the current process when the user profiling

View File

@ -1,4 +1,4 @@
/* $NetBSD: cpu.h,v 1.23 2000/07/03 17:56:06 eeh Exp $ */ /* $NetBSD: cpu.h,v 1.24 2000/08/25 01:04:11 thorpej Exp $ */
/* /*
* Copyright (c) 1992, 1993 * Copyright (c) 1992, 1993
@ -184,7 +184,7 @@ int want_ast;
* or after the current trap/syscall if in system mode. * or after the current trap/syscall if in system mode.
*/ */
int want_resched; /* resched() was called */ int want_resched; /* resched() was called */
#define need_resched() (want_resched = 1, want_ast = 1) #define need_resched(ci) (want_resched = 1, want_ast = 1)
/* /*
* Give a profiling tick to the current process when the user profiling * Give a profiling tick to the current process when the user profiling

View File

@ -1,4 +1,4 @@
/* $NetBSD: cpu.h,v 1.24 2000/05/26 21:20:23 thorpej Exp $ */ /* $NetBSD: cpu.h,v 1.25 2000/08/25 01:04:11 thorpej Exp $ */
/* /*
* Copyright (c) 1994 Gordon W. Ross * Copyright (c) 1994 Gordon W. Ross
@ -115,8 +115,8 @@ extern int astpending; /* need to trap before returning to user mode */
* Preempt the current process if in interrupt from user mode, * Preempt the current process if in interrupt from user mode,
* or after the current trap/syscall if in system mode. * or after the current trap/syscall if in system mode.
*/ */
extern int want_resched; /* resched() was called */ extern int want_resched; /* resched() was called */
#define need_resched() { want_resched = 1; aston(); } #define need_resched(ci) { want_resched = 1; aston(); }
/* /*
* Give a profiling tick to the current process when the user profiling * Give a profiling tick to the current process when the user profiling

View File

@ -1,4 +1,4 @@
/* $NetBSD: cpu.h,v 1.53 2000/07/26 11:55:01 ragge Exp $ */ /* $NetBSD: cpu.h,v 1.54 2000/08/25 01:04:11 thorpej Exp $ */
/* /*
* Copyright (c) 1994 Ludd, University of Lule}, Sweden * Copyright (c) 1994 Ludd, University of Lule}, Sweden
@ -121,7 +121,7 @@ struct cpu_info {
#define curcpu() ((struct cpu_info *)mfpr(PR_SSP)) #define curcpu() ((struct cpu_info *)mfpr(PR_SSP))
#define curproc (curcpu()->ci_curproc) #define curproc (curcpu()->ci_curproc)
#define cpu_number() (curcpu()->ci_dev->dv_unit) #define cpu_number() (curcpu()->ci_dev->dv_unit)
#define need_resched() {curcpu()->ci_want_resched++; mtpr(AST_OK,PR_ASTLVL); } #define need_resched(ci) {(ci)->ci_want_resched++; mtpr(AST_OK,PR_ASTLVL); }
#if defined(MULTIPROCESSOR) #if defined(MULTIPROCESSOR)
#define CPU_IS_PRIMARY(ci) (ci->ci_flags & CI_MASTERCPU) #define CPU_IS_PRIMARY(ci) (ci->ci_flags & CI_MASTERCPU)

View File

@ -1,4 +1,4 @@
/* $NetBSD: cpu.h,v 1.23 2000/05/26 21:20:27 thorpej Exp $ */ /* $NetBSD: cpu.h,v 1.24 2000/08/25 01:04:11 thorpej Exp $ */
/* /*
* Copyright (c) 1988 University of Utah. * Copyright (c) 1988 University of Utah.
@ -117,7 +117,7 @@ struct clockframe {
* or after the current trap/syscall if in system mode. * or after the current trap/syscall if in system mode.
*/ */
extern int want_resched; /* resched() was called */ extern int want_resched; /* resched() was called */
#define need_resched() { want_resched++; aston(); } #define need_resched(ci) { want_resched++; aston(); }
/* /*
* Give a profiling tick to the current process when the user profiling * Give a profiling tick to the current process when the user profiling

View File

@ -1,4 +1,4 @@
/* $NetBSD: linux_sched.c,v 1.6 2000/05/28 05:49:05 thorpej Exp $ */ /* $NetBSD: linux_sched.c,v 1.7 2000/08/25 01:04:12 thorpej Exp $ */
/*- /*-
* Copyright (c) 1999 The NetBSD Foundation, Inc. * Copyright (c) 1999 The NetBSD Foundation, Inc.
@ -274,7 +274,7 @@ linux_sys_sched_yield(cp, v, retval)
void *v; void *v;
register_t *retval; register_t *retval;
{ {
need_resched(); need_resched(curcpu());
return 0; return 0;
} }

View File

@ -1,4 +1,4 @@
/* $NetBSD: kern_synch.c,v 1.86 2000/08/24 06:14:34 thorpej Exp $ */ /* $NetBSD: kern_synch.c,v 1.87 2000/08/25 01:04:12 thorpej Exp $ */
/*- /*-
* Copyright (c) 1999, 2000 The NetBSD Foundation, Inc. * Copyright (c) 1999, 2000 The NetBSD Foundation, Inc.
@ -148,7 +148,7 @@ roundrobin(void *arg)
splx(s); splx(s);
} }
/* XXXSMP: should need_resched() on all CPUs */ /* XXXSMP: should need_resched() on all CPUs */
need_resched(); need_resched(curcpu());
callout_reset(&roundrobin_ch, hz / 10, roundrobin, NULL); callout_reset(&roundrobin_ch, hz / 10, roundrobin, NULL);
} }
@ -615,7 +615,8 @@ awaken(struct proc *p)
*/ */
if (p->p_flag & P_INMEM) { if (p->p_flag & P_INMEM) {
setrunqueue(p); setrunqueue(p);
need_resched(); KASSERT(p->p_cpu != NULL);
need_resched(p->p_cpu);
} else } else
sched_wakeup(&proc0); sched_wakeup(&proc0);
} }
@ -976,22 +977,13 @@ setrunnable(struct proc *p)
else if (p->p_priority < curcpu()->ci_schedstate.spc_curpriority) { else if (p->p_priority < curcpu()->ci_schedstate.spc_curpriority) {
/* /*
* XXXSMP * XXXSMP
* This is wrong. It will work, but what really * This is not exactly right. Since p->p_cpu persists
* needs to happen is: * across a context switch, this gives us some sort
* * of processor affinity. But we need to figure out
* - Need to check if p is higher priority * at what point it's better to reschedule on a different
* than the process currently running on * CPU than the last one.
* the CPU p last ran on (let p_cpu persist
* after a context switch?), and preempt
* that one (or, if there is no process
* there, simply need_resched() that CPU.
*
* - Failing that, traverse a list of
* available CPUs and need_resched() the
* CPU with the lowest priority that's
* lower than p's.
*/ */
need_resched(); need_resched((p->p_cpu != NULL) ? p->p_cpu : curcpu());
} }
} }
@ -1015,7 +1007,7 @@ resetpriority(struct proc *p)
* XXXSMP * XXXSMP
* Same applies as in setrunnable() above. * Same applies as in setrunnable() above.
*/ */
need_resched(); need_resched((p->p_cpu != NULL) ? p->p_cpu : curcpu());
} }
} }