NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: lib/41019: pthreads: high load when using varnish (locking/unlocking causes 98% WCPU)



On Mar 22,  2:10pm, michael+netbsd%stapelberg.de@localhost (Michael Stapelberg) 
wrote:
-- Subject: Re: lib/41019: pthreads: high load when using varnish (locking/un

|  Hi,
|  
|  I just wanted to inform you that this problem report can be closed as I was
|  wrong with the cause of the clock_gettime()-calls. They were, in fact, issued
|  by varnish.
|  
|  They were issued so often because the return code of usleep() wasnâ??t 
checked
|  and NetBSD does not handle values >= 1,000,000. See ticket #475 [1] in 
varnish
|  bugtracker.
|  
|  So, sorry to have wasted your time and thanks for your help.
|  
|  Best regards,
|  Michael
|  
|  [1] http://varnish.projects.linpro.no/ticket/475

It is not a NetBSD issue:

        http://opengroup.org/onlinepubs/007908799/xsh/usleep.html

And in your fix you are not using nanosleep because you claim it has
similar issues. I think it does not, so in reality the code should be
converted to use nanosleep(), or if you want to use something like your
patch:

#define U2S     1000000
        if (usec >= U2S) {
                unsigned int sec = usec / U2S;
                usec %= U2S;

                sleep(sec);
                usleep(usec);
        }

christos


Home | Main Index | Thread Index | Old Index