[PATCH 1 of 2] fix sched_setaffinity(2) call failure

Joshua Zhu zhuzhaoyuan at gmail.com
Mon Jan 16 13:21:54 UTC 2012


Hi,

On Mon, Jan 16, 2012 at 6:51 PM, Maxim Dounin <mdounin at mdounin.ru> wrote:

> Hello!
>
> On Mon, Jan 16, 2012 at 01:52:09PM +0800, Joshua Zhu wrote:
>
> [...]
>
> > > diff -r e1296af53cc0 src/os/unix/ngx_process_cycle.c
> > > --- a/src/os/unix/ngx_process_cycle.c   Mon Dec 26 00:00:00 2011 +0400
> > > +++ b/src/os/unix/ngx_process_cycle.c   Fri Jan 13 11:58:01 2012 -0500
> > > @@ -914,7 +914,10 @@
> > >         ngx_log_error(NGX_LOG_NOTICE, cycle->log, 0,
> > >                       "sched_setaffinity(0x%08Xl)", cpu_affinity);
> > >
> > > -        if (sched_setaffinity(0, 32, (cpu_set_t *) &cpu_affinity) ==
> -1) {
> > > +        if (sched_setaffinity(0, sizeof(cpu_affinity),
> > > +                              (cpu_set_t *) &cpu_affinity)
> > > +            == -1)
> > > +        {
> > >             ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno,
> > >                           "sched_setaffinity(0x%08Xl) failed",
> > > cpu_affinity);
> > >         }
> > >
> > > Could you please test if it works for you?
> > >
> >
> > Yes, it works on one of my Linux box which has two cores. But I have not
> > tested it on more other systems yet.
>
> Ok, I'll commit it then, as this looks like an obvious fix.
>
> [...]
>
>
OK. This fix looks good to me now. Just commit this piece of code is enough.

Regards,

-- 
Joshua Zhu
Senior Software Engineer
Server Platforms Team at Taobao
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20120116/95bf3f82/attachment.html>


More information about the nginx mailing list