From owner-freebsd-stable@FreeBSD.ORG Tue May 10 04:17:06 2005 Return-Path: Delivered-To: freebsd-stable@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 53A8816A4F0; Tue, 10 May 2005 04:17:06 +0000 (GMT) Received: from sp.dominia.org (efnet-math.org [69.60.109.125]) by mx1.FreeBSD.org (Postfix) with ESMTP id C59C343D5F; Tue, 10 May 2005 04:17:05 +0000 (GMT) (envelope-from ssouhlal@FreeBSD.org) Received: from [192.168.1.12] (63-170-138-118.cst-sg.blacksburg.ntc-com.net [63.170.138.118]) (authenticated bits=0) by sp.dominia.org (8.13.1/8.13.1) with ESMTP id j4A4H35A015468 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=NO); Tue, 10 May 2005 00:17:04 -0400 In-Reply-To: References: Mime-Version: 1.0 (Apple Message framework v728) Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-Id: <361776BC-F969-4F88-8656-E75A5D967186@FreeBSD.org> Content-Transfer-Encoding: 7bit From: Suleiman Souhlal Date: Tue, 10 May 2005 00:16:56 -0400 To: Daniel Eischen X-Mailer: Apple Mail (2.728) cc: Ewan Todd cc: Peter Jeremy cc: freebsd-stable Subject: Re: Performance issue X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 May 2005 04:17:06 -0000 Hello, On May 9, 2005, at 7:21 PM, Daniel Eischen wrote: > I don't think that patch is correct. You need the signal mask > in the kernel to match in case of an exec() after a fork() > for instance. If the application fork()'s, then changes the > signal mask in the child (which is now single threaded), then > the child exec()s, the mask is wrong. > > If the process wasn't linked to libpthread, then the longjmp() > and setjmp() would still be calling the syscall, so it isn't > the syscall itself that is making things slower. You'll notice > that there are two calls to __sys_sigprocmask() in the section > of code you have patched. You could eliminate the second call > if you do some of what the remainder of the function does instead > of returning early (the locks aren't needed and pending signals > don't need to be run down). Processes linked with libc_r NEVER call the syscall, once they have started (after rtld-elf): zZzZ:~/py% LD_LIBMAP="libpthread.so.1=libc_r.so.5" ktrace -t c python heapsort.py 10000 > /dev/null && kdump -T | grep sigprocmask 2991 python 1115698354.240301 CALL sigprocmask (0x1,0x2810a820,0xbfbfea60) 2991 python 1115698354.240304 RET sigprocmask 0 2991 python 1115698354.240307 CALL sigprocmask(0x3,0x2810a830,0) 2991 python 1115698354.240308 RET sigprocmask 0 zZzZ:~/py% compare with libpthread: zZzZ:~/py% ktrace -t c python heapsort.py 10000 > /dev/null && kdump - T | grep -c sigprocmask 92114 zZzZ:~/py% Is this a bug in libc_r? -- Suleiman Souhlal | ssouhlal@vt.edu The FreeBSD Project | ssouhlal@FreeBSD.org