patch-2.4.0-test6 linux/kernel/exit.c

Next file: linux/kernel/fork.c
Previous file: linux/kernel/Makefile
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.4.0-test5/linux/kernel/exit.c linux/kernel/exit.c
@@ -26,19 +26,23 @@
 {
 	if (p != current) {
 #ifdef CONFIG_SMP
-		int has_cpu;
-
 		/*
 		 * Wait to make sure the process isn't on the
 		 * runqueue (active on some other CPU still)
 		 */
-		do {
+		for (;;) {
 			spin_lock_irq(&runqueue_lock);
-			has_cpu = p->has_cpu;
+			if (!p->has_cpu)
+				break;
 			spin_unlock_irq(&runqueue_lock);
-		} while (has_cpu);
+			do {
+				barrier();
+			} while (p->has_cpu);
+		}
+		spin_unlock_irq(&runqueue_lock);
 #endif
-		free_uid(p);
+		atomic_dec(&p->user->processes);
+		free_uid(p->user);
 		unhash_process(p);
 
 		release_thread(p);

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)