Hi,

On May 14 we did split kernel spinning time from system time.  Goal
was to see what the kernel is doing.

I just realized that user land time accounting has also changed.
The commit changed system time of a process that is spinning.  But
the user land process still uses CPU time in the kernel that should
be accounted to the user.  The user does not care if kernel is
spinning or working for him.  time(1) only shows real, user, sys.

So I would like to restore the original behavior for user land
processes.

ok?

bluhm

Index: kern/kern_clock.c
===================================================================
RCS file: /data/mirror/openbsd/cvs/src/sys/kern/kern_clock.c,v
retrieving revision 1.95
diff -u -p -r1.95 kern_clock.c
--- kern/kern_clock.c   4 Jun 2018 18:16:43 -0000       1.95
+++ kern/kern_clock.c   8 Oct 2018 18:56:01 -0000
@@ -378,9 +378,11 @@ statclock(struct clockframe *frame)
                 * so that we know how much of its real time was spent
                 * in ``non-process'' (i.e., interrupt) work.
                 */
-               if (spc->spc_spinning)
+               if (spc->spc_spinning) {
+                       if (p != NULL && p != spc->spc_idleproc)
+                               p->p_sticks++;
                        spc->spc_cp_time[CP_SPIN]++;
-               else if (CLKF_INTR(frame)) {
+               } else if (CLKF_INTR(frame)) {
                        if (p != NULL)
                                p->p_iticks++;
                        spc->spc_cp_time[CP_INTR]++;

Reply via email to