Source-Changes-HG archive

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

[src/trunk]: src/sys/kern In expand_pid_table(), calculate the current pid ta...



details:   https://anonhg.NetBSD.org/src/rev/dfacb541d99a
branches:  trunk
changeset: 1009551:dfacb541d99a
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Sun Apr 26 15:49:10 2020 +0000

description:
In expand_pid_table(), calculate the current pid table size before
releasing the lock.

diffstat:

 sys/kern/kern_proc.c |  6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diffs (29 lines):

diff -r 422477476777 -r dfacb541d99a sys/kern/kern_proc.c
--- a/sys/kern/kern_proc.c      Sun Apr 26 15:39:04 2020 +0000
+++ b/sys/kern/kern_proc.c      Sun Apr 26 15:49:10 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kern_proc.c,v 1.248 2020/04/24 05:21:18 thorpej Exp $  */
+/*     $NetBSD: kern_proc.c,v 1.249 2020/04/26 15:49:10 thorpej Exp $  */
 
 /*-
  * Copyright (c) 1999, 2006, 2007, 2008, 2020 The NetBSD Foundation, Inc.
@@ -62,7 +62,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_proc.c,v 1.248 2020/04/24 05:21:18 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_proc.c,v 1.249 2020/04/26 15:49:10 thorpej Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_kstack.h"
@@ -882,9 +882,9 @@
        KASSERT(rw_write_held(&pid_table_lock));
 
        /* Unlock the pid_table briefly to allocate memory. */
+       pt_size = pid_tbl_mask + 1;
        rw_exit(&pid_table_lock);
 
-       pt_size = pid_tbl_mask + 1;
        tsz = pt_size * 2 * sizeof(struct pid_table);
        new_pt = kmem_alloc(tsz, KM_SLEEP);
        new_pt_mask = pt_size * 2 - 1;



Home | Main Index | Thread Index | Old Index