Only in httpd-trunk.new: 1
diff -ru httpd-trunk/server/mpm/event/event.c httpd-trunk.new/server/mpm/event/event.c
--- httpd-trunk/server/mpm/event/event.c	2014-10-05 13:32:37.258992697 -0400
+++ httpd-trunk.new/server/mpm/event/event.c	2014-10-05 17:02:34.826909650 -0400
@@ -358,6 +358,7 @@
 #define MAX_SPAWN_RATE        (32)
 #endif
     int hold_off_on_exponential_spawning;
+    int *bucket; /* bucket array for the httpd child processes */
 } event_retained_data;
 static event_retained_data *retained;
 
@@ -366,7 +367,6 @@
 static ap_pod_t **pod;
 static ap_pod_t *child_pod;
 static ap_listen_rec *child_listen;
-static int *bucket;    /* bucket array for the httpd child processes */
 
 /* The event MPM respects a couple of runtime flags that can aid
  * in debugging. Setting the -DNO_DETACH flag will prevent the root process
@@ -2430,7 +2430,7 @@
 
     /* close unused listeners and pods */
     for (i = 0; i < num_buckets; i++) {
-        if (i != bucket[child_num_arg]) {
+        if (i != retained->bucket[child_num_arg]) {
             lr = mpm_listen[i];
             while(lr) {
                 apr_socket_close(lr->sd);
@@ -2597,8 +2597,8 @@
         retained->max_daemons_limit = slot + 1;
     }
 
-    child_listen = mpm_listen[bucket[slot]];
-    child_pod = pod[bucket[slot]];
+    child_listen = mpm_listen[retained->bucket[slot]];
+    child_pod = pod[retained->bucket[slot]];
 
     if (one_process) {
         set_signals();
@@ -2667,7 +2667,7 @@
         if (ap_scoreboard_image->parent[i].pid != 0) {
             continue;
         }
-        bucket[i] = i % num_buckets;
+        retained->bucket[i] = i % num_buckets;
         if (make_child(ap_server_conf, i) < 0) {
             break;
         }
@@ -2733,7 +2733,7 @@
                                    for loop if no pid?  not much else matters */
                 if (status <= SERVER_READY && !ps->quiescing && !ps->not_accepting
                     && ps->generation == retained->my_generation &&
-                    bucket[i] == child_bucket)
+                    retained->bucket[i] == child_bucket)
                 {
                     ++idle_thread_count;
                 }
@@ -2840,7 +2840,7 @@
                              idle_thread_count, total_non_dead);
             }
             for (i = 0; i < free_length; ++i) {
-                bucket[free_slots[i]] = child_bucket;
+                retained->bucket[free_slots[i]] = child_bucket;
                 make_child(ap_server_conf, free_slots[i]);
             }
             /* the next time around we want to spawn twice as many if this
@@ -2912,7 +2912,7 @@
                 ap_scoreboard_image->parent[child_slot].quiescing = 0;
                 if (processed_status == APEXIT_CHILDSICK) {
                     /* resource shortage, minimize the fork rate */
-                    retained->idle_spawn_rate[bucket[child_slot]] = 1;
+                    retained->idle_spawn_rate[retained->bucket[child_slot]] = 1;
                 }
                 else if (remaining_children_to_start
                          && child_slot < ap_daemons_limit) {
@@ -2996,11 +2996,12 @@
         ap_scoreboard_image->global->running_generation = retained->my_generation;
     }
 
-    bucket = apr_palloc(_pconf, sizeof(int) *  ap_daemons_limit);
-
     restart_pending = shutdown_pending = 0;
     set_signals();
     /* Don't thrash... */
+    if (min_spare_threads < num_buckets * threads_per_child) {
+        min_spare_threads = num_buckets * threads_per_child;
+    }
     if (max_spare_threads < min_spare_threads + threads_per_child * num_buckets)
         max_spare_threads = min_spare_threads + threads_per_child * num_buckets;
 
@@ -3013,6 +3014,9 @@
      * that, so we'll just keep track of how many we're
      * supposed to start up without the 1 second penalty between each fork.
      */
+    if (ap_daemons_to_start < num_buckets) {
+        ap_daemons_to_start = num_buckets;
+    }
     remaining_children_to_start = ap_daemons_to_start;
     if (remaining_children_to_start > ap_daemons_limit) {
         remaining_children_to_start = ap_daemons_limit;
@@ -3195,8 +3199,8 @@
 
     enable_default_listener = 1;
     if (have_so_reuseport) {
-#ifdef _SC_NPROCESSORS_ONLN
-        num_of_cores = sysconf(_SC_NPROCESSORS_ONLN);
+#ifdef _SC_NPROCESSORS_CONF
+        num_of_cores = sysconf(_SC_NPROCESSORS_CONF);
 #else
         num_of_cores = 1;
 #endif
@@ -3270,10 +3274,13 @@
                          "atomics not working as expected - add32 of negative number");
             return HTTP_INTERNAL_SERVER_ERROR;
         }
-        retained->idle_spawn_rate = apr_palloc(pconf, sizeof(int) * num_buckets);
+        retained->idle_spawn_rate = apr_palloc(ap_server_conf->process->pool,
+                                               sizeof(int) * num_buckets);
         for (i = 0; i< num_buckets; i++) {
             retained->idle_spawn_rate[i] = 1;
         }
+        retained->bucket = apr_palloc(ap_server_conf->process->pool,
+                                      sizeof(int) * ap_daemons_limit);
         rv = apr_pollset_create(&event_pollset, 1, plog,
                                 APR_POLLSET_THREADSAFE | APR_POLLSET_NOCOPY);
         if (rv != APR_SUCCESS) {
diff -ru httpd-trunk/server/mpm/prefork/prefork.c httpd-trunk.new/server/mpm/prefork/prefork.c
--- httpd-trunk/server/mpm/prefork/prefork.c	2014-10-05 13:32:37.044992700 -0400
+++ httpd-trunk.new/server/mpm/prefork/prefork.c	2014-10-05 16:36:18.281931158 -0400
@@ -100,7 +100,6 @@
 static ap_pod_t *child_pod;
 static apr_proc_mutex_t *child_mutex;
 static ap_listen_rec *child_listen;
-static int *bucket;    /* bucket array for the httpd child processes */
 
 
 /* data retained by prefork across load/unload of the module
@@ -130,6 +129,7 @@
 #define MAX_SPAWN_RATE  (32)
 #endif
     int hold_off_on_exponential_spawning;
+    int *bucket; /* bucket array for the httpd child processes */
 } prefork_retained_data;
 static prefork_retained_data *retained;
 
@@ -534,7 +534,7 @@
 
     /* close unused listeners and pods */
     for (i = 0; i < num_buckets; i++) {
-        if (i != bucket[my_child_num]) {
+        if (i != retained->bucket[my_child_num]) {
             lr = mpm_listen[i];
             while(lr) {
                 apr_socket_close(lr->sd);
@@ -758,9 +758,9 @@
         retained->max_daemons_limit = slot + 1;
     }
 
-    child_listen = mpm_listen[bucket[slot]];
-    child_mutex = accept_mutex[bucket[slot]];
-    child_pod = pod[bucket[slot]];
+    child_listen = mpm_listen[retained->bucket[slot]];
+    child_mutex = accept_mutex[retained->bucket[slot]];
+    child_pod = pod[retained->bucket[slot]];
 
     if (one_process) {
         apr_signal(SIGHUP, sig_term);
@@ -849,7 +849,7 @@
         if (ap_scoreboard_image->servers[i][0].status != SERVER_DEAD) {
             continue;
         }
-        bucket[i] = i % num_buckets;
+        retained->bucket[i] = i % num_buckets;
         if (make_child(ap_server_conf, i) < 0) {
             break;
         }
@@ -937,7 +937,7 @@
                     idle_count, total_non_dead);
             }
             for (i = 0; i < free_length; ++i) {
-                bucket[free_slots[i]]= (++bucket_make_child_record) % num_buckets;
+                retained->bucket[free_slots[i]]= (++bucket_make_child_record) % num_buckets;
                 make_child(ap_server_conf, free_slots[i]);
             }
             /* the next time around we want to spawn twice as many if this
@@ -969,7 +969,6 @@
 
     ap_log_pid(pconf, ap_pid_fname);
 
-    bucket = apr_palloc(_pconf, sizeof(int) *  ap_daemons_limit);
     /* Initialize cross-process accept lock for each bucket*/
     accept_mutex = apr_palloc(_pconf, sizeof(apr_proc_mutex_t *) * num_buckets);
     for (i = 0; i < num_buckets; i++) {
@@ -997,11 +996,13 @@
 
     if (one_process) {
         AP_MONCONTROL(1);
-        bucket[0] = 0;
+        retained->bucket[0] = 0;
         make_child(ap_server_conf, 0);
         /* NOTREACHED */
     }
     else {
+    if (ap_daemons_min_free < num_buckets)  /* Don't thrash... */
+        ap_daemons_min_free = num_buckets;
     if (ap_daemons_max_free < ap_daemons_min_free + num_buckets)  /* Don't thrash... */
         ap_daemons_max_free = ap_daemons_min_free + num_buckets;
 
@@ -1013,6 +1014,9 @@
      * start more than that, so we'll just keep track of how many we're
      * supposed to start up without the 1 second penalty between each fork.
      */
+    if (ap_daemons_to_start < num_buckets) {
+        ap_daemons_to_start = num_buckets;
+    }
     remaining_children_to_start = ap_daemons_to_start;
     if (remaining_children_to_start > ap_daemons_limit) {
         remaining_children_to_start = ap_daemons_limit;
@@ -1310,8 +1314,8 @@
 
     enable_default_listener = 1;
     if (have_so_reuseport) {
-#ifdef _SC_NPROCESSORS_ONLN
-        num_of_cores = sysconf(_SC_NPROCESSORS_ONLN);
+#ifdef _SC_NPROCESSORS_CONF
+        num_of_cores = sysconf(_SC_NPROCESSORS_CONF);
 #else
         num_of_cores = 1;
 #endif
@@ -1370,6 +1374,8 @@
         retained = ap_retained_data_create(userdata_key, sizeof(*retained));
         retained->max_daemons_limit = -1;
         retained->idle_spawn_rate = 1;
+        retained->bucket = apr_palloc(ap_server_conf->process->pool,
+                                      sizeof(int) * ap_daemons_limit);
     }
     ++retained->module_loads;
     if (retained->module_loads == 2) {
diff -ru httpd-trunk/server/mpm/worker/worker.c httpd-trunk.new/server/mpm/worker/worker.c
--- httpd-trunk/server/mpm/worker/worker.c	2014-10-05 13:32:37.291992697 -0400
+++ httpd-trunk.new/server/mpm/worker/worker.c	2014-10-05 16:28:20.272937679 -0400
@@ -168,6 +168,7 @@
 #define MAX_SPAWN_RATE        (32)
 #endif
     int hold_off_on_exponential_spawning;
+    int *bucket; /* bucket array for the httpd child processes */
 } worker_retained_data;
 static worker_retained_data *retained;
 
@@ -226,7 +227,6 @@
 static apr_proc_mutex_t **accept_mutex;
 static apr_proc_mutex_t *child_mutex;
 static ap_listen_rec *child_listen;
-static int *bucket;    /* bucket array for the httpd child processes */
 
 #ifdef SINGLE_LISTEN_UNSERIALIZED_ACCEPT
 #define SAFE_ACCEPT(stmt) (child_listen->next ? (stmt) : APR_SUCCESS)
@@ -1237,7 +1237,7 @@
 
     /* close unused listeners and pods */
     for (i = 0; i < num_buckets; i++) {
-        if (i != bucket[child_num_arg]) {
+        if (i != retained->bucket[child_num_arg]) {
             lr = mpm_listen[i];
             while(lr) {
                 apr_socket_close(lr->sd);
@@ -1407,9 +1407,9 @@
         retained->max_daemons_limit = slot + 1;
     }
 
-    child_listen = mpm_listen[bucket[slot]];
-    child_mutex = accept_mutex[bucket[slot]];
-    child_pod = pod[bucket[slot]];
+    child_listen = mpm_listen[retained->bucket[slot]];
+    child_mutex = accept_mutex[retained->bucket[slot]];
+    child_pod = pod[retained->bucket[slot]];
 
     if (one_process) {
         set_signals();
@@ -1476,7 +1476,7 @@
         if (ap_scoreboard_image->parent[i].pid != 0) {
             continue;
         }
-        bucket[i] = i % num_buckets;
+        retained->bucket[i] = i % num_buckets;
         if (make_child(ap_server_conf, i) < 0) {
             break;
         }
@@ -1542,7 +1542,7 @@
                 if (status <= SERVER_READY &&
                         !ps->quiescing &&
                         ps->generation == retained->my_generation &&
-                        bucket[i] == child_bucket) {
+                        retained->bucket[i] == child_bucket) {
                     ++idle_thread_count;
                 }
                 if (status >= SERVER_READY && status < SERVER_GRACEFUL) {
@@ -1661,7 +1661,7 @@
                              idle_thread_count, total_non_dead);
             }
             for (i = 0; i < free_length; ++i) {
-                bucket[free_slots[i]] = child_bucket;
+                retained->bucket[free_slots[i]] = child_bucket;
                 make_child(ap_server_conf, free_slots[i]);
             }
             /* the next time around we want to spawn twice as many if this
@@ -1732,7 +1732,7 @@
                 ap_scoreboard_image->parent[child_slot].quiescing = 0;
                 if (processed_status == APEXIT_CHILDSICK) {
                     /* resource shortage, minimize the fork rate */
-                    retained->idle_spawn_rate[bucket[child_slot]] = 1;
+                    retained->idle_spawn_rate[retained->bucket[child_slot]] = 1;
                 }
                 else if (remaining_children_to_start
                     && child_slot < ap_daemons_limit) {
@@ -1804,8 +1804,6 @@
 
     ap_log_pid(pconf, ap_pid_fname);
 
-    bucket = apr_palloc(_pconf, sizeof(int) *  ap_daemons_limit);
-    /* Initialize cross-process accept lock */
     accept_mutex = apr_palloc(_pconf, sizeof(apr_proc_mutex_t *) * num_buckets);
     for (i = 0; i < num_buckets; i++) {
         rv = ap_proc_mutex_create(&accept_mutex[i], NULL, AP_ACCEPT_MUTEX_TYPE, NULL,
@@ -1830,6 +1828,9 @@
     restart_pending = shutdown_pending = 0;
     set_signals();
     /* Don't thrash... */
+    if (min_spare_threads < num_buckets * threads_per_child) {
+        min_spare_threads = num_buckets * threads_per_child;
+    }
     if (max_spare_threads < min_spare_threads + threads_per_child * num_buckets)
         max_spare_threads = min_spare_threads + threads_per_child * num_buckets;
 
@@ -1842,6 +1843,9 @@
      * that, so we'll just keep track of how many we're
      * supposed to start up without the 1 second penalty between each fork.
      */
+    if (ap_daemons_to_start < num_buckets) {
+        ap_daemons_to_start = num_buckets;
+    }
     remaining_children_to_start = ap_daemons_to_start;
     if (remaining_children_to_start > ap_daemons_limit) {
         remaining_children_to_start = ap_daemons_limit;
@@ -2023,8 +2027,8 @@
     }
     enable_default_listener = 1;
     if (have_so_reuseport) {
-#ifdef _SC_NPROCESSORS_ONLN
-        num_of_cores = sysconf(_SC_NPROCESSORS_ONLN);
+#ifdef _SC_NPROCESSORS_CONF
+        num_of_cores = sysconf(_SC_NPROCESSORS_CONF);
 #else
         num_of_cores = 1;
 #endif
@@ -2098,10 +2102,13 @@
                 return HTTP_INTERNAL_SERVER_ERROR;
             }
         }
-        retained->idle_spawn_rate = apr_palloc(pconf, sizeof(int) * num_buckets);
+        retained->idle_spawn_rate = apr_palloc(ap_server_conf->process->pool,
+                                               sizeof(int) * num_buckets);
         for (i = 0; i< num_buckets; i++) {
             retained->idle_spawn_rate[i] = 1;
         }
+        retained->bucket = apr_palloc(ap_server_conf->process->pool,
+                                      sizeof(int) * ap_daemons_limit);
     }
 
     parent_pid = ap_my_pid = getpid();
