httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j..@apache.org
Subject svn commit: r1064269 - in /httpd/httpd/trunk/server/mpm: event/fdqueue.c event/fdqueue.h worker/fdqueue.c worker/fdqueue.h
Date Thu, 27 Jan 2011 19:34:38 GMT
Author: jim
Date: Thu Jan 27 19:34:38 2011
New Revision: 1064269

URL: http://svn.apache.org/viewvc?rev=1064269&view=rev
Log:
Revert an old (~10yr) change to the fd Q; move back to
FIFO rather than LIFO, for more consistent performance
so that older requests don't suffer

Modified:
    httpd/httpd/trunk/server/mpm/event/fdqueue.c
    httpd/httpd/trunk/server/mpm/event/fdqueue.h
    httpd/httpd/trunk/server/mpm/worker/fdqueue.c
    httpd/httpd/trunk/server/mpm/worker/fdqueue.h

Modified: httpd/httpd/trunk/server/mpm/event/fdqueue.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/mpm/event/fdqueue.c?rev=1064269&r1=1064268&r2=1064269&view=diff
==============================================================================
--- httpd/httpd/trunk/server/mpm/event/fdqueue.c (original)
+++ httpd/httpd/trunk/server/mpm/event/fdqueue.c Thu Jan 27 19:34:38 2011
@@ -310,6 +310,8 @@ apr_status_t ap_queue_init(fd_queue_t * 
     queue->data = apr_palloc(a, queue_capacity * sizeof(fd_queue_elem_t));
     queue->bounds = queue_capacity;
     queue->nelts = 0;
+    queue->in = 0;
+    queue->out = 0;
 
     /* Set all the sockets in the queue to NULL */
     for (i = 0; i < queue_capacity; ++i)
@@ -340,7 +342,10 @@ apr_status_t ap_queue_push(fd_queue_t * 
     AP_DEBUG_ASSERT(!queue->terminated);
     AP_DEBUG_ASSERT(!ap_queue_full(queue));
 
-    elem = &queue->data[queue->nelts];
+    elem = &queue->data[queue->in];
+    queue->in++;
+    if (queue->in >= queue->bounds)
+        queue->in -= queue->bounds;
     elem->sd = sd;
     elem->cs = cs;
     elem->p = p;
@@ -420,7 +425,11 @@ apr_status_t ap_queue_pop_something(fd_q
         APR_RING_REMOVE(*te_out, link);
     }
     else {
-        elem = &queue->data[--queue->nelts];
+        elem = &queue->data[queue->out];
+        queue->out++;
+        if (queue->out >= queue->bounds)
+            queue->out -= queue->bounds;
+        queue->nelts--;
         *sd = elem->sd;
         *cs = elem->cs;
         *p = elem->p;

Modified: httpd/httpd/trunk/server/mpm/event/fdqueue.h
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/mpm/event/fdqueue.h?rev=1064269&r1=1064268&r2=1064269&view=diff
==============================================================================
--- httpd/httpd/trunk/server/mpm/event/fdqueue.h (original)
+++ httpd/httpd/trunk/server/mpm/event/fdqueue.h Thu Jan 27 19:34:38 2011
@@ -70,8 +70,10 @@ struct fd_queue_t
 {
     APR_RING_HEAD(timers_t, timer_event_t) timers;
     fd_queue_elem_t *data;
-    int nelts;
-    int bounds;
+    unsigned int nelts;
+    unsigned int bounds;
+    unsigned int in;
+    unsigned int out;
     apr_thread_mutex_t *one_big_mutex;
     apr_thread_cond_t *not_empty;
     int terminated;

Modified: httpd/httpd/trunk/server/mpm/worker/fdqueue.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/mpm/worker/fdqueue.c?rev=1064269&r1=1064268&r2=1064269&view=diff
==============================================================================
--- httpd/httpd/trunk/server/mpm/worker/fdqueue.c (original)
+++ httpd/httpd/trunk/server/mpm/worker/fdqueue.c Thu Jan 27 19:34:38 2011
@@ -284,6 +284,8 @@ apr_status_t ap_queue_init(fd_queue_t *q
     queue->data = apr_palloc(a, queue_capacity * sizeof(fd_queue_elem_t));
     queue->bounds = queue_capacity;
     queue->nelts = 0;
+    queue->in = 0;
+    queue->out = 0;
 
     /* Set all the sockets in the queue to NULL */
     for (i = 0; i < queue_capacity; ++i)
@@ -312,7 +314,10 @@ apr_status_t ap_queue_push(fd_queue_t *q
     AP_DEBUG_ASSERT(!queue->terminated);
     AP_DEBUG_ASSERT(!ap_queue_full(queue));
 
-    elem = &queue->data[queue->nelts];
+    elem = &queue->data[queue->in];
+    queue->in++;
+    if (queue->in >= queue->bounds)
+        queue->in -= queue->bounds;
     elem->sd = sd;
     elem->p = p;
     queue->nelts++;
@@ -361,7 +366,11 @@ apr_status_t ap_queue_pop(fd_queue_t *qu
         }
     }
 
-    elem = &queue->data[--queue->nelts];
+    elem = &queue->data[queue->out];
+    queue->out++;
+    if (queue->out >= queue->bounds)
+        queue->out -= queue->bounds;
+    queue->nelts--;
     *sd = elem->sd;
     *p = elem->p;
 #ifdef AP_DEBUG

Modified: httpd/httpd/trunk/server/mpm/worker/fdqueue.h
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/mpm/worker/fdqueue.h?rev=1064269&r1=1064268&r2=1064269&view=diff
==============================================================================
--- httpd/httpd/trunk/server/mpm/worker/fdqueue.h (original)
+++ httpd/httpd/trunk/server/mpm/worker/fdqueue.h Thu Jan 27 19:34:38 2011
@@ -55,8 +55,10 @@ typedef struct fd_queue_elem_t fd_queue_
 
 struct fd_queue_t {
     fd_queue_elem_t    *data;
-    int                 nelts;
-    int                 bounds;
+    unsigned int       nelts;
+    unsigned int       bounds;
+    unsigned int       in;
+    unsigned int       out;
     apr_thread_mutex_t *one_big_mutex;
     apr_thread_cond_t  *not_empty;
     int                 terminated;



Mime
View raw message