* se we pin us down to CPU 0 for a short while
         */
        alloc_cpumask_var(&old_mask, GFP_NOWAIT);
-       cpumask_copy(old_mask, tsk_cpus_allowed(current));
+       cpumask_copy(old_mask, ¤t->cpus_allowed);
        set_cpus_allowed_ptr(current, cpumask_of(boot_cpuid));
        
        if (smp_ops && smp_ops->setup_cpu)
 
         * runqueue. The context will be rescheduled on the proper node
         * if it is timesliced or preempted.
         */
-       cpumask_copy(&ctx->cpus_allowed, tsk_cpus_allowed(current));
+       cpumask_copy(&ctx->cpus_allowed, ¤t->cpus_allowed);
 
        /* Save the current cpu id for spu interrupt routing. */
        ctx->last_ran = raw_smp_processor_id();
 
        cpumask_t old_affinity;
        unsigned long ret;
 
-       cpumask_copy(&old_affinity, tsk_cpus_allowed(current));
+       cpumask_copy(&old_affinity, ¤t->cpus_allowed);
        /* should return -EINVAL to userspace */
        if (set_cpus_allowed_ptr(current, cpumask_of(cpu)))
                return 0;
 
        cpumask_t cpus_allowed;
        unsigned long clock_tick, estar;
 
-       cpumask_copy(&cpus_allowed, tsk_cpus_allowed(current));
+       cpumask_copy(&cpus_allowed, ¤t->cpus_allowed);
        set_cpus_allowed_ptr(current, cpumask_of(cpu));
 
        clock_tick = sparc64_get_clock_tick(cpu) / 1000;
        unsigned long clock_tick, divisor, old_divisor, estar;
        cpumask_t cpus_allowed;
 
-       cpumask_copy(&cpus_allowed, tsk_cpus_allowed(current));
+       cpumask_copy(&cpus_allowed, ¤t->cpus_allowed);
        set_cpus_allowed_ptr(current, cpumask_of(cpu));
 
        new_freq = clock_tick = sparc64_get_clock_tick(cpu) / 1000;
 
        unsigned long reg;
        unsigned int ret;
 
-       cpumask_copy(&cpus_allowed, tsk_cpus_allowed(current));
+       cpumask_copy(&cpus_allowed, ¤t->cpus_allowed);
        set_cpus_allowed_ptr(current, cpumask_of(cpu));
 
        reg = read_safari_cfg();
        unsigned long new_bits, new_freq, reg;
        cpumask_t cpus_allowed;
 
-       cpumask_copy(&cpus_allowed, tsk_cpus_allowed(current));
+       cpumask_copy(&cpus_allowed, ¤t->cpus_allowed);
        set_cpus_allowed_ptr(current, cpumask_of(cpu));
 
        new_freq = sparc64_get_clock_tick(cpu) / 1000;
 
        struct hfi1_affinity_node *entry;
        cpumask_var_t diff, hw_thread_mask, available_mask, intrs_mask;
        const struct cpumask *node_mask,
-               *proc_mask = tsk_cpus_allowed(current);
+               *proc_mask = ¤t->cpus_allowed;
        struct hfi1_affinity_node_list *affinity = &node_affinity;
        struct cpu_mask_set *set = &affinity->proc;
 
 
 {
        struct sdma_rht_node *rht_node;
        struct sdma_engine *sde = NULL;
-       const struct cpumask *current_mask = tsk_cpus_allowed(current);
+       const struct cpumask *current_mask = ¤t->cpus_allowed;
        unsigned long cpu_id;
 
        /*
 
 }
 #endif
 
-/* Future-safe accessor for struct task_struct's cpus_allowed. */
-#define tsk_cpus_allowed(tsk) (&(tsk)->cpus_allowed)
-
 static inline int tsk_nr_cpus_allowed(struct task_struct *p)
 {
        return p->nr_cpus_allowed;
 
                return rq;
 
        /* Affinity changed (again). */
-       if (!cpumask_test_cpu(dest_cpu, tsk_cpus_allowed(p)))
+       if (!cpumask_test_cpu(dest_cpu, &p->cpus_allowed))
                return rq;
 
        rq = move_queued_task(rq, p, dest_cpu);
        if (task_cpu(arg->src_task) != arg->src_cpu)
                goto unlock;
 
-       if (!cpumask_test_cpu(arg->dst_cpu, tsk_cpus_allowed(arg->src_task)))
+       if (!cpumask_test_cpu(arg->dst_cpu, &arg->src_task->cpus_allowed))
                goto unlock;
 
-       if (!cpumask_test_cpu(arg->src_cpu, tsk_cpus_allowed(arg->dst_task)))
+       if (!cpumask_test_cpu(arg->src_cpu, &arg->dst_task->cpus_allowed))
                goto unlock;
 
        __migrate_swap_task(arg->src_task, arg->dst_cpu);
        if (!cpu_active(arg.src_cpu) || !cpu_active(arg.dst_cpu))
                goto out;
 
-       if (!cpumask_test_cpu(arg.dst_cpu, tsk_cpus_allowed(arg.src_task)))
+       if (!cpumask_test_cpu(arg.dst_cpu, &arg.src_task->cpus_allowed))
                goto out;
 
-       if (!cpumask_test_cpu(arg.src_cpu, tsk_cpus_allowed(arg.dst_task)))
+       if (!cpumask_test_cpu(arg.src_cpu, &arg.dst_task->cpus_allowed))
                goto out;
 
        trace_sched_swap_numa(cur, arg.src_cpu, p, arg.dst_cpu);
                for_each_cpu(dest_cpu, nodemask) {
                        if (!cpu_active(dest_cpu))
                                continue;
-                       if (cpumask_test_cpu(dest_cpu, tsk_cpus_allowed(p)))
+                       if (cpumask_test_cpu(dest_cpu, &p->cpus_allowed))
                                return dest_cpu;
                }
        }
 
        for (;;) {
                /* Any allowed, online CPU? */
-               for_each_cpu(dest_cpu, tsk_cpus_allowed(p)) {
+               for_each_cpu(dest_cpu, &p->cpus_allowed) {
                        if (!(p->flags & PF_KTHREAD) && !cpu_active(dest_cpu))
                                continue;
                        if (!cpu_online(dest_cpu))
        if (tsk_nr_cpus_allowed(p) > 1)
                cpu = p->sched_class->select_task_rq(p, cpu, sd_flags, wake_flags);
        else
-               cpu = cpumask_any(tsk_cpus_allowed(p));
+               cpu = cpumask_any(&p->cpus_allowed);
 
        /*
         * In order not to call set_task_cpu() on a blocking task we need
         * [ this allows ->select_task() to simply return task_cpu(p) and
         *   not worry about this generic constraint ]
         */
-       if (unlikely(!cpumask_test_cpu(cpu, tsk_cpus_allowed(p)) ||
+       if (unlikely(!cpumask_test_cpu(cpu, &p->cpus_allowed) ||
                     !cpu_online(cpu)))
                cpu = select_fallback_rq(task_cpu(p), p);
 
        if (curr_cpu == target_cpu)
                return 0;
 
-       if (!cpumask_test_cpu(target_cpu, tsk_cpus_allowed(p)))
+       if (!cpumask_test_cpu(target_cpu, &p->cpus_allowed))
                return -EINVAL;
 
        /* TODO: This is not properly updating schedstats */
 
        const struct sched_dl_entity *dl_se = &p->dl;
 
        if (later_mask &&
-           cpumask_and(later_mask, cp->free_cpus, tsk_cpus_allowed(p))) {
+           cpumask_and(later_mask, cp->free_cpus, &p->cpus_allowed)) {
                best_cpu = cpumask_any(later_mask);
                goto out;
-       } else if (cpumask_test_cpu(cpudl_maximum(cp), tsk_cpus_allowed(p)) &&
+       } else if (cpumask_test_cpu(cpudl_maximum(cp), &p->cpus_allowed) &&
                        dl_time_before(dl_se->deadline, cp->elements[0].dl)) {
                best_cpu = cpudl_maximum(cp);
                if (later_mask)
 
                if (skip)
                        continue;
 
-               if (cpumask_any_and(tsk_cpus_allowed(p), vec->mask) >= nr_cpu_ids)
+               if (cpumask_any_and(&p->cpus_allowed, vec->mask) >= nr_cpu_ids)
                        continue;
 
                if (lowest_mask) {
-                       cpumask_and(lowest_mask, tsk_cpus_allowed(p), vec->mask);
+                       cpumask_and(lowest_mask, &p->cpus_allowed, vec->mask);
 
                        /*
                         * We have to ensure that we have at least one bit
 
                 * If we cannot preempt any rq, fall back to pick any
                 * online cpu.
                 */
-               cpu = cpumask_any_and(cpu_active_mask, tsk_cpus_allowed(p));
+               cpu = cpumask_any_and(cpu_active_mask, &p->cpus_allowed);
                if (cpu >= nr_cpu_ids) {
                        /*
                         * Fail to find any suitable cpu.
 static int pick_dl_task(struct rq *rq, struct task_struct *p, int cpu)
 {
        if (!task_running(rq, p) &&
-           cpumask_test_cpu(cpu, tsk_cpus_allowed(p)))
+           cpumask_test_cpu(cpu, &p->cpus_allowed))
                return 1;
        return 0;
 }
                /* Retry if something changed. */
                if (double_lock_balance(rq, later_rq)) {
                        if (unlikely(task_rq(task) != rq ||
-                                    !cpumask_test_cpu(later_rq->cpu,
-                                                      tsk_cpus_allowed(task)) ||
+                                    !cpumask_test_cpu(later_rq->cpu, &task->cpus_allowed) ||
                                     task_running(rq, task) ||
                                     !dl_task(task) ||
                                     !task_on_rq_queued(task))) {
 
         */
        if (cur) {
                /* Skip this swap candidate if cannot move to the source cpu */
-               if (!cpumask_test_cpu(env->src_cpu, tsk_cpus_allowed(cur)))
+               if (!cpumask_test_cpu(env->src_cpu, &cur->cpus_allowed))
                        goto unlock;
 
                /*
 
        for_each_cpu(cpu, cpumask_of_node(env->dst_nid)) {
                /* Skip this CPU if the source task cannot migrate */
-               if (!cpumask_test_cpu(cpu, tsk_cpus_allowed(env->p)))
+               if (!cpumask_test_cpu(cpu, &env->p->cpus_allowed))
                        continue;
 
                env->dst_cpu = cpu;
 
                /* Skip over this group if it has no CPUs allowed */
                if (!cpumask_intersects(sched_group_cpus(group),
-                                       tsk_cpus_allowed(p)))
+                                       &p->cpus_allowed))
                        continue;
 
                local_group = cpumask_test_cpu(this_cpu,
                return cpumask_first(sched_group_cpus(group));
 
        /* Traverse only the allowed CPUs */
-       for_each_cpu_and(i, sched_group_cpus(group), tsk_cpus_allowed(p)) {
+       for_each_cpu_and(i, sched_group_cpus(group), &p->cpus_allowed) {
                if (idle_cpu(i)) {
                        struct rq *rq = cpu_rq(i);
                        struct cpuidle_state *idle = idle_get_state(rq);
        if (!test_idle_cores(target, false))
                return -1;
 
-       cpumask_and(cpus, sched_domain_span(sd), tsk_cpus_allowed(p));
+       cpumask_and(cpus, sched_domain_span(sd), &p->cpus_allowed);
 
        for_each_cpu_wrap(core, cpus, target, wrap) {
                bool idle = true;
                return -1;
 
        for_each_cpu(cpu, cpu_smt_mask(target)) {
-               if (!cpumask_test_cpu(cpu, tsk_cpus_allowed(p)))
+               if (!cpumask_test_cpu(cpu, &p->cpus_allowed))
                        continue;
                if (idle_cpu(cpu))
                        return cpu;
        time = local_clock();
 
        for_each_cpu_wrap(cpu, sched_domain_span(sd), target, wrap) {
-               if (!cpumask_test_cpu(cpu, tsk_cpus_allowed(p)))
+               if (!cpumask_test_cpu(cpu, &p->cpus_allowed))
                        continue;
                if (idle_cpu(cpu))
                        break;
        if (sd_flag & SD_BALANCE_WAKE) {
                record_wakee(p);
                want_affine = !wake_wide(p) && !wake_cap(p, cpu, prev_cpu)
-                             && cpumask_test_cpu(cpu, tsk_cpus_allowed(p));
+                             && cpumask_test_cpu(cpu, &p->cpus_allowed);
        }
 
        rcu_read_lock();
        if (throttled_lb_pair(task_group(p), env->src_cpu, env->dst_cpu))
                return 0;
 
-       if (!cpumask_test_cpu(env->dst_cpu, tsk_cpus_allowed(p))) {
+       if (!cpumask_test_cpu(env->dst_cpu, &p->cpus_allowed)) {
                int cpu;
 
                schedstat_inc(p->se.statistics.nr_failed_migrations_affine);
 
                /* Prevent to re-select dst_cpu via env's cpus */
                for_each_cpu_and(cpu, env->dst_grpmask, env->cpus) {
-                       if (cpumask_test_cpu(cpu, tsk_cpus_allowed(p))) {
+                       if (cpumask_test_cpu(cpu, &p->cpus_allowed)) {
                                env->flags |= LBF_DST_PINNED;
                                env->new_dst_cpu = cpu;
                                break;
 
 /*
  * Group imbalance indicates (and tries to solve) the problem where balancing
- * groups is inadequate due to tsk_cpus_allowed() constraints.
+ * groups is inadequate due to ->cpus_allowed constraints.
  *
  * Imagine a situation of two groups of 4 cpus each and 4 tasks each with a
  * cpumask covering 1 cpu of the first group and 3 cpus of the second group.
                         * if the curr task on busiest cpu can't be
                         * moved to this_cpu
                         */
-                       if (!cpumask_test_cpu(this_cpu,
-                                       tsk_cpus_allowed(busiest->curr))) {
+                       if (!cpumask_test_cpu(this_cpu, &busiest->curr->cpus_allowed)) {
                                raw_spin_unlock_irqrestore(&busiest->lock,
                                                            flags);
                                env.flags |= LBF_ALL_PINNED;
 
 static int pick_rt_task(struct rq *rq, struct task_struct *p, int cpu)
 {
        if (!task_running(rq, p) &&
-           cpumask_test_cpu(cpu, tsk_cpus_allowed(p)))
+           cpumask_test_cpu(cpu, &p->cpus_allowed))
                return 1;
        return 0;
 }
                         * Also make sure that it wasn't scheduled on its rq.
                         */
                        if (unlikely(task_rq(task) != rq ||
-                                    !cpumask_test_cpu(lowest_rq->cpu,
-                                                      tsk_cpus_allowed(task)) ||
+                                    !cpumask_test_cpu(lowest_rq->cpu, &task->cpus_allowed) ||
                                     task_running(rq, task) ||
                                     !rt_task(task) ||
                                     !task_on_rq_queued(task))) {
 
         * Kernel threads bound to a single CPU can safely use
         * smp_processor_id():
         */
-       if (cpumask_equal(tsk_cpus_allowed(current), cpumask_of(this_cpu)))
+       if (cpumask_equal(¤t->cpus_allowed, cpumask_of(this_cpu)))
                goto out;
 
        /*
 
 
        /* Silly tracepoints */
        trace_foo_bar("hello", cnt, array, random_strings[len],
-                     tsk_cpus_allowed(current));
+                     ¤t->cpus_allowed);
 
        trace_foo_with_template_simple("HELLO", cnt);