Date: Tue, 15 Nov 2011 12:32:00 +0400 From: Daniil Cherednik <dcherednik@masterhost.ru> To: <freebsd-stable@freebsd.org> Subject: Re: 8.2 + apache == a LOT of sigprocmask Message-ID: <4EC22380.20509@masterhost.ru> In-Reply-To: <4EC18F28.20307@FreeBSD.org> References: <4EC17AAF.9050807@FreeBSD.org> <201111141556.13295.jhb@freebsd.org> <4EC18F28.20307@FreeBSD.org>
next in thread | previous in thread | raw e-mail | index | archive | help
Hi. I was trying to understand a cause for this problem, and made an ugly hack: diff -u ./rtld_lock.c.orig ./rtld_lock.c --- ./rtld_lock.c.orig 2011-11-15 07:56:14.000000000 +0000 +++ ./rtld_lock.c 2011-11-15 07:54:42.000000000 +0000 @@ -118,7 +118,7 @@ sigset_t tmp_oldsigmask; for ( ; ; ) { - sigprocmask(SIG_BLOCK, &fullsigmask, &tmp_oldsigmask); +// sigprocmask(SIG_BLOCK, &fullsigmask, &tmp_oldsigmask); if (atomic_cmpset_acq_int(&l->lock, 0, WAFLAG)) break; sigprocmask(SIG_SETMASK, &tmp_oldsigmask, NULL); @@ -135,7 +135,7 @@ atomic_add_rel_int(&l->lock, -RC_INCR); else { atomic_add_rel_int(&l->lock, -WAFLAG); - sigprocmask(SIG_SETMASK, &oldsigmask, NULL); +// sigprocmask(SIG_SETMASK, &oldsigmask, NULL); } } this reduced number of syscalls, but I am not sure about stability and correctness of this hack. And performance problems of apache remained (this hack only gave 5-10% increase of performance). Also I found problem in longjmp syscalls. In FreeBSD we are doing this syscalls from gen/setjmp.S without condition check, for example in Linux we are doing it only if stack has been saved. Linux code: if (env[0].__mask_was_saved) /* Restore the saved signal mask. */ (void) __sigprocmask (SIG_SETMASK, &env[0].__saved_mask, (sigset_t *) NULL); After all that I was trying to compare perfomance of return from fork() in Linux and FreeBSD (see http://lists.freebsd.org/pipermail/freebsd-hackers/2011-October/036705.html) and fork() in FreeBSD was slower. I am not trying to start a holy war, but I really need to increase performance of our hosting in FreeBSD. On 15.11.2011 01:59, Doug Barton wrote: > On 11/14/2011 12:56, John Baldwin wrote: >> On Monday, November 14, 2011 3:31:43 pm Doug Barton wrote: >>> Trying to track down a load problem we're seeing on 8.2-RELEASE-p4 i386 >>> in a busy web hosting environment I came across the following post: >>> >>> http://lists.freebsd.org/pipermail/freebsd-questions/2011- >> October/234520.html >>> That basically describes what we're seeing as well, including the >>> "doesn't happen on Linux" part. >>> >>> Does anyone have any ideas about this? >>> >>> With incredibly similar stuff running on 7.x we didn't see this problem, >>> so it seems to be something new in 8. >> I suspect it has to do with some of the changes to rtld such that it now >> always blocks signals while resolving symbols (or something along those >> lines IIRC). It makes throwing exceptions slow as well. > The calls to sigprocmask() in rtld seem to be doing what you suggest > here, but they involve setting and restoring the mask. In my followup > post I pasted what we're seeing, which is different, and much more > voluminous. For example, 13,500 calls in 30 seconds from a single apache > worker process. > > Although this does seem to explain why our test cases have more calls > when compiled with C++ than they do when compiled with C. :) > > Thanks for the response in any case. > > > Doug > -- С уважением, Daniil Cherednik .masterhost
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4EC22380.20509>