patch-2.1.35 linux/include/linux/sched.h
Next file: linux/include/linux/sunrpc/clnt.h
Previous file: linux/include/linux/linkage.h
Back to the patch index
Back to the overall index
- Lines: 50
- Date:
Tue Apr 15 16:24:17 1997
- Orig file:
v2.1.34/linux/include/linux/sched.h
- Orig date:
Thu Mar 27 14:40:11 1997
diff -u --recursive --new-file v2.1.34/linux/include/linux/sched.h linux/include/linux/sched.h
@@ -104,6 +104,17 @@
#ifdef __KERNEL__
+#include <asm/spinlock.h>
+
+/*
+ * This serializes "schedule()" and also protects
+ * the run-queue from deletions/modifications (but
+ * _adding_ to the beginning of the run-queue has
+ * a separate lock).
+ */
+extern spinlock_t scheduler_lock;
+extern spinlock_t tasklist_lock;
+
extern void sched_init(void);
extern void show_state(void);
extern void trap_init(void);
@@ -460,11 +471,11 @@
p->nr++;
}
-#define REMOVE_LINKS(p) do { unsigned long flags; \
- save_flags(flags) ; cli(); \
+#define REMOVE_LINKS(p) do { \
+ spin_lock(&tasklist_lock); \
(p)->next_task->prev_task = (p)->prev_task; \
(p)->prev_task->next_task = (p)->next_task; \
- restore_flags(flags); \
+ spin_unlock(&tasklist_lock); \
if ((p)->p_osptr) \
(p)->p_osptr->p_ysptr = (p)->p_ysptr; \
if ((p)->p_ysptr) \
@@ -473,13 +484,13 @@
(p)->p_pptr->p_cptr = (p)->p_osptr; \
} while (0)
-#define SET_LINKS(p) do { unsigned long flags; \
- save_flags(flags); cli(); \
+#define SET_LINKS(p) do { \
+ spin_lock(&tasklist_lock); \
(p)->next_task = &init_task; \
(p)->prev_task = init_task.prev_task; \
init_task.prev_task->next_task = (p); \
init_task.prev_task = (p); \
- restore_flags(flags); \
+ spin_unlock(&tasklist_lock); \
(p)->p_ysptr = NULL; \
if (((p)->p_osptr = (p)->p_pptr->p_cptr) != NULL) \
(p)->p_osptr->p_ysptr = p; \
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov