@@ -2239,30 +2239,23 @@ static int affine_move_task(struct rq *rq, struct task_struct *p, struct rq_flag
2239
2239
return - EINVAL ;
2240
2240
}
2241
2241
2242
- if (flags & SCA_MIGRATE_ENABLE ) {
2243
-
2244
- refcount_inc (& pending -> refs ); /* pending->{arg,stop_work} */
2245
- p -> migration_flags &= ~MDF_PUSH ;
2246
- task_rq_unlock (rq , p , rf );
2247
-
2248
- stop_one_cpu_nowait (cpu_of (rq ), migration_cpu_stop ,
2249
- & pending -> arg , & pending -> stop_work );
2250
-
2251
- return 0 ;
2252
- }
2253
-
2254
2242
if (task_running (rq , p ) || p -> state == TASK_WAKING ) {
2255
2243
/*
2256
- * Lessen races (and headaches) by delegating
2257
- * is_migration_disabled(p) checks to the stopper, which will
2258
- * run on the same CPU as said p .
2244
+ * MIGRATE_ENABLE gets here because 'p == current', but for
2245
+ * anything else we cannot do is_migration_disabled(), punt
2246
+ * and have the stopper function handle it all race-free .
2259
2247
*/
2248
+
2260
2249
refcount_inc (& pending -> refs ); /* pending->{arg,stop_work} */
2250
+ if (flags & SCA_MIGRATE_ENABLE )
2251
+ p -> migration_flags &= ~MDF_PUSH ;
2261
2252
task_rq_unlock (rq , p , rf );
2262
2253
2263
2254
stop_one_cpu_nowait (cpu_of (rq ), migration_cpu_stop ,
2264
2255
& pending -> arg , & pending -> stop_work );
2265
2256
2257
+ if (flags & SCA_MIGRATE_ENABLE )
2258
+ return 0 ;
2266
2259
} else {
2267
2260
2268
2261
if (!is_migration_disabled (p )) {
0 commit comments