---------------------
PatchSet 2665 
Date: 2001/07/25 12:53:23
Author: hno
Branch: hno-2_2-mara
Tag: (none) 
Log:
Don't know..

Members: 
	build.sh:1.1.2.2->1.1.2.3 
	src/aiops.c:1.1.1.2.2.1.2.9.2.1->1.1.1.2.2.1.2.9.2.2 
	src/comm_select.c:1.1.1.2.2.1.2.5->1.1.1.2.2.1.2.5.2.1 

Index: squid/build.sh
===================================================================
RCS file: /cvsroot/squid-sf//squid/Attic/build.sh,v
retrieving revision 1.1.2.2
retrieving revision 1.1.2.3
diff -u -r1.1.2.2 -r1.1.2.3
--- squid/build.sh	18 Dec 2000 09:10:00 -0000	1.1.2.2
+++ squid/build.sh	25 Jul 2001 12:53:23 -0000	1.1.2.3
@@ -9,7 +9,7 @@
 	sh icons.shar
     )
 fi
-ulimit -HSn 4000
+ulimit -HSn 6000
 CACHE_HTTP_PORT=80 $s/configure  --prefix=/usr \
     --exec_prefix=/usr --bindir=/usr/sbin --libexecdir=/squid/usr/lib/squid \
     --localstatedir=/squid/var --sysconfdir=/squid/etc --enable-poll \
Index: squid/src/aiops.c
===================================================================
RCS file: /cvsroot/squid-sf//squid/src/Attic/aiops.c,v
retrieving revision 1.1.1.2.2.1.2.9.2.1
retrieving revision 1.1.1.2.2.1.2.9.2.2
diff -u -r1.1.1.2.2.1.2.9.2.1 -r1.1.1.2.2.1.2.9.2.2
--- squid/src/aiops.c	7 Jun 2001 10:00:00 -0000	1.1.1.2.2.1.2.9.2.1
+++ squid/src/aiops.c	25 Jul 2001 12:53:23 -0000	1.1.1.2.2.1.2.9.2.2
@@ -1,5 +1,5 @@
 /*
- * $Id: aiops.c,v 1.1.1.2.2.1.2.9.2.1 2001/06/07 10:00:00 hno Exp $
+ * $Id: aiops.c,v 1.1.1.2.2.1.2.9.2.2 2001/07/25 12:53:23 hno Exp $
  *
  * DEBUG: section 43    AIOPS
  * AUTHOR: Stewart Forster <slf@connect.com.au>
@@ -96,6 +96,7 @@
     aio_request_t * volatile * volatile tailp;
     unsigned long requests;
     unsigned long blocked; /* main failed to lock the queue */
+    unsigned long len;
 } aio_request_queue_t;
 
 typedef struct aio_thread_t aio_thread_t;
@@ -141,11 +142,11 @@
 #ifdef ASYNC_IO_THREADS
 #define NUMTHREADS ASYNC_IO_THREADS
 #else
-#define NUMTHREADS (Config.cacheSwap.n_configured*8)
+#define NUMTHREADS (Config.cacheSwap.n_configured*12)
 #endif
 
 /* Where we start to defer new disk operations (swapout) (!agressive) */
-#define MAGIC1 (NUMTHREADS/2)
+#define MAGIC1 (NUMTHREADS)
 #define MAGIC1TIME 2
 /* Where we defer all new disk operations (swapin) */
 #define MAGIC2 (MAGIC1*4/3)
@@ -169,7 +170,8 @@
 static MemPool *aio_request_pool = NULL;
 static MemPool *aio_thread_pool = NULL;
 static aio_request_queue_t request_queue;
-static struct { aio_request_t *head, **tailp; } request_queue2 = { NULL, &request_queue2.head };
+static struct { aio_request_t *head, **tailp; unsigned int len; } request_queue2 = { NULL, &request_queue2.head, 0 };
+int aio_requests_done = 0;
 static aio_request_queue_t done_queue;
 static struct { aio_request_t *head, **tailp; } done_requests = { NULL, &done_requests.head };
 static pthread_attr_t globattr;
@@ -277,6 +279,7 @@
     request_queue.tailp = &request_queue.head;
     request_queue.requests = 0;
     request_queue.blocked = 0;
+    request_queue.len = 0;
 
     /* Initialize done queue */
     if (pthread_mutex_init(&(done_queue.mutex), NULL))
@@ -284,9 +287,11 @@
     if (pthread_cond_init(&(done_queue.cond), NULL))
 	fatal("Failed to create condition variable");
     done_queue.head = NULL;
+    aio_requests_done = 0;
     done_queue.tailp = &done_queue.head;
     done_queue.requests = 0;
     done_queue.blocked = 0;
+    done_queue.len = 0;
 
     /* Create threads and get them to sit in their wait loop */
     aio_thread_pool = memPoolCreate("aio_thread", sizeof(aio_thread_t));
@@ -355,10 +360,14 @@
 	    pthread_cond_wait(&request_queue.cond, &request_queue.mutex);
 	}
 	request = request_queue.head;
-	if (request)
+	if (request) {
+	    request_queue.len--;
 	    request_queue.head = request->next;
 	    if (!request_queue.head)
 		request_queue.tailp = &request_queue.head;
+	} else {
+	    request_queue.len = 0;
+	}
 	pthread_mutex_unlock(&request_queue.mutex);
 	/* process the request */
 	threadp->status = _THREAD_BUSY;
@@ -407,6 +416,7 @@
 	pthread_mutex_lock(&done_queue.mutex);
 	*done_queue.tailp = request;
 	done_queue.tailp = &request->next;
+	aio_requests_done++;
 	pthread_mutex_unlock(&done_queue.mutex);
 	threadp->requests++;
     }				/* while forever */
@@ -429,27 +439,31 @@
     if (!request_queue2.head) {
 	if (pthread_mutex_trylock(&request_queue.mutex) == 0) {
 	    /* Normal path */
+	    request_queue.len++;
 	    *request_queue.tailp = request;
 	    request_queue.tailp = &request->next;
 	    pthread_cond_signal(&request_queue.cond);
 	    pthread_mutex_unlock(&request_queue.mutex);
-    } else {
+	} else {
 	    /* Oops, the request queue is blocked, use request_queue2 */
+	    request_queue2.len++;
 	    *request_queue2.tailp = request;
 	    request_queue2.tailp = &request->next;
-    }
+	}
     } else {
 	/* Secondary path. We have blocked requests to deal with */
 	/* add the request to the chain */
 	*request_queue2.tailp = request;
 	if (pthread_mutex_trylock(&request_queue.mutex) == 0) {
 	    /* Ok, the queue is no longer blocked */
+	    request_queue.len += request_queue2.len;
 	    *request_queue.tailp = request_queue2.head;
 	    request_queue.tailp = &request->next;
 	    pthread_cond_signal(&request_queue.cond);
 	    pthread_mutex_unlock(&request_queue.mutex);
 	    request_queue2.head = NULL;
 	    request_queue2.tailp = &request_queue2.head;
+	    request_queue2.len = 0;
 	} else {
 	    /* still blocked, bump the blocked request chain */
 	    request_queue2.tailp = &request->next;
@@ -778,6 +792,7 @@
     if (done_queue.head && pthread_mutex_trylock(&done_queue.mutex) == 0) {
 	struct aio_request_t *requests = done_queue.head;
 	done_queue.head = NULL;
+	aio_requests_done = 0;
 	done_queue.tailp = &done_queue.head;
 	pthread_mutex_unlock(&done_queue.mutex);
 	*done_requests.tailp = requests;
@@ -791,7 +806,6 @@
     /* Give up the CPU to allow the thread to do their work */
     if (done_queue.head || request_queue.head)
 	sched_yield();
-
 }
 
 aio_result_t *
@@ -838,7 +852,7 @@
 {
     static time_t last_warn = 0;
     static time_t high_start = 0;
-    int load = aio_operations_pending();
+    int load = request_queue.len;
     if (load < MAGIC1) {
 	high_start = 0;
 	return 0;
@@ -874,7 +888,7 @@
 int
 aio_get_queue_len(void)
 {
-    return request_queue_len;
+    return request_queue.len;
 }
 
 static void
Index: squid/src/comm_select.c
===================================================================
RCS file: /cvsroot/squid-sf//squid/src/comm_select.c,v
retrieving revision 1.1.1.2.2.1.2.5
retrieving revision 1.1.1.2.2.1.2.5.2.1
diff -u -r1.1.1.2.2.1.2.5 -r1.1.1.2.2.1.2.5.2.1
--- squid/src/comm_select.c	10 Nov 2000 12:38:13 -0000	1.1.1.2.2.1.2.5
+++ squid/src/comm_select.c	25 Jul 2001 12:53:23 -0000	1.1.1.2.2.1.2.5.2.1
@@ -1,6 +1,6 @@
 
 /*
- * $Id: comm_select.c,v 1.1.1.2.2.1.2.5 2000/11/10 12:38:13 hno Exp $
+ * $Id: comm_select.c,v 1.1.1.2.2.1.2.5.2.1 2001/07/25 12:53:23 hno Exp $
  *
  * DEBUG: section 5     Socket Functions
  *
@@ -128,7 +128,12 @@
 #define commCheckICPIncoming (++icp_io_events > (incoming_icp_interval>> INCOMING_FACTOR))
 #define commCheckHTTPIncoming (++http_io_events > (incoming_http_interval>> INCOMING_FACTOR))
 static int async_io_events = 0;
-#define commCheckAIO ((++async_io_events > MAGIC1 - 4) ? (async_io_events = 0, 1) : 0)
+#if USE_ASYNC_IO
+extern int aio_requests_done;
+#define commCheckAIO (aio_requests_done > 16)
+#else
+#define commCheckAIO (0)
+#endif
 
 static int
 commDeferRead(int fd)
