patch-2.1.104 linux/kernel/sched.c

Next file: linux/kernel/sys.c
Previous file: linux/kernel/panic.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.103/linux/kernel/sched.c linux/kernel/sched.c
@@ -142,6 +142,22 @@
 	prev->next_run = p;
 }
 
+static inline void move_first_runqueue(struct task_struct * p)
+{
+	struct task_struct *next = p->next_run;
+	struct task_struct *prev = p->prev_run;
+
+	/* remove from list */
+	next->prev_run = prev;
+	prev->next_run = next;
+	/* add back to list */
+	p->prev_run = &init_task;
+	next = init_task.next_run;
+	init_task.next_run = p;
+	p->next_run = next;
+	next->prev_run = p;
+}
+
 /*
  * The tasklist_lock protects the linked list of processes.
  *
@@ -1130,7 +1146,7 @@
  
 asmlinkage int sys_getpid(void)
 {
-	/* This is SMP safe - current->pid doesnt change */
+	/* This is SMP safe - current->pid doesn't change */
 	return current->pid;
 }
 
@@ -1329,7 +1345,7 @@
 	p->policy = policy;
 	p->rt_priority = lp.sched_priority;
 	if (p->next_run)
-		move_last_runqueue(p);
+		move_first_runqueue(p);
 
 	need_resched = 1;
 

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov