aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--kernel/sched/core.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index ce69fc7eaf19..aae08cedd75e 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -3724,7 +3724,8 @@ out_unlock:
3724 3724
3725void set_user_nice(struct task_struct *p, long nice) 3725void set_user_nice(struct task_struct *p, long nice)
3726{ 3726{
3727 int old_prio, delta, queued; 3727 bool queued, running;
3728 int old_prio, delta;
3728 struct rq_flags rf; 3729 struct rq_flags rf;
3729 struct rq *rq; 3730 struct rq *rq;
3730 3731
@@ -3746,8 +3747,11 @@ void set_user_nice(struct task_struct *p, long nice)
3746 goto out_unlock; 3747 goto out_unlock;
3747 } 3748 }
3748 queued = task_on_rq_queued(p); 3749 queued = task_on_rq_queued(p);
3750 running = task_current(rq, p);
3749 if (queued) 3751 if (queued)
3750 dequeue_task(rq, p, DEQUEUE_SAVE); 3752 dequeue_task(rq, p, DEQUEUE_SAVE);
3753 if (running)
3754 put_prev_task(rq, p);
3751 3755
3752 p->static_prio = NICE_TO_PRIO(nice); 3756 p->static_prio = NICE_TO_PRIO(nice);
3753 set_load_weight(p); 3757 set_load_weight(p);
@@ -3764,6 +3768,8 @@ void set_user_nice(struct task_struct *p, long nice)
3764 if (delta < 0 || (delta > 0 && task_running(rq, p))) 3768 if (delta < 0 || (delta > 0 && task_running(rq, p)))
3765 resched_curr(rq); 3769 resched_curr(rq);
3766 } 3770 }
3771 if (running)
3772 set_curr_task(rq, p);
3767out_unlock: 3773out_unlock:
3768 task_rq_unlock(rq, p, &rf); 3774 task_rq_unlock(rq, p, &rf);
3769} 3775}