From owner-freebsd-arch@FreeBSD.ORG Sat Jan 12 00:27:12 2013 Return-Path: Delivered-To: arch@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 886372C5; Sat, 12 Jan 2013 00:27:12 +0000 (UTC) (envelope-from listlog2011@gmail.com) Received: from mail-gg0-f173.google.com (mail-gg0-f173.google.com [209.85.161.173]) by mx1.freebsd.org (Postfix) with ESMTP id 27BBEB43; Sat, 12 Jan 2013 00:27:11 +0000 (UTC) Received: by mail-gg0-f173.google.com with SMTP id f2so437687ggn.18 for ; Fri, 11 Jan 2013 16:27:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:message-id:date:from:reply-to:user-agent:mime-version:to :cc:subject:references:in-reply-to:content-type :content-transfer-encoding; bh=rPSsYlKDdjJKAN6OxfLjsSv8ldhkvqciiCO6YXHO3jk=; b=kijs77MHQYJHyA6ISRj0q32xVUtucxtq8AfSGbr4UektWEKwIwh/80m0iKi9OXdODH CT6rp922iHv1T5KO2uArsB2IeZUWdPAACGE7DZBOvkqpdNruw2m23XVZJ/hFXVFLWGAK aOdW58wwOq+8kQT/6qKMdrWEV/r9/n75seqVyAGA5fqXs5m4qGzWkdq0FwOHO4evlHh+ W4bFCJhDqh/m41qmIHhgu1G3baLkYXAk5iERCXK2RiLYfxXKRz72czKNAB1LDHP14G7D VnZKNzIDQ8JaRI9H6OjNlAmbh4PAHXru7hctA8SILcmbMpWWzCDPQ5USR2ZoCZCC3qtf rwUQ== X-Received: by 10.236.93.69 with SMTP id k45mr11007395yhf.28.1357950431277; Fri, 11 Jan 2013 16:27:11 -0800 (PST) Received: from xp5k.my.domain ([115.192.135.231]) by mx.google.com with ESMTPS id r9sm5910613yhm.14.2013.01.11.16.27.08 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 11 Jan 2013 16:27:10 -0800 (PST) Message-ID: <50F0ADDA.4000801@gmail.com> Date: Sat, 12 Jan 2013 08:27:06 +0800 From: David Xu User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:17.0) Gecko/17.0 Thunderbird/17.0 MIME-Version: 1.0 To: Jilles Tjoelker Subject: Re: Fast sigblock (AKA rtld speedup) References: <20130107182235.GA65279@kib.kiev.ua> <20130111095459.GZ2561@kib.kiev.ua> <50EFE830.3030500@freebsd.org> <20130111204938.GD2561@kib.kiev.ua> <20130111232906.GA29017@stack.nl> In-Reply-To: <20130111232906.GA29017@stack.nl> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: Konstantin Belousov , arch@freebsd.org, toolchain@freebsd.org X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: davidxu@freebsd.org List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 12 Jan 2013 00:27:12 -0000 On 2013/01/12 07:29, Jilles Tjoelker wrote: > On Fri, Jan 11, 2013 at 10:49:38PM +0200, Konstantin Belousov wrote: >> http://people.freebsd.org/~kib/misc/rtld-sigblock.3.patch > The new fields td_sigblock_ptr and td_sigblock_val are in the part that > is zeroed for new threads, while the code in rtld appears to expect them > to be copied (on fork, vfork and pthread_create). The fields are > correctly zeroed on exec. > > Sharing the magic variable between threads means that one thread holding > an rtld lock will block signals for all other threads as well. This is > different from how the normal signal mask works but I don't know whether > it may break things. However, the patch depends on it in some way > because sigtd() does not know about fast sigblock and will therefore > happily select a thread that is fast-sigblocking to handle a signal > directed at the process. > > Although libthr's postpone approach is somewhat ugly, it does not depend > on any non-standard kernel features and does not delay the default > action. Would it be possible to move that code to libc to make things > easier for rtld? It looks like this requires teaching libc about various > threading concepts, though. Long time ago, if i remembered correctly, kib said that he wanted to merge libthr code into libc, I don't know its state. > Something feels ugly about not allowing applications to use this, > although I don't know how it would work. On the other hand, the strange > signal state created by this and implicit assumptions that the duration > will be short may be a reason to restrict its use to a relatively small > piece of code. > True, it seems it is for short duration.