Skip to contentSkip to conversation

Remove CONFIG_SMP around wait_task_inactive()

PATCH David Gibson 1 participant 1 message Sep 16, 2002

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

Linus, please apply. This defines wait_task_inactive() to be a no-op on UP machines, and removes the #ifdef CONFIG_SMP which surrounds current calls.

This also fixes compile on UP which was broken by the addition of a call to wait_task_inactive in fs/exec.c which was not protected by an #ifdef.

The patch is against 2.5.34

arch/ia64/kernel/perfmon.c renamed from home/dgibson/kernel/linuxppc-2.5/arch/ia64/kernel/perfmon.c +4 -7
diff -urN /home/dgibson/kernel/linuxppc-2.5/arch/ia64/kernel/perfmon.c linux-bluefish/arch/ia64/kernel/perfmon.c
@@ -2345,22 +2345,19 @@
 check_task_state(struct task_struct *task)
 {
 	int ret = 0;
-#ifdef CONFIG_SMP
+
 	/* We must wait until the state has been completely
 	 * saved. There can be situations where the reader arrives before
 	 * after the task is marked as STOPPED but before pfm_save_regs()
 	 * is completed.
 	 */
-	if (task->state != TASK_ZOMBIE && task->state != TASK_STOPPED) return -EBUSY;
-	DBprintk(("before wait_task_inactive [%d] state %ld\n", task->pid, task->state));
-	wait_task_inactive(task);
-	DBprintk(("after wait_task_inactive [%d] state %ld\n", task->pid, task->state));
-#else
 	if (task->state != TASK_ZOMBIE && task->state != TASK_STOPPED) {
 		DBprintk(("warning [%d] not in stable state %ld\n", task->pid, task->state));
 		ret = -EBUSY;
 	}
-#endif
+	DBprintk(("before wait_task_inactive [%d] state %ld\n", task->pid, task->state));
+	wait_task_inactive(task);
+	DBprintk(("after wait_task_inactive [%d] state %ld\n", task->pid, task->state));
 	return ret;
 }
 
include/linux/sched.h renamed from home/dgibson/kernel/linuxppc-2.5/include/linux/sched.h +4 -0
diff -urN /home/dgibson/kernel/linuxppc-2.5/include/linux/sched.h linux-bluefish/include/linux/sched.h
@@ -690,7 +690,11 @@
 extern void FASTCALL(add_wait_queue_exclusive(wait_queue_head_t *q, wait_queue_t * wait));
 extern void FASTCALL(remove_wait_queue(wait_queue_head_t *q, wait_queue_t * wait));
 
+#ifdef CONFIG_SMP
 extern void wait_task_inactive(task_t * p);
+#else
+#define wait_task_inactive(p)	do { } while (0)
+#endif
 extern void kick_if_running(task_t * p);
 
 #define __wait_event(wq, condition) 					\
kernel/exit.c renamed from home/dgibson/kernel/linuxppc-2.5/kernel/exit.c +0 -2
diff -urN /home/dgibson/kernel/linuxppc-2.5/kernel/exit.c linux-bluefish/kernel/exit.c
@@ -55,10 +55,8 @@
 
 	if (p->state != TASK_ZOMBIE)
 		BUG();
-#ifdef CONFIG_SMP
 	if (p != current)
 		wait_task_inactive(p);
-#endif
 	atomic_dec(&p->user->processes);
 	security_ops->task_free_security(p);
 	free_uid(p->user);
kernel/ptrace.c renamed from home/dgibson/kernel/linuxppc-2.5/kernel/ptrace.c +0 -2
diff -urN /home/dgibson/kernel/linuxppc-2.5/kernel/ptrace.c linux-bluefish/kernel/ptrace.c
@@ -69,9 +69,7 @@
 	if (!kill) {
 		if (child->state != TASK_STOPPED)
 			return -ESRCH;
-#ifdef CONFIG_SMP
 		wait_task_inactive(child);
-#endif		
 	}
 
 	/* All systems go.. */
Signature · 4 lines
David Gibson			| For every complex problem there is a
[email protected]	| solution which is simple, neat and
				| wrong.
http://www.ozlabs.org/people/dgibson