diff options
author | Bjoern Brandenburg <bbb@mpi-sws.org> | 2015-08-09 07:18:52 -0400 |
---|---|---|
committer | Bjoern Brandenburg <bbb@mpi-sws.org> | 2015-08-09 07:20:27 -0400 |
commit | 7a56274fcd7fdbfd928e9ec8c1772cae645a0749 (patch) | |
tree | c6d15d0c672b2a5a996e647f0cd9b4b0dd5d947c /kernel | |
parent | 2d9d30c425cbfea22b3ae57a39257db8f9466699 (diff) |
Integrate LITMUS^RT with try_to_wake_up() path
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/sched/core.c | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/kernel/sched/core.c b/kernel/sched/core.c index 8c23af255271..42b4e32ec494 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c | |||
@@ -1635,7 +1635,12 @@ static void ttwu_queue(struct task_struct *p, int cpu) | |||
1635 | struct rq *rq = cpu_rq(cpu); | 1635 | struct rq *rq = cpu_rq(cpu); |
1636 | 1636 | ||
1637 | #if defined(CONFIG_SMP) | 1637 | #if defined(CONFIG_SMP) |
1638 | if (sched_feat(TTWU_QUEUE) && !cpus_share_cache(smp_processor_id(), cpu)) { | 1638 | /* |
1639 | * LITMUS^RT: whether to send an IPI to the remote CPU is plugin | ||
1640 | * specific. | ||
1641 | */ | ||
1642 | if (!is_realtime(p) && | ||
1643 | sched_feat(TTWU_QUEUE) && !cpus_share_cache(smp_processor_id(), cpu)) { | ||
1639 | sched_clock_cpu(cpu); /* sync clocks x-cpu */ | 1644 | sched_clock_cpu(cpu); /* sync clocks x-cpu */ |
1640 | ttwu_queue_remote(p, cpu); | 1645 | ttwu_queue_remote(p, cpu); |
1641 | return; | 1646 | return; |
@@ -1668,6 +1673,9 @@ try_to_wake_up(struct task_struct *p, unsigned int state, int wake_flags) | |||
1668 | unsigned long flags; | 1673 | unsigned long flags; |
1669 | int cpu, success = 0; | 1674 | int cpu, success = 0; |
1670 | 1675 | ||
1676 | if (is_realtime(p)) | ||
1677 | TRACE_TASK(p, "try_to_wake_up() state:%d\n", p->state); | ||
1678 | |||
1671 | /* | 1679 | /* |
1672 | * If we are going to wake up a thread waiting for CONDITION we | 1680 | * If we are going to wake up a thread waiting for CONDITION we |
1673 | * need to ensure that CONDITION=1 done by the caller can not be | 1681 | * need to ensure that CONDITION=1 done by the caller can not be |
@@ -1697,6 +1705,12 @@ try_to_wake_up(struct task_struct *p, unsigned int state, int wake_flags) | |||
1697 | */ | 1705 | */ |
1698 | smp_rmb(); | 1706 | smp_rmb(); |
1699 | 1707 | ||
1708 | /* LITMUS^RT: once the task can be safely referenced by this | ||
1709 | * CPU, don't mess with Linux load balancing stuff. | ||
1710 | */ | ||
1711 | if (is_realtime(p)) | ||
1712 | goto litmus_out_activate; | ||
1713 | |||
1700 | p->sched_contributes_to_load = !!task_contributes_to_load(p); | 1714 | p->sched_contributes_to_load = !!task_contributes_to_load(p); |
1701 | p->state = TASK_WAKING; | 1715 | p->state = TASK_WAKING; |
1702 | 1716 | ||
@@ -1708,12 +1722,16 @@ try_to_wake_up(struct task_struct *p, unsigned int state, int wake_flags) | |||
1708 | wake_flags |= WF_MIGRATED; | 1722 | wake_flags |= WF_MIGRATED; |
1709 | set_task_cpu(p, cpu); | 1723 | set_task_cpu(p, cpu); |
1710 | } | 1724 | } |
1725 | |||
1726 | litmus_out_activate: | ||
1711 | #endif /* CONFIG_SMP */ | 1727 | #endif /* CONFIG_SMP */ |
1712 | 1728 | ||
1713 | ttwu_queue(p, cpu); | 1729 | ttwu_queue(p, cpu); |
1714 | stat: | 1730 | stat: |
1715 | ttwu_stat(p, cpu, wake_flags); | 1731 | ttwu_stat(p, cpu, wake_flags); |
1716 | out: | 1732 | out: |
1733 | if (is_realtime(p)) | ||
1734 | TRACE_TASK(p, "try_to_wake_up() done state:%d\n", p->state); | ||
1717 | raw_spin_unlock_irqrestore(&p->pi_lock, flags); | 1735 | raw_spin_unlock_irqrestore(&p->pi_lock, flags); |
1718 | 1736 | ||
1719 | return success; | 1737 | return success; |