@@ -2275,30 +2275,23 @@ static int affine_move_task(struct rq *rq, struct task_struct *p, struct rq_flag
2275
2275
return - EINVAL ;
2276
2276
}
2277
2277
2278
- if (flags & SCA_MIGRATE_ENABLE ) {
2279
-
2280
- refcount_inc (& pending -> refs ); /* pending->{arg,stop_work} */
2281
- p -> migration_flags &= ~MDF_PUSH ;
2282
- task_rq_unlock (rq , p , rf );
2283
-
2284
- stop_one_cpu_nowait (cpu_of (rq ), migration_cpu_stop ,
2285
- & pending -> arg , & pending -> stop_work );
2286
-
2287
- return 0 ;
2288
- }
2289
-
2290
2278
if (task_running (rq , p ) || p -> state == TASK_WAKING ) {
2291
2279
/*
2292
- * Lessen races (and headaches) by delegating
2293
- * is_migration_disabled(p) checks to the stopper, which will
2294
- * run on the same CPU as said p .
2280
+ * MIGRATE_ENABLE gets here because 'p == current', but for
2281
+ * anything else we cannot do is_migration_disabled(), punt
2282
+ * and have the stopper function handle it all race-free .
2295
2283
*/
2284
+
2296
2285
refcount_inc (& pending -> refs ); /* pending->{arg,stop_work} */
2286
+ if (flags & SCA_MIGRATE_ENABLE )
2287
+ p -> migration_flags &= ~MDF_PUSH ;
2297
2288
task_rq_unlock (rq , p , rf );
2298
2289
2299
2290
stop_one_cpu_nowait (cpu_of (rq ), migration_cpu_stop ,
2300
2291
& pending -> arg , & pending -> stop_work );
2301
2292
2293
+ if (flags & SCA_MIGRATE_ENABLE )
2294
+ return 0 ;
2302
2295
} else {
2303
2296
2304
2297
if (!is_migration_disabled (p )) {
0 commit comments