lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Wed, 14 Sep 2011 17:04:54 -0300
From:	Glauber Costa <glommer@...allels.com>
To:	linux-kernel@...r.kernel.org
Cc:	xemul@...allels.com, paul@...lmenage.org, lizf@...fujitsu.com,
	daniel.lezcano@...e.fr, mingo@...e.hu, a.p.zijlstra@...llo.nl,
	jbottomley@...allels.com, Glauber Costa <glommer@...allels.com>
Subject: [PATCH 8/9] per-cgroup boot time

Record the time in which the cgroup was created. This can be
used to provide a more accurate boottime information in
cpuacct.proc.stat.

Signed-off-by: Glauber Costa <glommer@...allels.com>
---
 kernel/sched.c |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/kernel/sched.c b/kernel/sched.c
index 4611c54..8f254d0 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -9120,6 +9120,7 @@ struct cpuacct {
 	/* cpuusage holds pointer to a u64-type object on every cpu */
 	u64 __percpu *cpuusage;
 	u64 __percpu *cpustat;
+	struct timespec start_time;
 };
 
 struct cgroup_subsys cpuacct_subsys;
@@ -9172,6 +9173,8 @@ static struct cgroup_subsys_state *cpuacct_create(
 		acct[CPUACCT_STAT_IDLE] = kstat_cpu(i).cpustat.idle;
 		acct[CPUACCT_STAT_IOWAIT] = kstat_cpu(i).cpustat.iowait;
 	}
+
+	get_monotonic_boottime(&ca->start_time);
 	return &ca->css;
 
 out_free_usage:
@@ -9316,13 +9319,16 @@ static int cpuacct_proc_stat(struct cgroup *cgrp, struct cftype *cft,
 	unsigned int per_softirq_sums[NR_SOFTIRQS] = {0};
 	struct timespec boottime;
 	struct cpuacct *ca = cgroup_ca(cgrp);
+	struct timespec ts;
 	u64 *cpustat;
 
 	user = nice = system = idle = iowait =
 		irq = softirq = steal = cputime64_zero;
 	guest = guest_nice = cputime64_zero;
 	getboottime(&boottime);
-	jif = boottime.tv_sec;
+	getboottime(&boottime);
+	ts = timespec_add(boottime, ca->start_time);
+	jif = ts.tv_sec;
 
 	for_each_possible_cpu(i) {
 		cpustat = per_cpu_ptr(ca->cpustat, i);
-- 
1.7.6

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ