Skip to content

Commit eaf5a92

Browse files
Quentin PerretPeter Zijlstra
authored andcommitted
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. Fixes: 1a00d99 ("sched/uclamp: Set default clamps for RT tasks") Reported-by: Chitti Babu Theegala <[email protected]> Signed-off-by: Quentin Perret <[email protected]> Signed-off-by: Peter Zijlstra (Intel) <[email protected]> Reviewed-by: Patrick Bellasi <[email protected]> Reviewed-by: Dietmar Eggemann <[email protected]> Link: https://lkml.kernel.org/r/[email protected]
1 parent db441bd commit eaf5a92

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

kernel/sched/core.c

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1232,13 +1232,8 @@ static void uclamp_fork(struct task_struct *p)
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

0 commit comments

Comments
 (0)