[master] 18c6a9a1a wrk: Only queue tasks that fit in the reserve

Dridi Boukelmoune dridi.boukelmoune at gmail.com
Mon Aug 29 13:42:07 UTC 2022


commit 18c6a9a1acc8c97af865aba5a5c301dcb97e54c7
Author: Dridi Boukelmoune <dridi.boukelmoune at gmail.com>
Date:   Mon Jul 18 17:31:44 2022 +0200

    wrk: Only queue tasks that fit in the reserve

diff --git a/bin/varnishd/cache/cache_wrk.c b/bin/varnishd/cache/cache_wrk.c
index 9bbd8f3f7..0b8bd087e 100644
--- a/bin/varnishd/cache/cache_wrk.c
+++ b/bin/varnishd/cache/cache_wrk.c
@@ -331,9 +331,12 @@ Pool_Task(struct pool *pp, struct pool_task *task, enum task_prio prio)
 		return (0);
 	}
 
-	/* Vital work is always queued.
+	/* Vital work is always queued. Only priority classes that can
+	 * fit under the reserve capacity are eligible to queuing.
 	 */
-	if (!TASK_QUEUE_LIMITED(prio) ||
+	if (prio >= TASK_QUEUE_RESERVE) {
+		retval = -1;
+	} else if (!TASK_QUEUE_LIMITED(prio) ||
 	    pp->lqueue + pp->nthr < cache_param->wthread_max +
 	    cache_param->wthread_queue_limit) {
 		pp->nqueued++;


More information about the varnish-commit mailing list