~ubuntu-branches/ubuntu/trusty/linux-lts-xenial/trusty-proposed

« back to all changes in this revision

Viewing changes to kernel/sched/fair.c

  • Committer: Package Import Robot
  • Author(s): Brad Figg
  • Date: 2016-03-17 09:18:22 UTC
  • Revision ID: package-import@ubuntu.com-20160317091822-1sqft3zxoyt9tumu
Tags: 4.4.0-14.30~14.04.2
* Release Tracking Bug (LP: #1558247)

* Current 4.4 kernel won't boot on powerpc (LP: #1557130)
  - powerpc: Fix dedotify for binutils >= 2.26

* ZFS: send fails to transmit some holes [corruption] (LP: #1557151)
  - Illumos 6370 - ZFS send fails to transmit some holes

* Request to cherry-pick uvcvideo patch for Xenial kernel support of RealSense
  camera (LP: #1557138)
  - UVC: Add support for ds4 depth camera

* use after free of task_struct->numa_faults in task_numa_find_cpu (LP: #1527643)
  - sched/numa: Fix use-after-free bug in the task_numa_compare

* overlay fs regression: chmod fails with "Operation not permitted" on chowned
  files (LP: #1555997)
  - ovl: copy new uid/gid into overlayfs runtime inode

* Miscellaneous Ubuntu changes
  - SAUCE: Dump stack when X.509 certificates cannot be loaded

Show diffs side-by-side

added added

removed removed

Lines of Context:
1193
1193
{
1194
1194
        if (env->best_task)
1195
1195
                put_task_struct(env->best_task);
1196
 
        if (p)
1197
 
                get_task_struct(p);
1198
1196
 
1199
1197
        env->best_task = p;
1200
1198
        env->best_imp = imp;
1262
1260
        long imp = env->p->numa_group ? groupimp : taskimp;
1263
1261
        long moveimp = imp;
1264
1262
        int dist = env->dist;
 
1263
        bool assigned = false;
1265
1264
 
1266
1265
        rcu_read_lock();
1267
1266
 
1268
1267
        raw_spin_lock_irq(&dst_rq->lock);
1269
1268
        cur = dst_rq->curr;
1270
1269
        /*
1271
 
         * No need to move the exiting task, and this ensures that ->curr
1272
 
         * wasn't reaped and thus get_task_struct() in task_numa_assign()
1273
 
         * is safe under RCU read lock.
1274
 
         * Note that rcu_read_lock() itself can't protect from the final
1275
 
         * put_task_struct() after the last schedule().
 
1270
         * No need to move the exiting task or idle task.
1276
1271
         */
1277
1272
        if ((cur->flags & PF_EXITING) || is_idle_task(cur))
1278
1273
                cur = NULL;
 
1274
        else {
 
1275
                /*
 
1276
                 * The task_struct must be protected here to protect the
 
1277
                 * p->numa_faults access in the task_weight since the
 
1278
                 * numa_faults could already be freed in the following path:
 
1279
                 * finish_task_switch()
 
1280
                 *     --> put_task_struct()
 
1281
                 *         --> __put_task_struct()
 
1282
                 *             --> task_numa_free()
 
1283
                 */
 
1284
                get_task_struct(cur);
 
1285
        }
 
1286
 
1279
1287
        raw_spin_unlock_irq(&dst_rq->lock);
1280
1288
 
1281
1289
        /*
1359
1367
                 */
1360
1368
                if (!load_too_imbalanced(src_load, dst_load, env)) {
1361
1369
                        imp = moveimp - 1;
 
1370
                        put_task_struct(cur);
1362
1371
                        cur = NULL;
1363
1372
                        goto assign;
1364
1373
                }
1384
1393
                env->dst_cpu = select_idle_sibling(env->p, env->dst_cpu);
1385
1394
 
1386
1395
assign:
 
1396
        assigned = true;
1387
1397
        task_numa_assign(env, cur, imp);
1388
1398
unlock:
1389
1399
        rcu_read_unlock();
 
1400
        /*
 
1401
         * The dst_rq->curr isn't assigned. The protection for task_struct is
 
1402
         * finished.
 
1403
         */
 
1404
        if (cur && !assigned)
 
1405
                put_task_struct(cur);
1390
1406
}
1391
1407
 
1392
1408
static void task_numa_find_cpu(struct task_numa_env *env,