许立强
January 20, 2011 03:32PM
Hi,All,
I'm running a 4-core processor server. linux , libc 2.3.4。
In nginx.conf, i have

worker_processes 4;
worker_cpu_affinity 0001 0010 0100 1000;

But i see in my error log the following :
2011/01/20 14:29:57 [notice] 19362#0: sched_setaffinity(0x00000004)
2011/01/20 14:29:57 [alert] 19362#0: sched_setaffinity(0x00000004)
failed (22: Invalid argument)

By analyzing the source code of nginx(0.8.54), i found :
*if (sched_setaffinity(0, 32, (cpu_set_t *) &cpu_affinity) == -1) {*
* ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno,*
*
"sched_setaffinity(0x%08Xl) failed", cpu_affinity);
*
* }*
and
*u_long cpu_affinity;*

in my opinion, the reason is :
1、sizeof(cpu_set_t) > sizeof(u_long)
2、cpu_affinity is not initialized。

so ,i hack it
*cput_set_t *mask = (cpu_set_t *) (&cpu_affinity);*
*bzero(mask, sizeog(cpu_set_t));*

configure & make & make install.

it works well!

is it a bug?

Cheers,
-feifengxlq
_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

report a bug : worker_cpu_affinity

许立强 3332 January 20, 2011 03:32PM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 111
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 500 on July 15, 2024
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready