Worker_cpu_affinity

Hi,

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

What am I doing wrong?

Cliff

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

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.

On Wed, 2007-11-28 at 07:21 +0300, Igor S. wrote:

But I see in my error log the following:

Try the attached patch.

Same result:

2007/11/28 14:37:14 [notice] 2175#0: OS: Linux 2.6.18-028test007
2007/11/28 14:37:14 [notice] 2175#0: sysctl(KERN_RTSIGMAX): 0
2007/11/28 14:37:14 [notice] 2175#0: getrlimit(RLIMIT_NOFILE): 1024:1024
2007/11/28 14:37:14 [notice] 2176#0: start worker processes
2007/11/28 14:37:14 [notice] 2177#0: sched_setaffinity(0x00000001)
2007/11/28 14:37:14 [alert] 2177#0: sched_setaffinity(0x00000001) failed
(22: Invalid argument)
2007/11/28 14:37:14 [notice] 2176#0: start worker process 2177
2007/11/28 14:37:14 [notice] 2179#0: sched_setaffinity(0x00000002)
2007/11/28 14:37:14 [alert] 2179#0: sched_setaffinity(0x00000002) failed
(22: Invalid argument)
2007/11/28 14:37:14 [notice] 2176#0: start worker process 2179

Perhaps worth noting is that I’m running a kernel with OpenVZ patches
(although Nginx is not running in a VPS).

Regards,
Cliff

On Wed, Nov 28, 2007 at 02:47:05PM -0800, Cliff W. wrote:

2007/11/28 14:37:14 [notice] 2175#0: getrlimit(RLIMIT_NOFILE): 1024:1024
2007/11/28 14:37:14 [notice] 2176#0: start worker processes
2007/11/28 14:37:14 [notice] 2177#0: sched_setaffinity(0x00000001)
2007/11/28 14:37:14 [alert] 2177#0: sched_setaffinity(0x00000001) failed (22: Invalid argument)
2007/11/28 14:37:14 [notice] 2176#0: start worker process 2177
2007/11/28 14:37:14 [notice] 2179#0: sched_setaffinity(0x00000002)
2007/11/28 14:37:14 [alert] 2179#0: sched_setaffinity(0x00000002) failed (22: Invalid argument)
2007/11/28 14:37:14 [notice] 2176#0: start worker process 2179

Perhaps worth noting is that I’m running a kernel with OpenVZ patches
(although Nginx is not running in a VPS).

Well, I will return to sched_setaffinity after cache will be done.
Current sched_setaffinity() processing needs to be rewritten:

  1. it does not support RedHat sched_setaffinity() interface,
  2. it should use CPU_SET()/etc interface for other Linuxes.

On Thu, 2007-11-29 at 09:42 +0300, Igor S. wrote:

On Wed, Nov 28, 2007 at 02:47:05PM -0800, Cliff W. wrote:

Well, I will return to sched_setaffinity after cache will be done.
Current sched_setaffinity() processing needs to be rewritten:

  1. it does not support RedHat sched_setaffinity() interface,
  2. it should use CPU_SET()/etc interface for other Linuxes.

It’s not a big problem for me at the moment. I just wanted to report
the bug.

Regards,
Cliff