diff options
author | Bjoern B. Brandenburg <bbb@cs.unc.edu> | 2011-07-27 20:34:20 -0400 |
---|---|---|
committer | Bjoern B. Brandenburg <bbb@cs.unc.edu> | 2011-07-27 20:34:20 -0400 |
commit | c43b15ffd2643305935a85a0ba2e3c6e7d1c5e86 (patch) | |
tree | d65f8162823a6d29b80b6b78fbf9604e23fe87f0 | |
parent | 6bf2c35b7d412a77d28e6cd09cf77958608f3459 (diff) |
PSN-EDF: use FMLP+ priority-boosting order
boost by request time, not issue time
-rw-r--r-- | litmus/sched_psn_edf.c | 27 |
1 files changed, 19 insertions, 8 deletions
diff --git a/litmus/sched_psn_edf.c b/litmus/sched_psn_edf.c index 2e5b9c9d75d7..7b12689ab61a 100644 --- a/litmus/sched_psn_edf.c +++ b/litmus/sched_psn_edf.c | |||
@@ -412,6 +412,12 @@ int psnedf_fmlp_lock(struct litmus_lock* l) | |||
412 | if (!is_realtime(t)) | 412 | if (!is_realtime(t)) |
413 | return -EPERM; | 413 | return -EPERM; |
414 | 414 | ||
415 | preempt_disable(); | ||
416 | |||
417 | TRACE_CUR("want FMLP sem %p\n", sem); | ||
418 | |||
419 | boost_priority(t); | ||
420 | |||
415 | spin_lock_irqsave(&sem->wait.lock, flags); | 421 | spin_lock_irqsave(&sem->wait.lock, flags); |
416 | 422 | ||
417 | if (sem->owner) { | 423 | if (sem->owner) { |
@@ -422,10 +428,9 @@ int psnedf_fmlp_lock(struct litmus_lock* l) | |||
422 | /* FIXME: interruptible would be nice some day */ | 428 | /* FIXME: interruptible would be nice some day */ |
423 | set_task_state(t, TASK_UNINTERRUPTIBLE); | 429 | set_task_state(t, TASK_UNINTERRUPTIBLE); |
424 | 430 | ||
431 | TRACE_CUR("blocking on FMLP sem %p\n", sem); | ||
425 | __add_wait_queue_tail_exclusive(&sem->wait, &wait); | 432 | __add_wait_queue_tail_exclusive(&sem->wait, &wait); |
426 | 433 | ||
427 | TS_LOCK_SUSPEND; | ||
428 | |||
429 | /* release lock before sleeping */ | 434 | /* release lock before sleeping */ |
430 | spin_unlock_irqrestore(&sem->wait.lock, flags); | 435 | spin_unlock_irqrestore(&sem->wait.lock, flags); |
431 | 436 | ||
@@ -434,8 +439,14 @@ int psnedf_fmlp_lock(struct litmus_lock* l) | |||
434 | * there is only one wake up per release. | 439 | * there is only one wake up per release. |
435 | */ | 440 | */ |
436 | 441 | ||
442 | TS_LOCK_SUSPEND; | ||
443 | |||
444 | preempt_enable_no_resched(); | ||
445 | |||
437 | schedule(); | 446 | schedule(); |
438 | 447 | ||
448 | preempt_disable(); | ||
449 | |||
439 | TS_LOCK_RESUME; | 450 | TS_LOCK_RESUME; |
440 | 451 | ||
441 | /* Since we hold the lock, no other task will change | 452 | /* Since we hold the lock, no other task will change |
@@ -446,12 +457,13 @@ int psnedf_fmlp_lock(struct litmus_lock* l) | |||
446 | /* it's ours now */ | 457 | /* it's ours now */ |
447 | sem->owner = t; | 458 | sem->owner = t; |
448 | 459 | ||
449 | /* mark the task as priority-boosted. */ | ||
450 | boost_priority(t); | ||
451 | |||
452 | spin_unlock_irqrestore(&sem->wait.lock, flags); | 460 | spin_unlock_irqrestore(&sem->wait.lock, flags); |
453 | } | 461 | } |
454 | 462 | ||
463 | TRACE_CUR("got FMLP sem %p\n", sem); | ||
464 | |||
465 | preempt_enable(); | ||
466 | |||
455 | return 0; | 467 | return 0; |
456 | } | 468 | } |
457 | 469 | ||
@@ -469,6 +481,8 @@ int psnedf_fmlp_unlock(struct litmus_lock* l) | |||
469 | goto out; | 481 | goto out; |
470 | } | 482 | } |
471 | 483 | ||
484 | TRACE_CUR("releasing FMLP sem %p\n", sem); | ||
485 | |||
472 | /* we lose the benefit of priority boosting */ | 486 | /* we lose the benefit of priority boosting */ |
473 | 487 | ||
474 | unboost_priority(t); | 488 | unboost_priority(t); |
@@ -476,9 +490,6 @@ int psnedf_fmlp_unlock(struct litmus_lock* l) | |||
476 | /* check if there are jobs waiting for this resource */ | 490 | /* check if there are jobs waiting for this resource */ |
477 | next = __waitqueue_remove_first(&sem->wait); | 491 | next = __waitqueue_remove_first(&sem->wait); |
478 | if (next) { | 492 | if (next) { |
479 | /* boost next job */ | ||
480 | boost_priority(next); | ||
481 | |||
482 | /* next becomes the resouce holder */ | 493 | /* next becomes the resouce holder */ |
483 | sem->owner = next; | 494 | sem->owner = next; |
484 | 495 | ||