diff options
author | Amit Pundir <amit.pundir@linaro.org> | 2017-04-20 22:02:26 +0530 |
---|---|---|
committer | Amit Pundir <amit.pundir@linaro.org> | 2017-07-17 10:35:21 +0530 |
commit | a848a164cf39aab5bfbc6e9a39f78b835cfa410c (patch) | |
tree | 5ed8c09a6dcd8f2862324f6ca90509717b84c7ed | |
parent | 9f418646a0585d443886b55e315c35e56cc8ddb7 (diff) | |
download | linaro-android-a848a164cf39aab5bfbc6e9a39f78b835cfa410c.tar.gz |
ANDROID: uid_sys_stats: Remove obsolete cputime type and helpers
Upstream commit 605dc2b31a2a ("tsacct: Convert obsolete cputime
type to nsecs") made cputime_t type obsolete, use u64 nanoseconds
directly instead.
cputime_to_jiffies() is obsolete too. See upstream commit
f22d6df0b23e ("sched/cputime: Remove jiffies based cputime") for
reference. Thought of using nsecs_to_jiffies() instead but I think
replacing jiffies_to_msecs(nsecs_to_jiffies()) with ktime_to_ms()
to convert nsecs to msecs directly make more sense.
Signed-off-by: Amit Pundir <amit.pundir@linaro.org>
-rw-r--r-- | drivers/misc/uid_sys_stats.c | 25 |
1 files changed, 11 insertions, 14 deletions
diff --git a/drivers/misc/uid_sys_stats.c b/drivers/misc/uid_sys_stats.c index 8bf4c57dba5c..6d58eb0120f6 100644 --- a/drivers/misc/uid_sys_stats.c +++ b/drivers/misc/uid_sys_stats.c @@ -22,7 +22,7 @@ #include <linux/proc_fs.h> #include <linux/profile.h> #include <linux/rtmutex.h> -#include <linux/sched.h> +#include <linux/sched/cputime.h> #include <linux/seq_file.h> #include <linux/slab.h> #include <linux/uaccess.h> @@ -55,10 +55,10 @@ struct io_stats { struct uid_entry { uid_t uid; - cputime_t utime; - cputime_t stime; - cputime_t active_utime; - cputime_t active_stime; + u64 utime; + u64 stime; + u64 active_utime; + u64 active_stime; int state; struct io_stats io[UID_STATE_SIZE]; struct hlist_node hash; @@ -98,8 +98,8 @@ static int uid_cputime_show(struct seq_file *m, void *v) struct uid_entry *uid_entry = NULL; struct task_struct *task, *temp; struct user_namespace *user_ns = current_user_ns(); - cputime_t utime; - cputime_t stime; + u64 utime; + u64 stime; unsigned long bkt; uid_t uid; @@ -129,15 +129,12 @@ static int uid_cputime_show(struct seq_file *m, void *v) read_unlock(&tasklist_lock); hash_for_each(hash_table, bkt, uid_entry, hash) { - cputime_t total_utime = uid_entry->utime + + u64 total_utime = uid_entry->utime + uid_entry->active_utime; - cputime_t total_stime = uid_entry->stime + + u64 total_stime = uid_entry->stime + uid_entry->active_stime; seq_printf(m, "%d: %llu %llu\n", uid_entry->uid, - (unsigned long long)jiffies_to_msecs( - cputime_to_jiffies(total_utime)) * USEC_PER_MSEC, - (unsigned long long)jiffies_to_msecs( - cputime_to_jiffies(total_stime)) * USEC_PER_MSEC); + ktime_to_ms(total_utime), ktime_to_ms(total_stime)); } rt_mutex_unlock(&uid_lock); @@ -406,7 +403,7 @@ static int process_notifier(struct notifier_block *self, { struct task_struct *task = v; struct uid_entry *uid_entry; - cputime_t utime, stime; + u64 utime, stime; uid_t uid; if (!task) |