aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2007-06-28 20:58:05 -0400
committerPaul Mackerras <paulus@samba.org>2007-07-03 01:24:46 -0400
commitc77239b8be74f775142d9dd01041e2ce864ba20d (patch)
treefd93da1686df8b83a77ae839193f1eae4ce19a66 /arch
parent08c9692b168240729cf89c69c4ad722760a5690c (diff)
[POWERPC] spusched: Disable tick when not needed
Only enable the scheduler tick if we have any context waiting to be scheduled. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Jeremy Kerr <jk@ozlabs.org> Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'arch')
-rw-r--r--arch/powerpc/platforms/cell/spufs/sched.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/arch/powerpc/platforms/cell/spufs/sched.c b/arch/powerpc/platforms/cell/spufs/sched.c
index bb16c22360d5..2fb0e63344cc 100644
--- a/arch/powerpc/platforms/cell/spufs/sched.c
+++ b/arch/powerpc/platforms/cell/spufs/sched.c
@@ -294,9 +294,10 @@ static void __spu_add_to_rq(struct spu_context *ctx)
294{ 294{
295 int prio = ctx->prio; 295 int prio = ctx->prio;
296 296
297 spu_prio->nr_waiting++;
298 list_add_tail(&ctx->rq, &spu_prio->runq[prio]); 297 list_add_tail(&ctx->rq, &spu_prio->runq[prio]);
299 set_bit(prio, spu_prio->bitmap); 298 set_bit(prio, spu_prio->bitmap);
299 if (!spu_prio->nr_waiting++)
300 __mod_timer(&spusched_timer, jiffies + SPUSCHED_TICK);
300} 301}
301 302
302static void __spu_del_from_rq(struct spu_context *ctx) 303static void __spu_del_from_rq(struct spu_context *ctx)
@@ -304,11 +305,13 @@ static void __spu_del_from_rq(struct spu_context *ctx)
304 int prio = ctx->prio; 305 int prio = ctx->prio;
305 306
306 if (!list_empty(&ctx->rq)) { 307 if (!list_empty(&ctx->rq)) {
308 if (!--spu_prio->nr_waiting)
309 del_timer(&spusched_timer);
307 list_del_init(&ctx->rq); 310 list_del_init(&ctx->rq);
308 spu_prio->nr_waiting--; 311
312 if (list_empty(&spu_prio->runq[prio]))
313 clear_bit(prio, spu_prio->bitmap);
309 } 314 }
310 if (list_empty(&spu_prio->runq[prio]))
311 clear_bit(prio, spu_prio->bitmap);
312} 315}
313 316
314static void spu_prio_wait(struct spu_context *ctx) 317static void spu_prio_wait(struct spu_context *ctx)
@@ -654,9 +657,6 @@ static int spusched_thread(void *unused)
654 struct spu *spu, *next; 657 struct spu *spu, *next;
655 int node; 658 int node;
656 659
657 setup_timer(&spusched_timer, spusched_wake, 0);
658 __mod_timer(&spusched_timer, jiffies + SPUSCHED_TICK);
659
660 while (!kthread_should_stop()) { 660 while (!kthread_should_stop()) {
661 set_current_state(TASK_INTERRUPTIBLE); 661 set_current_state(TASK_INTERRUPTIBLE);
662 schedule(); 662 schedule();
@@ -670,7 +670,6 @@ static int spusched_thread(void *unused)
670 } 670 }
671 } 671 }
672 672
673 del_timer_sync(&spusched_timer);
674 return 0; 673 return 0;
675} 674}
676 675
@@ -732,6 +731,8 @@ int __init spu_sched_init(void)
732 } 731 }
733 spin_lock_init(&spu_prio->runq_lock); 732 spin_lock_init(&spu_prio->runq_lock);
734 733
734 setup_timer(&spusched_timer, spusched_wake, 0);
735
735 spusched_task = kthread_run(spusched_thread, NULL, "spusched"); 736 spusched_task = kthread_run(spusched_thread, NULL, "spusched");
736 if (IS_ERR(spusched_task)) { 737 if (IS_ERR(spusched_task)) {
737 err = PTR_ERR(spusched_task); 738 err = PTR_ERR(spusched_task);
@@ -762,6 +763,7 @@ void __exit spu_sched_exit(void)
762 763
763 remove_proc_entry("spu_loadavg", NULL); 764 remove_proc_entry("spu_loadavg", NULL);
764 765
766 del_timer_sync(&spusched_timer);
765 kthread_stop(spusched_task); 767 kthread_stop(spusched_task);
766 768
767 for (node = 0; node < MAX_NUMNODES; node++) { 769 for (node = 0; node < MAX_NUMNODES; node++) {