History

sched/core: Fix reset-on-fork from RT with uclamp

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.

Quentin Perret committed 6 years ago

Commit eaf5a921 parent db441bd1 file · +2 −7Browse files

Showing the changes to kernel (1 of 1 file). Show all

Unified · Split

kernel/sched/core.c+2−7
@@ -1232,13 +1232,8 @@ static void uclamp_fork(struct task_struct *p) · 1231 unmodified lines
1232 return;1232 return;
1233 1233
1234 for_each_clamp_id(clamp_id) {1234 for_each_clamp_id(clamp_id) {
1235 unsigned int clamp_value = uclamp_none(clamp_id);1235 uclamp_se_set(&p->uclamp_req[clamp_id],
1236 1236 uclamp_none(clamp_id), false);
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);
1242 }1237 }
1243}1238}
1244 1239

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t