lkml.org 
[lkml]   [2004]   [May]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] 2.6.6. runqueue lock for RT priority tasks
Date
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/
\
 
 \ /
  Last update: 2005-03-22 14:03    [W:0.027 / U:0.048 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site