aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/sched/core.c
diff options
context:
space:
mode:
authorBjoern Brandenburg <bbb@mpi-sws.org>2013-07-01 16:50:05 -0400
committerBjoern Brandenburg <bbb@mpi-sws.org>2014-06-07 05:30:56 -0400
commitf78fda18215729f3e8589205c5b025a1885d16b7 (patch)
tree546ac35744b122df560a05115017cf33100ba368 /kernel/sched/core.c
parentc303fae95a925448441e01ea4b748e53bac119e6 (diff)
Integrate LITMUS^RT with try_to_wake_up() path
Diffstat (limited to 'kernel/sched/core.c')
-rw-r--r--kernel/sched/core.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 403aa9e0fb2a..210d42ddece1 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -1463,7 +1463,12 @@ static void ttwu_queue(struct task_struct *p, int cpu)
1463 struct rq *rq = cpu_rq(cpu); 1463 struct rq *rq = cpu_rq(cpu);
1464 1464
1465#if defined(CONFIG_SMP) 1465#if defined(CONFIG_SMP)
1466 if (sched_feat(TTWU_QUEUE) && !cpus_share_cache(smp_processor_id(), cpu)) { 1466 /*
1467 * LITMUS^RT: whether to send an IPI to the remote CPU is plugin
1468 * specific.
1469 */
1470 if (!is_realtime(p) &&
1471 sched_feat(TTWU_QUEUE) && !cpus_share_cache(smp_processor_id(), cpu)) {
1467 sched_clock_cpu(cpu); /* sync clocks x-cpu */ 1472 sched_clock_cpu(cpu); /* sync clocks x-cpu */
1468 ttwu_queue_remote(p, cpu); 1473 ttwu_queue_remote(p, cpu);
1469 return; 1474 return;
@@ -1496,6 +1501,9 @@ try_to_wake_up(struct task_struct *p, unsigned int state, int wake_flags)
1496 unsigned long flags; 1501 unsigned long flags;
1497 int cpu, success = 0; 1502 int cpu, success = 0;
1498 1503
1504 if (is_realtime(p))
1505 TRACE_TASK(p, "try_to_wake_up() state:%d\n", p->state);
1506
1499 /* 1507 /*
1500 * If we are going to wake up a thread waiting for CONDITION we 1508 * If we are going to wake up a thread waiting for CONDITION we
1501 * need to ensure that CONDITION=1 done by the caller can not be 1509 * need to ensure that CONDITION=1 done by the caller can not be
@@ -1525,6 +1533,12 @@ try_to_wake_up(struct task_struct *p, unsigned int state, int wake_flags)
1525 */ 1533 */
1526 smp_rmb(); 1534 smp_rmb();
1527 1535
1536 /* LITMUS^RT: once the task can be safely referenced by this
1537 * CPU, don't mess with Linux load balancing stuff.
1538 */
1539 if (is_realtime(p))
1540 goto litmus_out_activate;
1541
1528 p->sched_contributes_to_load = !!task_contributes_to_load(p); 1542 p->sched_contributes_to_load = !!task_contributes_to_load(p);
1529 p->state = TASK_WAKING; 1543 p->state = TASK_WAKING;
1530 1544
@@ -1536,12 +1550,16 @@ try_to_wake_up(struct task_struct *p, unsigned int state, int wake_flags)
1536 wake_flags |= WF_MIGRATED; 1550 wake_flags |= WF_MIGRATED;
1537 set_task_cpu(p, cpu); 1551 set_task_cpu(p, cpu);
1538 } 1552 }
1553
1554litmus_out_activate:
1539#endif /* CONFIG_SMP */ 1555#endif /* CONFIG_SMP */
1540 1556
1541 ttwu_queue(p, cpu); 1557 ttwu_queue(p, cpu);
1542stat: 1558stat:
1543 ttwu_stat(p, cpu, wake_flags); 1559 ttwu_stat(p, cpu, wake_flags);
1544out: 1560out:
1561 if (is_realtime(p))
1562 TRACE_TASK(p, "try_to_wake_up() done state:%d\n", p->state);
1545 raw_spin_unlock_irqrestore(&p->pi_lock, flags); 1563 raw_spin_unlock_irqrestore(&p->pi_lock, flags);
1546 1564
1547 return success; 1565 return success;