5 messages in ru.sysoev.nginxRe: worker_cpu_affinity
FromSent OnAttachments
Cliff WellsNov 27, 2007 1:30 pm 
Igor SysoevNov 27, 2007 8:21 pm.Other
Cliff WellsNov 28, 2007 2:46 pm 
Igor SysoevNov 28, 2007 10:41 pm 
Cliff WellsNov 29, 2007 12:12 am 
Actions with this message:
Paste this link in email or IM:
Paste this link in email or IM:
Atom feed for this thread
Paste this URL into your reader:
Subject:Re: worker_cpu_affinityActions...
From:Igor Sysoev (is-G@public.gmane.org)
Date:Nov 27, 2007 8:21:28 pm
List:ru.sysoev.nginx
Attachments:
patch-cpuaff - 0.7k

On Tue, Nov 27, 2007 at 01:30:53PM -0800, Cliff Wells wrote:

I'm running a dual processor (Athlon MP) server. Gentoo Linux. Nginx is 0.6.16.

In nginx.com I have:

worker_processes 2; worker_cpu_affinity 0001 0010;

But I see in my error log the following:

2007/11/27 13:11:00 [notice] 19009#0: start worker processes 2007/11/27 13:11:00 [notice] 19010#0: sched_setaffinity(0x00000001) 2007/11/27 13:11:00 [alert] 19010#0: sched_setaffinity(0x00000001) failed (22: Invalid argument) 2007/11/27 13:11:00 [notice] 19009#0: start worker process 19010 2007/11/27 13:11:00 [notice] 19011#0: sched_setaffinity(0x00000002) 2007/11/27 13:11:00 [alert] 19011#0: sched_setaffinity(0x00000002) failed (22: Invalid argument) 2007/11/27 13:11:00 [notice] 19009#0: start worker process 19011

Try the attached patch.

-- Igor Sysoev http://sysoev.ru/en/

Index: src/os/unix/ngx_process_cycle.c =================================================================== --- src/os/unix/ngx_process_cycle.c (revision 985) +++ src/os/unix/ngx_process_cycle.c (working copy) @@ -883,7 +883,9 @@ 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_set_t), (cpu_set_t *)
&cpu_affinity) + == -1) + { ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno, "sched_setaffinity(0x%08Xl) failed", cpu_affinity); }