Return-Path: X-Original-To: apmail-httpd-cvs-archive@www.apache.org Delivered-To: apmail-httpd-cvs-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 0553A17374 for ; Thu, 26 Feb 2015 12:54:40 +0000 (UTC) Received: (qmail 74528 invoked by uid 500); 26 Feb 2015 12:54:24 -0000 Delivered-To: apmail-httpd-cvs-archive@httpd.apache.org Received: (qmail 74465 invoked by uid 500); 26 Feb 2015 12:54:24 -0000 Mailing-List: contact cvs-help@httpd.apache.org; run by ezmlm Precedence: bulk Reply-To: dev@httpd.apache.org list-help: list-unsubscribe: List-Post: List-Id: Delivered-To: mailing list cvs@httpd.apache.org Received: (qmail 74456 invoked by uid 99); 26 Feb 2015 12:54:24 -0000 Received: from eris.apache.org (HELO hades.apache.org) (140.211.11.105) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 26 Feb 2015 12:54:24 +0000 Received: from hades.apache.org (localhost [127.0.0.1]) by hades.apache.org (ASF Mail Server at hades.apache.org) with ESMTP id BEE60AC006C for ; Thu, 26 Feb 2015 12:54:23 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1662437 - in /httpd/httpd/trunk/server/mpm: prefork/prefork.c worker/worker.c Date: Thu, 26 Feb 2015 12:54:23 -0000 To: cvs@httpd.apache.org From: ylavic@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20150226125423.BEE60AC006C@hades.apache.org> 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;"