aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBjoern Brandenburg <bbb@mpi-sws.org>2013-07-01 16:50:05 -0400
committerBjoern Brandenburg <bbb@mpi-sws.org>2013-08-07 03:46:58 -0400
commitfa1584073535113c252b8c62fab819159ef68e4d (patch)
tree6413708f498c2e210e045533ace462f0662acc40
parentd4bc489e94c6727d0f593ea2ace5a8a2e376b9bf (diff)
Integrate LITMUS^RT with try_to_wake_up() path
-rw-r--r--kernel/sched/core.c21
1 files changed, 20 insertions, 1 deletions
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index b6ff5df94241..e91eb050d2fb 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -86,6 +86,7 @@
86#include "../workqueue_internal.h" 86#include "../workqueue_internal.h"
87#include "../smpboot.h" 87#include "../smpboot.h"
88 88
89#include <litmus/litmus.h>
89#include <litmus/trace.h> 90#include <litmus/trace.h>
90#include <litmus/sched_trace.h> 91#include <litmus/sched_trace.h>
91void litmus_tick(struct rq*, struct task_struct*); 92void litmus_tick(struct rq*, struct task_struct*);
@@ -1464,7 +1465,12 @@ static void ttwu_queue(struct task_struct *p, int cpu)
1464 struct rq *rq = cpu_rq(cpu); 1465 struct rq *rq = cpu_rq(cpu);
1465 1466
1466#if defined(CONFIG_SMP) 1467#if defined(CONFIG_SMP)
1467 if (sched_feat(TTWU_QUEUE) && !cpus_share_cache(smp_processor_id(), cpu)) { 1468 /*
1469 * LITMUS^RT: whether to send an IPI to the remote CPU is plugin
1470 * specific.
1471 */
1472 if (!is_realtime(p) &&
1473 sched_feat(TTWU_QUEUE) && !cpus_share_cache(smp_processor_id(), cpu)) {
1468 sched_clock_cpu(cpu); /* sync clocks x-cpu */ 1474 sched_clock_cpu(cpu); /* sync clocks x-cpu */
1469 ttwu_queue_remote(p, cpu); 1475 ttwu_queue_remote(p, cpu);
1470 return; 1476 return;
@@ -1497,6 +1503,9 @@ try_to_wake_up(struct task_struct *p, unsigned int state, int wake_flags)
1497 unsigned long flags; 1503 unsigned long flags;
1498 int cpu, success = 0; 1504 int cpu, success = 0;
1499 1505
1506 if (is_realtime(p))
1507 TRACE_TASK(p, "try_to_wake_up() state:%d\n", p->state);
1508
1500 smp_wmb(); 1509 smp_wmb();
1501 raw_spin_lock_irqsave(&p->pi_lock, flags); 1510 raw_spin_lock_irqsave(&p->pi_lock, flags);
1502 if (!(p->state & state)) 1511 if (!(p->state & state))
@@ -1520,6 +1529,12 @@ try_to_wake_up(struct task_struct *p, unsigned int state, int wake_flags)
1520 */ 1529 */
1521 smp_rmb(); 1530 smp_rmb();
1522 1531
1532 /* LITMUS^RT: once the task can be safely referenced by this
1533 * CPU, don't mess with Linux load balancing stuff.
1534 */
1535 if (is_realtime(p))
1536 goto litmus_out_activate;
1537
1523 p->sched_contributes_to_load = !!task_contributes_to_load(p); 1538 p->sched_contributes_to_load = !!task_contributes_to_load(p);
1524 p->state = TASK_WAKING; 1539 p->state = TASK_WAKING;
1525 1540
@@ -1531,12 +1546,16 @@ try_to_wake_up(struct task_struct *p, unsigned int state, int wake_flags)
1531 wake_flags |= WF_MIGRATED; 1546 wake_flags |= WF_MIGRATED;
1532 set_task_cpu(p, cpu); 1547 set_task_cpu(p, cpu);
1533 } 1548 }
1549
1550litmus_out_activate:
1534#endif /* CONFIG_SMP */ 1551#endif /* CONFIG_SMP */
1535 1552
1536 ttwu_queue(p, cpu); 1553 ttwu_queue(p, cpu);
1537stat: 1554stat:
1538 ttwu_stat(p, cpu, wake_flags); 1555 ttwu_stat(p, cpu, wake_flags);
1539out: 1556out:
1557 if (is_realtime(p))
1558 TRACE_TASK(p, "try_to_wake_up() done state:%d\n", p->state);
1540 raw_spin_unlock_irqrestore(&p->pi_lock, flags); 1559 raw_spin_unlock_irqrestore(&p->pi_lock, flags);
1541 1560
1542 return success; 1561 return success;