aboutsummaryrefslogtreecommitdiffstats
path: root/litmus/sched_psn_edf.c
diff options
context:
space:
mode:
authorGlenn Elliott <gelliott@cs.unc.edu>2012-03-04 19:47:13 -0500
committerGlenn Elliott <gelliott@cs.unc.edu>2012-03-04 19:47:13 -0500
commitc71c03bda1e86c9d5198c5d83f712e695c4f2a1e (patch)
treeecb166cb3e2b7e2adb3b5e292245fefd23381ac8 /litmus/sched_psn_edf.c
parentea53c912f8a86a8567697115b6a0d8152beee5c8 (diff)
parent6a00f206debf8a5c8899055726ad127dbeeed098 (diff)
Merge branch 'mpi-master' into wip-k-fmlpwip-k-fmlp
Conflicts: litmus/sched_cedf.c
Diffstat (limited to 'litmus/sched_psn_edf.c')
-rw-r--r--litmus/sched_psn_edf.c41
1 files changed, 33 insertions, 8 deletions
diff --git a/litmus/sched_psn_edf.c b/litmus/sched_psn_edf.c
index 71c02409efa2..8e4a22dd8d6a 100644
--- a/litmus/sched_psn_edf.c
+++ b/litmus/sched_psn_edf.c
@@ -20,6 +20,7 @@
20#include <litmus/sched_plugin.h> 20#include <litmus/sched_plugin.h>
21#include <litmus/edf_common.h> 21#include <litmus/edf_common.h>
22#include <litmus/sched_trace.h> 22#include <litmus/sched_trace.h>
23#include <litmus/trace.h>
23 24
24typedef struct { 25typedef struct {
25 rt_domain_t domain; 26 rt_domain_t domain;
@@ -383,12 +384,6 @@ static unsigned int psnedf_get_srp_prio(struct task_struct* t)
383 return get_rt_period(t); 384 return get_rt_period(t);
384} 385}
385 386
386static long psnedf_activate_plugin(void)
387{
388 get_srp_prio = psnedf_get_srp_prio;
389 return 0;
390}
391
392/* ******************** FMLP support ********************** */ 387/* ******************** FMLP support ********************** */
393 388
394/* struct for semaphore with priority inheritance */ 389/* struct for semaphore with priority inheritance */
@@ -428,6 +423,8 @@ int psnedf_fmlp_lock(struct litmus_lock* l)
428 423
429 __add_wait_queue_tail_exclusive(&sem->wait, &wait); 424 __add_wait_queue_tail_exclusive(&sem->wait, &wait);
430 425
426 TS_LOCK_SUSPEND;
427
431 /* release lock before sleeping */ 428 /* release lock before sleeping */
432 spin_unlock_irqrestore(&sem->wait.lock, flags); 429 spin_unlock_irqrestore(&sem->wait.lock, flags);
433 430
@@ -438,6 +435,8 @@ int psnedf_fmlp_lock(struct litmus_lock* l)
438 435
439 schedule(); 436 schedule();
440 437
438 TS_LOCK_RESUME;
439
441 /* Since we hold the lock, no other task will change 440 /* Since we hold the lock, no other task will change
442 * ->owner. We can thus check it without acquiring the spin 441 * ->owner. We can thus check it without acquiring the spin
443 * lock. */ 442 * lock. */
@@ -577,9 +576,35 @@ static long psnedf_allocate_lock(struct litmus_lock **lock, int type,
577 576
578#endif 577#endif
579 578
579
580static long psnedf_activate_plugin(void)
581{
582#ifdef CONFIG_RELEASE_MASTER
583 int cpu;
584
585 for_each_online_cpu(cpu) {
586 remote_edf(cpu)->release_master = atomic_read(&release_master_cpu);
587 }
588#endif
589
590#ifdef CONFIG_LITMUS_LOCKING
591 get_srp_prio = psnedf_get_srp_prio;
592#endif
593
594 return 0;
595}
596
580static long psnedf_admit_task(struct task_struct* tsk) 597static long psnedf_admit_task(struct task_struct* tsk)
581{ 598{
582 return task_cpu(tsk) == tsk->rt_param.task_params.cpu ? 0 : -EINVAL; 599 if (task_cpu(tsk) == tsk->rt_param.task_params.cpu
600#ifdef CONFIG_RELEASE_MASTER
601 /* don't allow tasks on release master CPU */
602 && task_cpu(tsk) != remote_edf(task_cpu(tsk))->release_master
603#endif
604 )
605 return 0;
606 else
607 return -EINVAL;
583} 608}
584 609
585/* Plugin object */ 610/* Plugin object */
@@ -593,9 +618,9 @@ static struct sched_plugin psn_edf_plugin __cacheline_aligned_in_smp = {
593 .task_wake_up = psnedf_task_wake_up, 618 .task_wake_up = psnedf_task_wake_up,
594 .task_block = psnedf_task_block, 619 .task_block = psnedf_task_block,
595 .admit_task = psnedf_admit_task, 620 .admit_task = psnedf_admit_task,
621 .activate_plugin = psnedf_activate_plugin,
596#ifdef CONFIG_LITMUS_LOCKING 622#ifdef CONFIG_LITMUS_LOCKING
597 .allocate_lock = psnedf_allocate_lock, 623 .allocate_lock = psnedf_allocate_lock,
598 .activate_plugin = psnedf_activate_plugin,
599#endif 624#endif
600}; 625};
601 626