android_kernel_lge_bullhead/kernel/sched
Hiroshi Shimamoto 02a092d0ad sched/cputime: Fix invalid gtime in proc
/proc/stats shows invalid gtime when the thread is running in guest.
When vtime accounting is not enabled, we cannot get a valid delta.
The delta is calculated with now - tsk->vtime_snap, but tsk->vtime_snap
is only updated when vtime accounting is runtime enabled.

This patch makes task_gtime() just return gtime without computing the
buggy non-existing tickless delta when vtime accounting is not enabled.

Use context_tracking_is_enabled() to check if vtime is accounting on
some cpu, in which case only we need to check the tickless delta. This
way we fix the gtime value regression on machines not running nohz full.

The kernel config contains CONFIG_VIRT_CPU_ACCOUNTING_GEN=y and
CONFIG_NO_HZ_FULL_ALL=n and boot without nohz_full.

I ran and stop a busy loop in VM and see the gtime in host.
Dump the 43rd field which shows the gtime in every second:

	 # while :; do awk '{print $3" "$43}' /proc/3955/task/4014/stat; sleep 1; done
	S 4348
	R 7064566
	R 7064766
	R 7064967
	R 7065168
	S 4759
	S 4759

During running busy loop, it returns large value.

After applying this patch, we can see right gtime.

	 # while :; do awk '{print $3" "$43}' /proc/10913/task/10956/stat; sleep 1; done
	S 5338
	R 5365
	R 5465
	R 5566
	R 5666
	S 5726
	S 5726

Signed-off-by: Hiroshi Shimamoto <h-shimamoto@ct.jp.nec.com>
Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: Chris Metcalf <cmetcalf@ezchip.com>
Cc: Christoph Lameter <cl@linux.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Luiz Capitulino <lcapitulino@redhat.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul E . McKenney <paulmck@linux.vnet.ibm.com>
Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Rik van Riel <riel@redhat.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/1447948054-28668-2-git-send-email-fweisbec@gmail.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
2019-08-26 16:04:30 +02:00
..
Makefile sched_avg: add run queue averaging 2013-07-08 05:51:38 -07:00
auto_group.c sched/autogroup: Fix race with task_groups list 2014-03-31 09:58:14 -07:00
auto_group.h Revert "sched/autogroup: Fix crash on reboot when autogroup is disabled" 2012-12-11 10:23:45 +01:00
clock.c sched_clock: Prevent 64bit inatomicity on 32bit systems 2013-04-08 11:50:44 +02:00
core.c sched/cputime: Fix prev steal time accouting during CPU hotplug 2019-08-26 16:02:24 +02:00
cpuacct.c sched/cpuacct/UML: Fix header file dependency bug on the UML build 2013-04-10 15:12:41 +02:00
cpuacct.h sched/cpuacct: Initialize root cpuacct earlier 2013-04-10 13:54:20 +02:00
cpupri.c Merge upstream tag 'v3.10.49' into msm-3.10 2014-08-20 13:23:09 -07:00
cpupri.h
cputime.c sched/cputime: Fix invalid gtime in proc 2019-08-26 16:04:30 +02:00
debug.c This is the 3.10.67 stable release 2015-05-01 13:34:57 -07:00
fair.c sched: add sched blocked tracepoint which dumps out context of sleep. 2015-11-19 13:48:15 -08:00
features.h Enable arch power 2019-08-26 15:23:25 +02:00
idle_task.c sched: Consolidate hmp stats into their own struct 2015-01-28 14:13:14 +05:30
rt.c This is the 3.10.67 stable release 2015-05-01 13:34:57 -07:00
sched.h sched/cputime: Fix prev steal time accouting during CPU hotplug 2019-08-26 16:02:24 +02:00
sched_avg.c sched: Keep track of average nr_big_tasks 2015-02-26 10:37:26 -08:00
stats.c fix a leak in /proc/schedstats 2013-04-29 15:41:45 -04:00
stats.h
stop_task.c sched: Consolidate hmp stats into their own struct 2015-01-28 14:13:14 +05:30