Source-Changes-HG archive

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

[src/trunk]: src/sys/kern Ensure that the second LWP of a new process uses a ...



details:   https://anonhg.NetBSD.org/src/rev/ef2ff1ca74d7
branches:  trunk
changeset: 966674:ef2ff1ca74d7
user:      joerg <joerg%NetBSD.org@localhost>
date:      Sun Nov 10 23:39:03 2019 +0000

description:
Ensure that the second LWP of a new process uses a free LWP ID.
Document overflow behavior.

diffstat:

 sys/kern/kern_lwp.c |  9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diffs (30 lines):

diff -r cea98c6f06c7 -r ef2ff1ca74d7 sys/kern/kern_lwp.c
--- a/sys/kern/kern_lwp.c       Sun Nov 10 23:14:16 2019 +0000
+++ b/sys/kern/kern_lwp.c       Sun Nov 10 23:39:03 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kern_lwp.c,v 1.206 2019/11/07 19:45:18 joerg Exp $     */
+/*     $NetBSD: kern_lwp.c,v 1.207 2019/11/10 23:39:03 joerg Exp $     */
 
 /*-
  * Copyright (c) 2001, 2006, 2007, 2008, 2009 The NetBSD Foundation, Inc.
@@ -211,7 +211,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_lwp.c,v 1.206 2019/11/07 19:45:18 joerg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_lwp.c,v 1.207 2019/11/10 23:39:03 joerg Exp $");
 
 #include "opt_ddb.h"
 #include "opt_lockdebug.h"
@@ -904,6 +904,11 @@
                l2->l_pflag |= LP_PIDLID;
        } else if (p2->p_nlwps == 0) {
                lid = l1->l_lid;
+               /*
+                * Update next LWP ID, too. If this overflows to LID_SCAN,
+                * the slow path of scanning will be used for the next LWP.
+                */
+               p2->p_nlwpid = lid + 1;
        } else {
                lid = 0;
        }



Home | Main Index | Thread Index | Old Index