diff options
author | Glenn Elliott <gelliott@cs.unc.edu> | 2012-09-07 23:25:01 -0400 |
---|---|---|
committer | Glenn Elliott <gelliott@cs.unc.edu> | 2012-09-07 23:33:05 -0400 |
commit | 6a225701acf7d79f292eeffcd99d6f00b02c180b (patch) | |
tree | 6a7f538703a5a6460a0e53c62f0f952998840ea1 /litmus/sched_cedf.c | |
parent | b53c479a0f44b8990ce106622412a3bf54809944 (diff) |
Infrastructure for Litmus signals.prop/litmus-signals
Added signals to Litmus. Specifcally, SIG_BUDGET signals
are delivered (when requested by real-time tasks) when
a budget is exceeded.
Note: pfair not currently supported (but it probably could be).
Diffstat (limited to 'litmus/sched_cedf.c')
-rw-r--r-- | litmus/sched_cedf.c | 47 |
1 files changed, 31 insertions, 16 deletions
diff --git a/litmus/sched_cedf.c b/litmus/sched_cedf.c index b0c16e34d2c5..208f067934fc 100644 --- a/litmus/sched_cedf.c +++ b/litmus/sched_cedf.c | |||
@@ -371,21 +371,29 @@ static noinline void job_completion(struct task_struct *t, int forced) | |||
371 | */ | 371 | */ |
372 | static void cedf_tick(struct task_struct* t) | 372 | static void cedf_tick(struct task_struct* t) |
373 | { | 373 | { |
374 | if (is_realtime(t) && budget_enforced(t) && budget_exhausted(t)) { | 374 | if (is_realtime(t) && budget_exhausted(t)) |
375 | if (!is_np(t)) { | 375 | { |
376 | /* np tasks will be preempted when they become | 376 | if (budget_signalled(t) && !sigbudget_sent(t)) { |
377 | * preemptable again | 377 | /* signal exhaustion */ |
378 | */ | 378 | send_sigbudget(t); |
379 | litmus_reschedule_local(); | 379 | } |
380 | set_will_schedule(); | 380 | |
381 | TRACE("cedf_scheduler_tick: " | 381 | if (budget_enforced(t)) { |
382 | "%d is preemptable " | 382 | if (!is_np(t)) { |
383 | " => FORCE_RESCHED\n", t->pid); | 383 | /* np tasks will be preempted when they become |
384 | } else if (is_user_np(t)) { | 384 | * preemptable again |
385 | TRACE("cedf_scheduler_tick: " | 385 | */ |
386 | "%d is non-preemptable, " | 386 | litmus_reschedule_local(); |
387 | "preemption delayed.\n", t->pid); | 387 | set_will_schedule(); |
388 | request_exit_np(t); | 388 | TRACE("cedf_scheduler_tick: " |
389 | "%d is preemptable " | ||
390 | " => FORCE_RESCHED\n", t->pid); | ||
391 | } else if (is_user_np(t)) { | ||
392 | TRACE("cedf_scheduler_tick: " | ||
393 | "%d is non-preemptable, " | ||
394 | "preemption delayed.\n", t->pid); | ||
395 | request_exit_np(t); | ||
396 | } | ||
389 | } | 397 | } |
390 | } | 398 | } |
391 | } | 399 | } |
@@ -415,7 +423,7 @@ static struct task_struct* cedf_schedule(struct task_struct * prev) | |||
415 | { | 423 | { |
416 | cpu_entry_t* entry = &__get_cpu_var(cedf_cpu_entries); | 424 | cpu_entry_t* entry = &__get_cpu_var(cedf_cpu_entries); |
417 | cedf_domain_t *cluster = entry->cluster; | 425 | cedf_domain_t *cluster = entry->cluster; |
418 | int out_of_time, sleep, preempt, np, exists, blocks; | 426 | int out_of_time, signal_budget, sleep, preempt, np, exists, blocks; |
419 | struct task_struct* next = NULL; | 427 | struct task_struct* next = NULL; |
420 | 428 | ||
421 | #ifdef CONFIG_RELEASE_MASTER | 429 | #ifdef CONFIG_RELEASE_MASTER |
@@ -442,6 +450,10 @@ static struct task_struct* cedf_schedule(struct task_struct * prev) | |||
442 | out_of_time = exists && | 450 | out_of_time = exists && |
443 | budget_enforced(entry->scheduled) && | 451 | budget_enforced(entry->scheduled) && |
444 | budget_exhausted(entry->scheduled); | 452 | budget_exhausted(entry->scheduled); |
453 | signal_budget = exists && | ||
454 | budget_signalled(entry->scheduled) && | ||
455 | budget_exhausted(entry->scheduled) && | ||
456 | !sigbudget_sent(entry->scheduled); | ||
445 | np = exists && is_np(entry->scheduled); | 457 | np = exists && is_np(entry->scheduled); |
446 | sleep = exists && get_rt_flags(entry->scheduled) == RT_F_SLEEP; | 458 | sleep = exists && get_rt_flags(entry->scheduled) == RT_F_SLEEP; |
447 | preempt = entry->scheduled != entry->linked; | 459 | preempt = entry->scheduled != entry->linked; |
@@ -460,6 +472,9 @@ static struct task_struct* cedf_schedule(struct task_struct * prev) | |||
460 | TRACE_TASK(prev, "will be preempted by %s/%d\n", | 472 | TRACE_TASK(prev, "will be preempted by %s/%d\n", |
461 | entry->linked->comm, entry->linked->pid); | 473 | entry->linked->comm, entry->linked->pid); |
462 | 474 | ||
475 | /* Send the signal that the budget has been exhausted */ | ||
476 | if (signal_budget) | ||
477 | send_sigbudget(entry->scheduled); | ||
463 | 478 | ||
464 | /* If a task blocks we have no choice but to reschedule. | 479 | /* If a task blocks we have no choice but to reschedule. |
465 | */ | 480 | */ |