ASF Bugzilla – Attachment 34142 Details for
Bug 57399
Many unnecessary CPU wakeups per second
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Introduce APR_POLLSET_WAKEABLE in mpm-event
mod_event_wakeup.patch (text/plain), 3.33 KB, created by
Luca Toscano
on 2016-08-12 06:53:04 UTC
(
hide
)
Description:
Introduce APR_POLLSET_WAKEABLE in mpm-event
Filename:
MIME Type:
Creator:
Luca Toscano
Created:
2016-08-12 06:53:04 UTC
Size:
3.33 KB
patch
obsolete
>Index: server/mpm/event/event.c >=================================================================== >--- server/mpm/event/event.c (revision 1755793) >+++ server/mpm/event/event.c (working copy) >@@ -182,6 +182,7 @@ > static int workers_may_exit = 0; > static int start_thread_may_exit = 0; > static int listener_may_exit = 0; >+static int listener_is_wakeable = 0; /* Pollset supports APR_POLLSET_WAKEABLE */ > static int num_listensocks = 0; > static apr_int32_t conns_this_child; /* MaxConnectionsPerChild, only access > in listener thread */ >@@ -493,6 +494,11 @@ > return; > } > >+ /* A wakeable listener might be blocked indefinitely on apr_pollset_poll. */ >+ if (listener_is_wakeable) { >+ apr_pollset_wakeup(event_pollset); >+ } >+ > /* unblock the listener if it's waiting for a worker */ > ap_queue_info_term(worker_queue_info); > >@@ -696,7 +702,11 @@ > default: > break; > } >- apr_atomic_dec32(&connection_count); >+ /* Unblock the wakeable listener waiting for connection_count = 0. */ >+ if (!apr_atomic_dec32(&connection_count) >+ && listener_may_exit && listener_is_wakeable) { >+ apr_pollset_wakeup(event_pollset); >+ } > return APR_SUCCESS; > } > >@@ -1523,6 +1533,13 @@ > if (insert) { > /* Okay, add sorted by when.. */ > apr_skiplist_insert(timer_skiplist, te); >+ /* >+ * Force apr_pollset_poll to wake up the listener since it might need >+ * to process a new timer. >+ */ >+ if (listener_is_wakeable) { >+ apr_pollset_wakeup(event_pollset); >+ } > } > apr_thread_mutex_unlock(g_timer_skiplist_mtx); > >@@ -1832,7 +1849,18 @@ > } > } > else { >- timeout_interval = apr_time_from_msec(100); >+ /* >+ * If the listener is wakeable and there are no timers >+ * in the skiplist, it can sleep indefinitely >+ * until an event occurs. The listener will be woken up >+ * via apr_pollset_wakeup calls. >+ */ >+ if (listener_is_wakeable) { >+ timeout_interval = -1; >+ } else { >+ /* The listener is not wakeable so polling must be performed. */ >+ timeout_interval = apr_time_from_msec(100); >+ } > } > while (te) { > if (te->when < now + EVENT_FUDGE_FACTOR) { >@@ -2385,13 +2413,16 @@ > * connections in K-A or lingering > * close? > */ >- pchild, APR_POLLSET_THREADSAFE | APR_POLLSET_NOCOPY | APR_POLLSET_NODEFAULT, >+ pchild, APR_POLLSET_THREADSAFE | APR_POLLSET_NOCOPY >+ | APR_POLLSET_NODEFAULT | APR_POLLSET_WAKEABLE, > good_methods[i]); > if (rv == APR_SUCCESS) { >+ listener_is_wakeable = 1; > break; > } > } > if (rv != APR_SUCCESS) { >+ listener_is_wakeable = 0; > rv = apr_pollset_create(&event_pollset, > threads_per_child*2, /* XXX don't we need more, to handle > * connections in K-A or lingering
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 57399
:
34142
|
34167
|
34263
|
34264
|
34300
|
34301
|
34557
|
34641