sched/walt: Read sysctl_sched_ravg_window_nr_ticks under mutex

When sched_ravg_window_nr_ticks tunable is read and write concurrently,
the read can return the previous value though the write is already
happened. Fix this by reading the sysctl_sched_ravg_window_nr_ticks
value under mutex.

Change-Id: Ie1146c47ac1a184fc8bf4a2824bf6db28fd7156d
Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
This commit is contained in:
Pavankumar Kondeti 2021-04-09 09:43:46 +05:30 committed by Rishabh Bhatnagar
parent 960f8d4f0f
commit 91bd0dce3b

View File

@ -171,7 +171,7 @@ static int sched_ravg_window_handler(struct ctl_table *table,
{
int ret = -EPERM;
static DEFINE_MUTEX(mutex);
int val = sysctl_sched_ravg_window_nr_ticks;
int val;
struct ctl_table tmp = {
.data = &val,
@ -184,6 +184,7 @@ static int sched_ravg_window_handler(struct ctl_table *table,
if (write && HZ != 250)
goto unlock;
val = sysctl_sched_ravg_window_nr_ticks;
ret = proc_dointvec(&tmp, write, buffer, lenp, ppos);
if (ret || !write || (val == sysctl_sched_ravg_window_nr_ticks))
goto unlock;