aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/sched.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/sched.c')
-rw-r--r--kernel/sched.c43
1 files changed, 0 insertions, 43 deletions
diff --git a/kernel/sched.c b/kernel/sched.c
index d8a213ccdc3b..5cd607ec8405 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -2088,49 +2088,6 @@ migrate_task(struct task_struct *p, int dest_cpu, struct migration_req *req)
2088} 2088}
2089 2089
2090/* 2090/*
2091 * wait_task_context_switch - wait for a thread to complete at least one
2092 * context switch.
2093 *
2094 * @p must not be current.
2095 */
2096void wait_task_context_switch(struct task_struct *p)
2097{
2098 unsigned long nvcsw, nivcsw, flags;
2099 int running;
2100 struct rq *rq;
2101
2102 nvcsw = p->nvcsw;
2103 nivcsw = p->nivcsw;
2104 for (;;) {
2105 /*
2106 * The runqueue is assigned before the actual context
2107 * switch. We need to take the runqueue lock.
2108 *
2109 * We could check initially without the lock but it is
2110 * very likely that we need to take the lock in every
2111 * iteration.
2112 */
2113 rq = task_rq_lock(p, &flags);
2114 running = task_running(rq, p);
2115 task_rq_unlock(rq, &flags);
2116
2117 if (likely(!running))
2118 break;
2119 /*
2120 * The switch count is incremented before the actual
2121 * context switch. We thus wait for two switches to be
2122 * sure at least one completed.
2123 */
2124 if ((p->nvcsw - nvcsw) > 1)
2125 break;
2126 if ((p->nivcsw - nivcsw) > 1)
2127 break;
2128
2129 cpu_relax();
2130 }
2131}
2132
2133/*
2134 * wait_task_inactive - wait for a thread to unschedule. 2091 * wait_task_inactive - wait for a thread to unschedule.
2135 * 2092 *
2136 * If @match_state is nonzero, it's the @p->state value just checked and 2093 * If @match_state is nonzero, it's the @p->state value just checked and