uclamp_fork() resets the uclamp values to their default when the reset-on-fork flag is set. It also checks whether the task has a RT policy, and sets its uclamp.min to 1024 accordingly. However, during reset-on-fork, the task's policy is lowered to SCHED_NORMAL right after, hence leading to an erroneous uclamp.min setting for the new task if it was forked from RT. Fix this by removing the unnecessary check on rt_task() in uclamp_fork() as this doesn't make sense if the reset-on-fork flag is set.
Showing the changes to kernel (1 of 1 file). Show all
Unified · Split
| @@ -1232,13 +1232,8 @@ static void uclamp_fork(struct task_struct *p) · 1231 unmodified lines | ||
| 1232 | 1232 | return; |
| 1233 | 1233 | |
| 1234 | 1234 | for_each_clamp_id(clamp_id) { |
| 1235 | − unsigned int clamp_value = uclamp_none(clamp_id); | |
| 1236 | − | |
| 1237 | − /* By default, RT tasks always get 100% boost */ | |
| 1238 | − if (unlikely(rt_task(p) && clamp_id == UCLAMP_MIN)) | |
| 1239 | − clamp_value = uclamp_none(UCLAMP_MAX); | |
| 1240 | − | |
| 1241 | − uclamp_se_set(&p->uclamp_req[clamp_id], clamp_value, false); | |
| 1235 | + uclamp_se_set(&p->uclamp_req[clamp_id], | |
| 1236 | + uclamp_none(clamp_id), false); | |
| 1242 | 1237 | } |
| 1243 | 1238 | } |
| 1244 | 1239 | |