From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/13795 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Rich Felker Newsgroups: gmane.linux.lib.musl.general Subject: Re: Draft outline of thread-list design Date: Thu, 14 Feb 2019 18:19:36 -0500 Message-ID: <20190214231936.GX23599@brightrain.aerifal.cx> References: <20190212182625.GA24199@brightrain.aerifal.cx> <66c00d56d718caa565209fd480158f98@ispras.ru> <20190214223224.GV23599@brightrain.aerifal.cx> Reply-To: musl@lists.openwall.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="63962"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Mutt/1.5.21 (2010-09-15) Cc: musl@lists.openwall.com To: Alexey Izbyshev Original-X-From: musl-return-13811-gllmg-musl=m.gmane.org@lists.openwall.com Fri Feb 15 00:19:54 2019 Return-path: Envelope-to: gllmg-musl@m.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by blaine.gmane.org with smtp (Exim 4.89) (envelope-from ) id 1guQIL-000GYi-GG for gllmg-musl@m.gmane.org; Fri, 15 Feb 2019 00:19:53 +0100 Original-Received: (qmail 13644 invoked by uid 550); 14 Feb 2019 23:19:51 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Original-Received: (qmail 13620 invoked from network); 14 Feb 2019 23:19:50 -0000 Content-Disposition: inline In-Reply-To: <20190214223224.GV23599@brightrain.aerifal.cx> Original-Sender: Rich Felker Xref: news.gmane.org gmane.linux.lib.musl.general:13795 Archived-At: On Thu, Feb 14, 2019 at 05:32:24PM -0500, Rich Felker wrote: > On Fri, Feb 15, 2019 at 12:16:39AM +0300, Alexey Izbyshev wrote: > > In general, to my limited expertise, the design looks simple and > > clean. I'm not sure whether it's worth optimizing to reduce > > serialization pressure on pthread_create()/pthread_exit() because > > creating a large amount of short-lived threads doesn't look like a > > good idea anyway. > > Yes. One thing I did notice is that the window where pthread_create > has to hold a lock to prevent new dlopen from happening is a lot > larger than the window where the thread list needs to be locked, and > contains mmap/mprotect. I think we should add a new "DTLS lock" here > that's held for the whole time, with a protocol that if you need both > the DTLS lock and the thread list lock, you take them in that order > (dlopen would also need them both). This reduces the thread list lock > window to just the __clone call and list update. Also: the DTLS lock function can have a weak dummy, so that static-linked programs don't even perform any locking. Rich