Re: Fine-grained locking for POSIX local sockets (UNIX domain sockets)

From: Kris Kennaway <kris_at_obsecurity.org>
Date: Sun, 7 May 2006 19:04:30 -0400
On Sun, May 07, 2006 at 05:41:53PM -0400, Kris Kennaway wrote:

> static int
> kern_sigtimedwait(struct thread *td, sigset_t waitset, ksiginfo_t *ksi,
>         struct timespec *timeout)
> {
> ...
>         td->td_sigmask = savedmask;
>         SIGSETNAND(td->td_sigmask, waitset);
>         signotify(td);
>         error = msleep(&ps, &p->p_mtx, PPAUSE|PCATCH, "sigwait", hz);
> 
> i.e. several threads in the process are all sleeping for 1 tick and
> then doing a thundering herd on the same proc lock when they wake up.

Oops, actually hz=0; it comes via sigwait(2).  It's still a thundering
herd situation though.

I also profiled the sleepq_broadcast call to look at thundering herds
from wakeup(), and I found that the umtxq_chain is waking the
following distribution of CPUs at once:

Before patch:

Freq #CPUs
1111 1
 366 2
 136 3
  54 4
  17 5
   2 6

After patch:

Freq #CPUs
1139 1
 332 2
 139 3
  44 4
  12 5
   2 6

i.e. apparently not a large difference, but still a large proportion
of cases where multiple CPUs are woken at once on the same chain.

Kris

Received on Sun May 07 2006 - 21:04:35 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:38:55 UTC