drm: virtio_gpu: add support for ARGB8888 primary plane
[platform/kernel/linux-rpi.git] / kernel / kthread.c
index 5b37a85..4a4d709 100644 (file)
@@ -270,6 +270,7 @@ EXPORT_SYMBOL_GPL(kthread_parkme);
 
 static int kthread(void *_create)
 {
+       static const struct sched_param param = { .sched_priority = 0 };
        /* Copy data: it's on kthread's stack */
        struct kthread_create_info *create = _create;
        int (*threadfn)(void *data) = create->threadfn;
@@ -300,6 +301,13 @@ static int kthread(void *_create)
        init_completion(&self->parked);
        current->vfork_done = &self->exited;
 
+       /*
+        * The new thread inherited kthreadd's priority and CPU mask. Reset
+        * back to default in case they have been changed.
+        */
+       sched_setscheduler_nocheck(current, SCHED_NORMAL, &param);
+       set_cpus_allowed_ptr(current, housekeeping_cpumask(HK_FLAG_KTHREAD));
+
        /* OK, tell user we're spawned, wait for stop or wakeup */
        __set_current_state(TASK_UNINTERRUPTIBLE);
        create->result = current;
@@ -397,7 +405,6 @@ struct task_struct *__kthread_create_on_node(int (*threadfn)(void *data),
        }
        task = create->result;
        if (!IS_ERR(task)) {
-               static const struct sched_param param = { .sched_priority = 0 };
                char name[TASK_COMM_LEN];
 
                /*
@@ -406,13 +413,6 @@ struct task_struct *__kthread_create_on_node(int (*threadfn)(void *data),
                 */
                vsnprintf(name, sizeof(name), namefmt, args);
                set_task_comm(task, name);
-               /*
-                * root may have changed our (kthreadd's) priority or CPU mask.
-                * The kernel thread should not inherit these properties.
-                */
-               sched_setscheduler_nocheck(task, SCHED_NORMAL, &param);
-               set_cpus_allowed_ptr(task,
-                                    housekeeping_cpumask(HK_FLAG_KTHREAD));
        }
        kfree(create);
        return task;