summaryrefslogtreecommitdiff
path: root/kernel/sched
diff options
context:
space:
mode:
authorJoonwoo Park <joonwoop@codeaurora.org>2016-11-03 17:26:32 -0700
committerJoonwoo Park <joonwoop@codeaurora.org>2016-11-04 17:25:30 -0700
commitdfb9634d037fefd3496161959bf7a4a0ad4e59d5 (patch)
tree6946861a4b29b88ed9d88520776a08c3865e7965 /kernel/sched
parent758693b4a6d94a0724081578d24f6ba1cc449255 (diff)
sched: prevent race between disable window statistics and task grouping
Change of colocation group requires to finish CPU busy time accounting prior to its operation by calling update_task_ravg(). However when window statistics accounting is disabled, update_task_ravg() acts as nop and results in incorrect CPU time accounting. Disallow colocation group change while window statistics accounting is disabled in order to prevent race between reset_all_window_stats() and colocation grouping functions. Change-Id: I6dfa20b8d8b0ae7ccc94119bf9cf14c5e11a1cf7 Signed-off-by: Joonwoo Park <joonwoop@codeaurora.org>
Diffstat (limited to 'kernel/sched')
-rw-r--r--kernel/sched/hmp.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/kernel/sched/hmp.c b/kernel/sched/hmp.c
index 56f4c60d4d5d..627da2346337 100644
--- a/kernel/sched/hmp.c
+++ b/kernel/sched/hmp.c
@@ -3150,14 +3150,14 @@ void reset_all_window_stats(u64 window_start, unsigned int window_size)
unsigned int old = 0, new = 0;
struct related_thread_group *grp;
+ read_lock(&related_thread_group_lock);
+
disable_window_stats();
reset_all_task_stats();
local_irq_save(flags);
- read_lock(&related_thread_group_lock);
-
for_each_possible_cpu(cpu)
raw_spin_lock(&cpu_rq(cpu)->lock);
@@ -3223,10 +3223,10 @@ void reset_all_window_stats(u64 window_start, unsigned int window_size)
for_each_possible_cpu(cpu)
raw_spin_unlock(&cpu_rq(cpu)->lock);
- read_unlock(&related_thread_group_lock);
-
local_irq_restore(flags);
+ read_unlock(&related_thread_group_lock);
+
trace_sched_reset_all_window_stats(window_start, window_size,
sched_ktime_clock() - start_ts, reason, old, new);
}