Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a848a164 authored by Amit Pundir's avatar Amit Pundir
Browse files

ANDROID: uid_sys_stats: Remove obsolete cputime type and helpers



Upstream commit 605dc2b3 ("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
f22d6df0 ("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: default avatarAmit Pundir <amit.pundir@linaro.org>
parent 9f418646
Loading
Loading
Loading
Loading
+11 −14
Original line number Diff line number Diff line
@@ -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)