Commit a58d4e12 authored by Eric Covener's avatar Eric Covener
Browse files

Merge from trunk:

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.


  *) worker, prefork: save some cycles by not copying the listener's pollfds
                      for each pollset operation
     trunk patch: http://svn.apache.org/r1662437
     2.4.x patch: svn merge -c 1662437 ^/httpd/httpd/trunk .
     +1: jailletc36, ylavic, jim

Submitted By: jailletc36
Reviewed By: jailletc36, ylavic, jim



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@1797651 13f79535-47bb-0310-9956-ffa450edef68
parent 570a4e6b
Loading
Loading
Loading
Loading
+8 −7
Original line number Diff line number Diff line
@@ -450,7 +450,8 @@ static void child_main(int child_num_arg, int child_bucket)
    (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");
@@ -458,14 +459,14 @@ static void child_main(int child_num_arg, int child_bucket)
    }

    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,
+8 −7
Original line number Diff line number Diff line
@@ -549,7 +549,8 @@ static void * APR_THREAD_FUNC listener_thread(apr_thread_t *thd, void * dummy)

    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;"
@@ -559,14 +560,14 @@ static void * APR_THREAD_FUNC listener_thread(apr_thread_t *thd, void * dummy)
    }

    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;"