Messages in this thread Patch in this message | | | From | Dimitri Sivanich <> | Subject | [PATCH] 2.6.6. runqueue lock for RT priority tasks | Date | Wed, 12 May 2004 15:05:42 -0500 (CDT) |
| |
Hi,
In the scheduler_tick code, the runqueue lock is currently taken before checking whether a task is an RT task or not. It would be more efficient to take the lock only in cases where the task is not RT or the task policy is SCHED_RR with no timeslice left.
I welcome your comments on the 2.6.6 patch presented below.
Thanks,
Dimitri Sivanich <sivanich@sgi.com>
Index: linux/kernel/sched.c =================================================================== --- linux.orig/kernel/sched.c 2004-05-10 15:29:33.000000000 -0500 +++ linux/kernel/sched.c 2004-05-10 15:29:33.000000000 -0500 @@ -1521,7 +1521,6 @@ set_tsk_need_resched(p); goto out; } - spin_lock(&rq->lock); /* * The task was running during this tick - update the * time slice counter. Note: we do not update a thread's @@ -1535,6 +1534,7 @@ * FIFO tasks have no timeslices. */ if ((p->policy == SCHED_RR) && !--p->time_slice) { + spin_lock(&rq->lock); p->time_slice = task_timeslice(p); p->first_time_slice = 0; set_tsk_need_resched(p); @@ -1542,9 +1542,11 @@ /* put it at the end of the queue: */ dequeue_task(p, rq->active); enqueue_task(p, rq->active); + goto out_unlock; } - goto out_unlock; + goto out; } + spin_lock(&rq->lock); if (!--p->time_slice) { dequeue_task(p, rq->active); set_tsk_need_resched(p); - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |