Source-Changes-HG archive

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

[src/trunk]: src/sys/kern __predict_false() the test for full process table, ...



details:   https://anonhg.NetBSD.org/src/rev/222f95f2ede6
branches:  trunk
changeset: 485917:222f95f2ede6
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Mon May 08 19:59:21 2000 +0000

description:
__predict_false() the test for full process table, user exceeding their
process limit, and USPACE valloc failure.

diffstat:

 sys/kern/kern_fork.c |  10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

diffs (38 lines):

diff -r 66729b1e1e4b -r 222f95f2ede6 sys/kern/kern_fork.c
--- a/sys/kern/kern_fork.c      Mon May 08 19:58:17 2000 +0000
+++ b/sys/kern/kern_fork.c      Mon May 08 19:59:21 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kern_fork.c,v 1.63 2000/03/30 09:27:11 augustss Exp $  */
+/*     $NetBSD: kern_fork.c,v 1.64 2000/05/08 19:59:21 thorpej Exp $   */
 
 /*
  * Copyright (c) 1982, 1986, 1989, 1991, 1993
@@ -136,7 +136,8 @@
         * processes, maxproc is the limit.
         */
        uid = p1->p_cred->p_ruid;
-       if ((nprocs >= maxproc - 1 && uid != 0) || nprocs >= maxproc) {
+       if (__predict_false((nprocs >= maxproc - 1 && uid != 0) ||
+                           nprocs >= maxproc)) {
                tablefull("proc");
                return (EAGAIN);
        }
@@ -146,7 +147,8 @@
         * a nonprivileged user to exceed their current limit.
         */
        count = chgproccnt(uid, 1);
-       if (uid != 0 && count > p1->p_rlimit[RLIMIT_NPROC].rlim_cur) {
+       if (__predict_false(uid != 0 && count >
+                           p1->p_rlimit[RLIMIT_NPROC].rlim_cur)) {
                (void)chgproccnt(uid, -1);
                return (EAGAIN);
        }
@@ -158,7 +160,7 @@
         * be allocated and wired in vm_fork().
         */
        uaddr = uvm_km_valloc(kernel_map, USPACE);
-       if (uaddr == 0) {
+       if (__predict_false(uaddr == 0)) {
                (void)chgproccnt(uid, -1);
                return (ENOMEM);
        }



Home | Main Index | Thread Index | Old Index