You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by yl...@apache.org on 2015/02/26 13:54:23 UTC
svn commit: r1662437 - in /httpd/httpd/trunk/server/mpm: prefork/prefork.c
worker/worker.c
Author: ylavic
Date: Thu Feb 26 12:54:23 2015
New Revision: 1662437
URL: http://svn.apache.org/r1662437
Log:
mpm_{worker,prefork}: save some cycles by not copying the listener's pollfds
for each pollset operation.
We don't need a copy when poll()ing if those are allocated with the correct
lifetime (the listener thread) at the very beginning.
Modified:
httpd/httpd/trunk/server/mpm/prefork/prefork.c
httpd/httpd/trunk/server/mpm/worker/worker.c
Modified: httpd/httpd/trunk/server/mpm/prefork/prefork.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/mpm/prefork/prefork.c?rev=1662437&r1=1662436&r2=1662437&view=diff
==============================================================================
--- httpd/httpd/trunk/server/mpm/prefork/prefork.c (original)
+++ httpd/httpd/trunk/server/mpm/prefork/prefork.c Thu Feb 26 12:54:23 2015
@@ -570,7 +570,8 @@ static void child_main(int child_num_arg
(void) ap_update_child_status(sbh, SERVER_READY, (request_rec *) NULL);
/* Set up the pollfd array */
- status = apr_pollset_create(&pollset, num_listensocks, pchild, 0);
+ status = apr_pollset_create(&pollset, num_listensocks, pchild,
+ APR_POLLSET_NOCOPY);
if (status != APR_SUCCESS) {
ap_log_error(APLOG_MARK, APLOG_EMERG, status, ap_server_conf, APLOGNO(00156)
"Couldn't create pollset in child; check system or user limits");
@@ -578,14 +579,14 @@ static void child_main(int child_num_arg
}
for (lr = my_bucket->listeners, i = num_listensocks; i--; lr = lr->next) {
- apr_pollfd_t pfd = { 0 };
+ apr_pollfd_t *pfd = apr_pcalloc(pchild, sizeof *pfd);
- pfd.desc_type = APR_POLL_SOCKET;
- pfd.desc.s = lr->sd;
- pfd.reqevents = APR_POLLIN;
- pfd.client_data = lr;
+ pfd->desc_type = APR_POLL_SOCKET;
+ pfd->desc.s = lr->sd;
+ pfd->reqevents = APR_POLLIN;
+ pfd->client_data = lr;
- status = apr_pollset_add(pollset, &pfd);
+ status = apr_pollset_add(pollset, pfd);
if (status != APR_SUCCESS) {
/* If the child processed a SIGWINCH before setting up the
* pollset, this error path is expected and harmless,
Modified: httpd/httpd/trunk/server/mpm/worker/worker.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/mpm/worker/worker.c?rev=1662437&r1=1662436&r2=1662437&view=diff
==============================================================================
--- httpd/httpd/trunk/server/mpm/worker/worker.c (original)
+++ httpd/httpd/trunk/server/mpm/worker/worker.c Thu Feb 26 12:54:23 2015
@@ -705,7 +705,8 @@ static void * APR_THREAD_FUNC listener_t
free(ti);
- rv = apr_pollset_create(&pollset, num_listensocks, tpool, 0);
+ rv = apr_pollset_create(&pollset, num_listensocks, tpool,
+ APR_POLLSET_NOCOPY);
if (rv != APR_SUCCESS) {
ap_log_error(APLOG_MARK, APLOG_EMERG, rv, ap_server_conf,
"Couldn't create pollset in thread;"
@@ -715,14 +716,14 @@ static void * APR_THREAD_FUNC listener_t
}
for (lr = my_bucket->listeners; lr != NULL; lr = lr->next) {
- apr_pollfd_t pfd = { 0 };
+ apr_pollfd_t *pfd = apr_pcalloc(tpool, sizeof *pfd);
- pfd.desc_type = APR_POLL_SOCKET;
- pfd.desc.s = lr->sd;
- pfd.reqevents = APR_POLLIN;
- pfd.client_data = lr;
+ pfd->desc_type = APR_POLL_SOCKET;
+ pfd->desc.s = lr->sd;
+ pfd->reqevents = APR_POLLIN;
+ pfd->client_data = lr;
- rv = apr_pollset_add(pollset, &pfd);
+ rv = apr_pollset_add(pollset, pfd);
if (rv != APR_SUCCESS) {
ap_log_error(APLOG_MARK, APLOG_EMERG, rv, ap_server_conf,
"Couldn't create add listener to pollset;"