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