summaryrefslogtreecommitdiff
path: root/lib/interval_tree_test.c
diff options
context:
space:
mode:
authorFrederic Weisbecker <frederic@kernel.org>2019-09-26 00:42:42 +0300
committerIngo Molnar <mingo@kernel.org>2019-10-09 13:38:03 +0300
commit68e7a4d66b0ce04bf18ff2ffded5596ab3618585 (patch)
treed6f8e254d87856ab2ce6d8c1800a26ab3ef8cce2 /lib/interval_tree_test.c
parent4929a4e6faa0f13289a67cae98139e727f0d4a97 (diff)
downloadlinux-68e7a4d66b0ce04bf18ff2ffded5596ab3618585.tar.xz
sched/vtime: Fix guest/system mis-accounting on task switch
vtime_account_system() assumes that the target task to account cputime to is always the current task. This is most often true indeed except on task switch where we call: vtime_common_task_switch(prev) vtime_account_system(prev) Here prev is the scheduling-out task where we account the cputime to. It doesn't match current that is already the scheduling-in task at this stage of the context switch. So we end up checking the wrong task flags to determine if we are accounting guest or system time to the previous task. As a result the wrong task is used to check if the target is running in guest mode. We may then spuriously account or leak either system or guest time on task switch. Fix this assumption and also turn vtime_guest_enter/exit() to use the task passed in parameter as well to avoid future similar issues. Signed-off-by: Frederic Weisbecker <frederic@kernel.org> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Rik van Riel <riel@redhat.com> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Wanpeng Li <wanpengli@tencent.com> Fixes: 2a42eb9594a1 ("sched/cputime: Accumulate vtime on top of nsec clocksource") Link: https://lkml.kernel.org/r/20190925214242.21873-1-frederic@kernel.org Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'lib/interval_tree_test.c')
0 files changed, 0 insertions, 0 deletions