* sched_class::set_cpus_allowed must do the below, but is not required to
  * actually call this function.
  */
-void set_cpus_allowed_common(struct task_struct *p, const struct cpumask *new_mask)
+void set_cpus_allowed_common(struct task_struct *p, const struct cpumask *new_mask, u32 flags)
 {
        cpumask_copy(&p->cpus_mask, new_mask);
        p->nr_cpus_allowed = cpumask_weight(new_mask);
 }
 
-void do_set_cpus_allowed(struct task_struct *p, const struct cpumask *new_mask)
+static void
+__do_set_cpus_allowed(struct task_struct *p, const struct cpumask *new_mask, u32 flags)
 {
        struct rq *rq = task_rq(p);
        bool queued, running;
        if (running)
                put_prev_task(rq, p);
 
-       p->sched_class->set_cpus_allowed(p, new_mask);
+       p->sched_class->set_cpus_allowed(p, new_mask, flags);
 
        if (queued)
                enqueue_task(rq, p, ENQUEUE_RESTORE | ENQUEUE_NOCLOCK);
                set_next_task(rq, p);
 }
 
+void do_set_cpus_allowed(struct task_struct *p, const struct cpumask *new_mask)
+{
+       __do_set_cpus_allowed(p, new_mask, 0);
+}
+
 /*
  * Change a given task's CPU affinity. Migrate the thread to a
  * proper CPU and schedule it away if the CPU it's executing on
  * call is not atomic; no spinlocks may be held.
  */
 static int __set_cpus_allowed_ptr(struct task_struct *p,
-                                 const struct cpumask *new_mask, bool check)
+                                 const struct cpumask *new_mask,
+                                 u32 flags)
 {
        const struct cpumask *cpu_valid_mask = cpu_active_mask;
        unsigned int dest_cpu;
         * Must re-check here, to close a race against __kthread_bind(),
         * sched_setaffinity() is not guaranteed to observe the flag.
         */
-       if (check && (p->flags & PF_NO_SETAFFINITY)) {
+       if ((flags & SCA_CHECK) && (p->flags & PF_NO_SETAFFINITY)) {
                ret = -EINVAL;
                goto out;
        }
                goto out;
        }
 
-       do_set_cpus_allowed(p, new_mask);
+       __do_set_cpus_allowed(p, new_mask, flags);
 
        if (p->flags & PF_KTHREAD) {
                /*
 
 int set_cpus_allowed_ptr(struct task_struct *p, const struct cpumask *new_mask)
 {
-       return __set_cpus_allowed_ptr(p, new_mask, false);
+       return __set_cpus_allowed_ptr(p, new_mask, 0);
 }
 EXPORT_SYMBOL_GPL(set_cpus_allowed_ptr);
 
 #else
 
 static inline int __set_cpus_allowed_ptr(struct task_struct *p,
-                                        const struct cpumask *new_mask, bool check)
+                                        const struct cpumask *new_mask,
+                                        u32 flags)
 {
        return set_cpus_allowed_ptr(p, new_mask);
 }
        }
 #endif
 again:
-       retval = __set_cpus_allowed_ptr(p, new_mask, true);
+       retval = __set_cpus_allowed_ptr(p, new_mask, SCA_CHECK);
 
        if (!retval) {
                cpuset_cpus_allowed(p, cpus_allowed);
         *
         * And since this is boot we can forgo the serialization.
         */
-       set_cpus_allowed_common(idle, cpumask_of(cpu));
+       set_cpus_allowed_common(idle, cpumask_of(cpu), 0);
 #endif
        /*
         * We're having a chicken and egg problem, even though we are
 
        void (*task_woken)(struct rq *this_rq, struct task_struct *task);
 
        void (*set_cpus_allowed)(struct task_struct *p,
-                                const struct cpumask *newmask);
+                                const struct cpumask *newmask,
+                                u32 flags);
 
        void (*rq_online)(struct rq *rq);
        void (*rq_offline)(struct rq *rq);
 
 extern void trigger_load_balance(struct rq *rq);
 
-extern void set_cpus_allowed_common(struct task_struct *p, const struct cpumask *new_mask);
+#define SCA_CHECK              0x01
+
+extern void set_cpus_allowed_common(struct task_struct *p, const struct cpumask *new_mask, u32 flags);
 
 #endif