Print this page
OS-7753 THREAD_KPRI_RELEASE does nothing of the sort
Reviewed by: Bryan Cantrill <bryan@joyent.com>
Reviewed by: Jerry Jelinek <jerry.jelinek@joyent.com>

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/os/pid.c
          +++ new/usr/src/uts/common/os/pid.c
↓ open down ↓ 13 lines elided ↑ open up ↑
  14   14   * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15   15   * If applicable, add the following below this CDDL HEADER, with the
  16   16   * fields enclosed by brackets "[]" replaced with your own identifying
  17   17   * information: Portions Copyright [yyyy] [name of copyright owner]
  18   18   *
  19   19   * CDDL HEADER END
  20   20   */
  21   21  
  22   22  /*
  23   23   * Copyright (c) 1989, 2010, Oracle and/or its affiliates. All rights reserved.
       24 + * Copyright 2019 Joyent, Inc.
  24   25   */
  25   26  
  26   27  /*      Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
  27      -/*        All Rights Reserved   */
       28 +/*        All Rights Reserved   */
  28   29  
  29   30  #include <sys/types.h>
  30   31  #include <sys/param.h>
  31   32  #include <sys/sysmacros.h>
  32   33  #include <sys/proc.h>
  33   34  #include <sys/kmem.h>
  34   35  #include <sys/tuneable.h>
  35   36  #include <sys/var.h>
  36   37  #include <sys/cred.h>
  37   38  #include <sys/systm.h>
↓ open down ↓ 372 lines elided ↑ open up ↑
 410  411          /* skip system and incomplete processes */
 411  412          if (p->p_stat == SIDL || p->p_stat == SZOMB ||
 412  413              (p->p_flag & (SSYS | SEXITING | SEXITLWPS))) {
 413  414                  return (-1);
 414  415          }
 415  416  
 416  417          if (p->p_proc_flag & P_PR_LOCK)
 417  418                  return (1);
 418  419  
 419  420          p->p_proc_flag |= P_PR_LOCK;
 420      -        THREAD_KPRI_REQUEST();
 421  421  
 422  422          return (0);
 423  423  }
 424  424  
 425  425  /*
 426  426   * Wait for P_PR_LOCK to become clear.  Returns with p_lock dropped,
 427  427   * and the proc pointer no longer valid, as the proc may have exited.
 428  428   */
 429  429  void
 430  430  sprwaitlock_proc(proc_t *p)
↓ open down ↓ 64 lines elided ↑ open up ↑
 495  495  void
 496  496  sprlock_proc(proc_t *p)
 497  497  {
 498  498          ASSERT(MUTEX_HELD(&p->p_lock));
 499  499  
 500  500          while (p->p_proc_flag & P_PR_LOCK) {
 501  501                  cv_wait(&pr_pid_cv[p->p_slot], &p->p_lock);
 502  502          }
 503  503  
 504  504          p->p_proc_flag |= P_PR_LOCK;
 505      -        THREAD_KPRI_REQUEST();
 506  505  }
 507  506  
 508  507  void
 509  508  sprunlock(proc_t *p)
 510  509  {
 511  510          if (panicstr) {
 512  511                  mutex_exit(&p->p_lock);
 513  512                  return;
 514  513          }
 515  514  
 516  515          ASSERT(p->p_proc_flag & P_PR_LOCK);
 517  516          ASSERT(MUTEX_HELD(&p->p_lock));
 518  517  
 519  518          cv_signal(&pr_pid_cv[p->p_slot]);
 520  519          p->p_proc_flag &= ~P_PR_LOCK;
 521  520          mutex_exit(&p->p_lock);
 522      -        THREAD_KPRI_RELEASE();
 523  521  }
 524  522  
 525  523  void
 526  524  pid_init(void)
 527  525  {
 528  526          int i;
 529  527  
 530  528          pid_hashsz = 1 << highbit(v.v_proc / pid_hashlen);
 531  529  
 532  530          pidhash = kmem_zalloc(sizeof (struct pid *) * pid_hashsz, KM_SLEEP);
↓ open down ↓ 260 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX