From owner-freebsd-current@FreeBSD.ORG Sun May 7 23:04:35 2006 Return-Path: X-Original-To: current@FreeBSD.org Delivered-To: freebsd-current@FreeBSD.ORG Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 4CD8B16A42F; Sun, 7 May 2006 23:04:35 +0000 (UTC) (envelope-from kris@obsecurity.org) Received: from elvis.mu.org (elvis.mu.org [192.203.228.196]) by mx1.FreeBSD.org (Postfix) with ESMTP id AA7C343D5F; Sun, 7 May 2006 23:04:31 +0000 (GMT) (envelope-from kris@obsecurity.org) Received: from obsecurity.dyndns.org (elvis.mu.org [192.203.228.196]) by elvis.mu.org (Postfix) with ESMTP id 9309E1A3C1E; Sun, 7 May 2006 16:04:31 -0700 (PDT) Received: by obsecurity.dyndns.org (Postfix, from userid 1000) id F0F2B516B8; Sun, 7 May 2006 19:04:30 -0400 (EDT) Date: Sun, 7 May 2006 19:04:30 -0400 From: Kris Kennaway To: Kris Kennaway Message-ID: <20060507230430.GA6872@xor.obsecurity.org> References: <20060506150622.C17611@fledge.watson.org> <20060506221908.GB51268@xor.obsecurity.org> <20060507210426.GA4422@xor.obsecurity.org> <20060507214153.GA5275@xor.obsecurity.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="EeQfGwPcQSOJBaQU" Content-Disposition: inline In-Reply-To: <20060507214153.GA5275@xor.obsecurity.org> User-Agent: Mutt/1.4.2.1i Cc: performance@FreeBSD.org, Robert Watson , current@FreeBSD.org Subject: Re: Fine-grained locking for POSIX local sockets (UNIX domain sockets) X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 May 2006 23:04:36 -0000 --EeQfGwPcQSOJBaQU Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable 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 =3D savedmask; > SIGSETNAND(td->td_sigmask, waitset); > signotify(td); > error =3D msleep(&ps, &p->p_mtx, PPAUSE|PCATCH, "sigwait", hz); >=20 > 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=3D0; 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 --EeQfGwPcQSOJBaQU Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.3 (FreeBSD) iD8DBQFEXnz+Wry0BWjoQKURAt9bAJ98pfbOhmC9J0RECAq9WEB9IEi5mwCfQkp7 rN1OtiYv5coGIatwx6cntG4= =9lr+ -----END PGP SIGNATURE----- --EeQfGwPcQSOJBaQU--