<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">
From: Martin Schwidefsky &lt;schwidefsky@de.ibm.com&gt;

Use cputime type and operations in do_task_stat, process_ticks and
thread_ticks as well.

Signed-off-by: Martin Schwidefsky &lt;schwidefsky@de.ibm.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@osdl.org&gt;
---

 25-akpm/fs/proc/array.c       |   22 ++++++++++++----------
 25-akpm/kernel/posix-timers.c |   11 ++++++-----
 2 files changed, 18 insertions(+), 15 deletions(-)

diff -puN fs/proc/array.c~cputime-missing-pieces fs/proc/array.c
--- 25/fs/proc/array.c~cputime-missing-pieces	2004-12-03 20:57:11.427901496 -0800
+++ 25-akpm/fs/proc/array.c	2004-12-03 20:57:11.431900888 -0800
@@ -315,8 +315,9 @@ static int do_task_stat(struct task_stru
 	int num_threads = 0;
 	struct mm_struct *mm;
 	unsigned long long start_time;
-	unsigned long cmin_flt = 0, cmaj_flt = 0, cutime = 0, cstime = 0;
-	unsigned long  min_flt = 0,  maj_flt = 0,  utime = 0,  stime = 0;
+	unsigned long cmin_flt = 0, cmaj_flt = 0;
+	unsigned long  min_flt = 0,  maj_flt = 0;
+	cputime_t cutime, cstime, utime, stime;
 	unsigned long rsslim = 0;
 	struct task_struct *t;
 	char tcomm[sizeof(task-&gt;comm)];
@@ -334,6 +335,7 @@ static int do_task_stat(struct task_stru
 
 	sigemptyset(&amp;sigign);
 	sigemptyset(&amp;sigcatch);
+	cutime = cstime = utime = stime = cputime_zero;
 	read_lock(&amp;tasklist_lock);
 	if (task-&gt;sighand) {
 		spin_lock_irq(&amp;task-&gt;sighand-&gt;siglock);
@@ -346,8 +348,8 @@ static int do_task_stat(struct task_stru
 			do {
 				min_flt += t-&gt;min_flt;
 				maj_flt += t-&gt;maj_flt;
-				utime += t-&gt;utime;
-				stime += t-&gt;stime;
+				utime = cputime_add(utime, t-&gt;utime);
+				stime = cputime_add(stime, t-&gt;stime);
 				t = next_thread(t);
 			} while (t != task);
 		}
@@ -369,8 +371,8 @@ static int do_task_stat(struct task_stru
 		if (whole) {
 			min_flt += task-&gt;signal-&gt;min_flt;
 			maj_flt += task-&gt;signal-&gt;maj_flt;
-			utime += task-&gt;signal-&gt;utime;
-			stime += task-&gt;signal-&gt;stime;
+			utime = cputime_add(utime, task-&gt;signal-&gt;utime);
+			stime = cputime_add(stime, task-&gt;signal-&gt;stime);
 		}
 	}
 	ppid = task-&gt;pid ? task-&gt;group_leader-&gt;real_parent-&gt;tgid : 0;
@@ -413,10 +415,10 @@ static int do_task_stat(struct task_stru
 		cmin_flt,
 		maj_flt,
 		cmaj_flt,
-		jiffies_to_clock_t(utime),
-		jiffies_to_clock_t(stime),
-		jiffies_to_clock_t(cutime),
-		jiffies_to_clock_t(cstime),
+		cputime_to_clock_t(utime),
+		cputime_to_clock_t(stime),
+		cputime_to_clock_t(cutime),
+		cputime_to_clock_t(cstime),
 		priority,
 		nice,
 		num_threads,
diff -puN kernel/posix-timers.c~cputime-missing-pieces kernel/posix-timers.c
--- 25/kernel/posix-timers.c~cputime-missing-pieces	2004-12-03 20:57:11.428901344 -0800
+++ 25-akpm/kernel/posix-timers.c	2004-12-03 20:57:11.433900584 -0800
@@ -1233,26 +1233,27 @@ int do_posix_clock_nonanosleep(int which
 }
 
 static unsigned long process_ticks(task_t *p) {
-	unsigned long ticks;
+	cputime_t cputime;
 	task_t *t;
 
 	spin_lock(&amp;p-&gt;sighand-&gt;siglock);
 	/* The signal structure is shared between all threads */
-	ticks = p-&gt;signal-&gt;utime + p-&gt;signal-&gt;stime;
+	cputime = cputime_add(p-&gt;signal-&gt;utime, p-&gt;signal-&gt;stime);
 
 	/* Add up the cpu time for all the still running threads of this process */
 	t = p;
 	do {
-		ticks += t-&gt;utime + t-&gt;stime;
+		cputime = cputime_add(cputime, t-&gt;utime);
+		cputime = cputime_add(cputime, t-&gt;stime);
 		t = next_thread(t);
 	} while (t != p);
 
 	spin_unlock(&amp;p-&gt;sighand-&gt;siglock);
-	return ticks;
+	return cputime_to_jiffies(cputime);
 }
 
 static inline unsigned long thread_ticks(task_t *p) {
-	return p-&gt;utime + current-&gt;stime;
+	return cputime_to_jiffies(cputime_add(p-&gt;utime, current-&gt;stime));
 }
 
 /*
_
</pre></body></html>