sched: Fix sched_setparam() policy == -1 logic
[platform/adaptation/renesas_rcar/renesas_kernel.git] / kernel / sched / core.c
index 0aae0fc..677ebad 100644 (file)
@@ -1322,7 +1322,7 @@ out:
                 * leave kernel.
                 */
                if (p->mm && printk_ratelimit()) {
-                       printk_sched("process %d (%s) no longer affine to cpu%d\n",
+                       printk_deferred("process %d (%s) no longer affine to cpu%d\n",
                                        task_pid_nr(p), p->comm, cpu);
                }
        }
@@ -3511,9 +3511,10 @@ static int _sched_setscheduler(struct task_struct *p, int policy,
        };
 
        /*
-        * Fixup the legacy SCHED_RESET_ON_FORK hack
+        * Fixup the legacy SCHED_RESET_ON_FORK hack, except if
+        * the policy=-1 was passed by sched_setparam().
         */
-       if (policy & SCHED_RESET_ON_FORK) {
+       if ((policy != -1) && (policy & SCHED_RESET_ON_FORK)) {
                attr.sched_flags |= SCHED_FLAG_RESET_ON_FORK;
                policy &= ~SCHED_RESET_ON_FORK;
                attr.sched_policy = policy;