tech-kern archive

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

Re: Anomalies while handling p_nstopchild count



  Date: Sat, 10 Oct 2015 13:49:52 +0000 (UTC)
  From: christos%astron.com@localhost (Christos Zoulas)

  In article <Pine.NEB.4.64.1510101636500.411%vps1.whooppee.com@localhost>,
  Paul Goyette  <paul%whooppee.com@localhost> wrote:
  >-=-=-=-=-=-
  >+
  >+		if (!mutex_tryenter(proc_lock)) {
  >+			mutex_exit(p->p_lock);
  >+			mutex_enter(proc_lock);
  >+			mutex_enter(p->p_lock);
  >+		}

  Can you find out where exit1() is called with the proc_lock held? Then
  you can call it with an additional flag and remove the tryenter call,
  and instead use the flag.

I don't think that's why he put that there -- it's just that the lock
order is proc_lock first, then p->p_lock for any p.  This is the
optimistic reverse-order locking fragment that the mutex(9) man page
suggests.

Correct.

+------------------+--------------------------+-------------------------+
| Paul Goyette     | PGP Key fingerprint:     | E-mail addresses:       |
| (Retired)        | FA29 0E3B 35AF E8AE 6651 | paul at whooppee.com    |
| Kernel Developer | 0786 F758 55DE 53BA 7731 | pgoyette at netbsd.org  |
+------------------+--------------------------+-------------------------+


Home | Main Index | Thread Index | Old Index