[nginx] svn commit: r4507 - in branches/stable-1.0: . auto src/os/unix
mdounin at mdounin.ru
mdounin at mdounin.ru
Mon Mar 5 12:10:10 UTC 2012
Author: mdounin
Date: 2012-03-05 12:10:09 +0000 (Mon, 05 Mar 2012)
New Revision: 4507
Log:
Merge of r4460: ngx_ncpu detection for most *nix platforms.
This inaccurate detection by using sysconf(_SC_NPROCESSORS_ONLN) can improve
usage of the mutex lock optimization on multicore systems.
Modified:
branches/stable-1.0/
branches/stable-1.0/auto/unix
branches/stable-1.0/src/os/unix/ngx_posix_init.c
Property changes on: branches/stable-1.0
___________________________________________________________________
Modified: svn:mergeinfo
- /trunk:3960-3974,3977-3987,3991-3996,3998,4000-4018,4020,4023,4025-4027,4034-4065,4073,4077,4086-4090,4094-4102,4106-4108,4113-4114,4129-4137,4143-4144,4147-4158,4177,4179,4182-4184,4186-4187,4189-4205,4207,4209-4210,4212,4217-4223,4227-4232,4235-4237,4265-4268,4270,4274-4276,4278-4280,4282-4284,4294-4295,4298,4300-4309,4313,4315,4320-4321,4326-4327,4335-4336,4338-4343,4372-4375,4377,4379,4381-4385,4393,4396,4398,4400-4406,4413,4415-4416,4422-4423
+ /trunk:3960-3974,3977-3987,3991-3996,3998,4000-4018,4020,4023,4025-4027,4034-4065,4073,4077,4086-4090,4094-4102,4106-4108,4113-4114,4129-4137,4143-4144,4147-4158,4177,4179,4182-4184,4186-4187,4189-4205,4207,4209-4210,4212,4217-4223,4227-4232,4235-4237,4265-4268,4270,4274-4276,4278-4280,4282-4284,4294-4295,4298,4300-4309,4313,4315,4320-4321,4326-4327,4335-4336,4338-4343,4372-4375,4377,4379,4381-4385,4393,4396,4398,4400-4406,4413,4415-4416,4422-4423,4460
Modified: branches/stable-1.0/auto/unix
===================================================================
--- branches/stable-1.0/auto/unix 2012-03-05 11:47:25 UTC (rev 4506)
+++ branches/stable-1.0/auto/unix 2012-03-05 12:10:09 UTC (rev 4507)
@@ -707,3 +707,13 @@
ngx_feature_libs=
ngx_feature_test="struct dirent dir; dir.d_type = DT_REG"
. auto/feature
+
+
+ngx_feature="sysconf(_SC_NPROCESSORS_ONLN)"
+ngx_feature_name="NGX_HAVE_SC_NPROCESSORS_ONLN"
+ngx_feature_run=no
+ngx_feature_incs=
+ngx_feature_path=
+ngx_feature_libs=
+ngx_feature_test="sysconf(_SC_NPROCESSORS_ONLN)"
+. auto/feature
Modified: branches/stable-1.0/src/os/unix/ngx_posix_init.c
===================================================================
--- branches/stable-1.0/src/os/unix/ngx_posix_init.c 2012-03-05 11:47:25 UTC (rev 4506)
+++ branches/stable-1.0/src/os/unix/ngx_posix_init.c 2012-03-05 12:10:09 UTC (rev 4507)
@@ -47,7 +47,13 @@
for (n = ngx_pagesize; n >>= 1; ngx_pagesize_shift++) { /* void */ }
+#if (NGX_HAVE_SC_NPROCESSORS_ONLN)
if (ngx_ncpu == 0) {
+ ngx_ncpu = sysconf(_SC_NPROCESSORS_ONLN);
+ }
+#endif
+
+ if (ngx_ncpu < 1) {
ngx_ncpu = 1;
}
More information about the nginx-devel
mailing list