OSDN Git Service

ANDROID: uid_cputime: Iterates over all the threads instead of processes.
authorRuchi Kandoi <kandoiruchi@google.com>
Fri, 31 Jul 2015 17:17:54 +0000 (10:17 -0700)
committerAmit Pundir <amit.pundir@linaro.org>
Tue, 14 Aug 2018 12:17:11 +0000 (17:47 +0530)
Bug: 22833116
Change-Id: I775a18f61bd2f4df2bec23d01bd49421d0969f87
Signed-off-by: Ruchi Kandoi <kandoiruchi@google.com>
drivers/misc/uid_cputime.c

index 0df8d70..07c8cca 100644 (file)
@@ -73,7 +73,7 @@ static struct uid_entry *find_or_register_uid(uid_t uid)
 static int uid_stat_show(struct seq_file *m, void *v)
 {
        struct uid_entry *uid_entry;
-       struct task_struct *task;
+       struct task_struct *task, *temp;
        u64 utime;
        u64 stime;
        unsigned long bkt;
@@ -86,7 +86,7 @@ static int uid_stat_show(struct seq_file *m, void *v)
        }
 
        read_lock(&tasklist_lock);
-       for_each_process(task) {
+       do_each_thread(temp, task) {
                uid_entry = find_or_register_uid(from_kuid_munged(
                        current_user_ns(), task_uid(task)));
                if (!uid_entry) {
@@ -100,7 +100,7 @@ static int uid_stat_show(struct seq_file *m, void *v)
                task_cputime_adjusted(task, &utime, &stime);
                uid_entry->active_utime += utime;
                uid_entry->active_stime += stime;
-       }
+       } while_each_thread(temp, task);
        read_unlock(&tasklist_lock);
 
        hash_for_each(hash_table, bkt, uid_entry, hash) {