Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/kern PR/46811: Tetsua Isaki: Don't handle cpu limits whe...



details:   https://anonhg.NetBSD.org/src/rev/4a7b88d6ffc1
branches:  trunk
changeset: 781090:4a7b88d6ffc1
user:      christos <christos%NetBSD.org@localhost>
date:      Sat Aug 18 08:54:06 2012 +0000

description:
PR/46811: Tetsua Isaki: Don't handle cpu limits when runtime is negative.

diffstat:

 sys/kern/kern_synch.c |  22 +++++++++++++---------
 1 files changed, 13 insertions(+), 9 deletions(-)

diffs (50 lines):

diff -r 497d677bfd8d -r 4a7b88d6ffc1 sys/kern/kern_synch.c
--- a/sys/kern/kern_synch.c     Sat Aug 18 00:50:37 2012 +0000
+++ b/sys/kern/kern_synch.c     Sat Aug 18 08:54:06 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kern_synch.c,v 1.302 2012/07/27 05:36:13 matt Exp $    */
+/*     $NetBSD: kern_synch.c,v 1.303 2012/08/18 08:54:06 christos Exp $        */
 
 /*-
  * Copyright (c) 1999, 2000, 2004, 2006, 2007, 2008, 2009
@@ -69,7 +69,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_synch.c,v 1.302 2012/07/27 05:36:13 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_synch.c,v 1.303 2012/08/18 08:54:06 christos Exp $");
 
 #include "opt_kstack.h"
 #include "opt_perfctrs.h"
@@ -1170,6 +1170,16 @@
                /* Calculating p_pctcpu only for ps(1) */
                p->p_pctcpu = (p->p_pctcpu * ccpu) >> FSHIFT;
 
+               if (__predict_false(runtm < 0)) {
+                       if (!backwards) {
+                               backwards = true;
+                               printf("WARNING: negative runtime; "
+                                   "monotonic clock has gone backwards\n");
+                       }
+                       mutex_exit(p->p_lock);
+                       continue;
+               }
+
                /*
                 * Check if the process exceeds its CPU resource allocation.
                 * If over the hard limit, kill it with SIGKILL.
@@ -1193,13 +1203,7 @@
                        }
                }
                mutex_exit(p->p_lock);
-               if (__predict_false(runtm < 0)) {
-                       if (!backwards) {
-                               backwards = true;
-                               printf("WARNING: negative runtime; "
-                                   "monotonic clock has gone backwards\n");
-                       }
-               } else if (__predict_false(sig)) {
+               if (__predict_false(sig)) {
                        KASSERT((p->p_flag & PK_SYSTEM) == 0);
                        psignal(p, sig);
                }



Home | Main Index | Thread Index | Old Index