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

Unified · Split

kernel/sched/core.c+2−7
@@ -1232,13 +1232,8 @@ static void uclamp_fork(struct task_struct *p) · 1231 unmodified lines
12321232 return;
12331233
12341234 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);
12421237 }
12431238 }
12441239

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