Re: [PATCH v7 06/15] sched/core: uclamp: Reset uclamp values on RESET_ON_FORK
From: Peter Zijlstra <peterz@infradead.org>
Date: 2019-03-13 20:52:52
Also in:
linux-pm, lkml
From: Peter Zijlstra <peterz@infradead.org>
Date: 2019-03-13 20:52:52
Also in:
linux-pm, lkml
On Fri, Feb 08, 2019 at 10:05:45AM +0000, Patrick Bellasi wrote:
diff --git a/kernel/sched/core.c b/kernel/sched/core.c index 070caa1f72eb..8b282616e9c9 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c@@ -1071,7 +1071,7 @@ static void __setscheduler_uclamp(struct task_struct *p, } } -static void uclamp_fork(struct task_struct *p) +static void uclamp_fork(struct task_struct *p, bool reset) { unsigned int clamp_id;@@ -1080,6 +1080,17 @@ static void uclamp_fork(struct task_struct *p)
IIRC there's an early return here if the class doesn't have uclamp support, which I think is wrong now. You want the reset irrespective of whether the class supports it, no?
for (clamp_id = 0; clamp_id < UCLAMP_CNT; ++clamp_id)
p->uclamp[clamp_id].active = false;
+
+ if (likely(!reset))
+ return;
+
+ for (clamp_id = 0; clamp_id < UCLAMP_CNT; ++clamp_id) {
+ unsigned int clamp_value = uclamp_none(clamp_id);
+
+ p->uclamp[clamp_id].user_defined = false;
+ p->uclamp[clamp_id].value = clamp_value;
+ p->uclamp[clamp_id].bucket_id = uclamp_bucket_id(clamp_value);
+ }
}