[experimental-ims] 1cdbbff NB: Major Reorg Commit

Geoff Simmons geoff at varnish-cache.org
Tue Feb 14 17:49:28 CET 2012


commit 1cdbbff4dc0c1886e1a3535ea7580f43ea52008d
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Wed Feb 8 23:34:52 2012 +0000

    NB: Major Reorg Commit
    
    Introduce a new "backend workspace" which is used for the backend
    transactions (bereq.*, beresp.*)
    
    Together with the "client workspace" which holds the client transaction
    (req.*, resp.*) this should make memory management much simpler to
    understand.
    
    The backend workspace lives in "busyobj" rather than the worker thread,
    which therefore needs a lot less stack, allowing many more threads
    in the same space.
    
    Experiments with thread_pool_stack are encouraged, I wouldn't be
    surprised if 32k is now enough.
    
    The per-thread workspace is still around, known as the "auxiallary
    workspace", but it is down to 256 bytes and it is only used to hand
    the acceptor information off to worker threads.
    
    Once the dust settles, I may remove it entirely, but I can see a
    value of having a small amount of fast memory in a thread, so I may
    also keep it.  No promises.
    
    Ohh, and I removed a couple of small memory leaks which were only
    present in -trunk, as a result of a git-mis-merge.

diff --git a/bin/varnishd/cache/cache.h b/bin/varnishd/cache/cache.h
index 6338750..8df9591 100644
--- a/bin/varnishd/cache/cache.h
+++ b/bin/varnishd/cache/cache.h
@@ -327,7 +327,11 @@ struct worker {
 	uint32_t		*wlb, *wlp, *wle;
 	unsigned		wlr;
 
-	struct ws		ws[1];
+	/*
+	 * In practice this workspace is only used for wrk_accept now
+	 * but it might come handy later, so keep it around.  For now.
+	 */
+	struct ws		aws[1];
 
 	struct busyobj		*busyobj;
 
@@ -502,6 +506,7 @@ struct busyobj {
 	unsigned		fetch_failed;
 	struct vgz		*vgz_rx;
 
+	struct ws		ws[1];
 	struct vbc		*vbc;
 	struct http		*bereq;
 	struct http		*beresp;
diff --git a/bin/varnishd/cache/cache_acceptor.c b/bin/varnishd/cache/cache_acceptor.c
index 434b50c..9384d1c 100644
--- a/bin/varnishd/cache/cache_acceptor.c
+++ b/bin/varnishd/cache/cache_acceptor.c
@@ -228,7 +228,7 @@ VCA_FailSess(struct worker *wrk)
 	struct wrk_accept *wa;
 
 	CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC);
-	CAST_OBJ_NOTNULL(wa, (void*)wrk->ws->f, WRK_ACCEPT_MAGIC);
+	CAST_OBJ_NOTNULL(wa, (void*)wrk->aws->f, WRK_ACCEPT_MAGIC);
 	AZ(wrk->sp);
 	AZ(close(wa->acceptsock));
 	wrk->stats.sess_drop++;
@@ -246,7 +246,7 @@ VCA_SetupSess(struct worker *wrk)
 	struct wrk_accept *wa;
 
 	CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC);
-	CAST_OBJ_NOTNULL(wa, (void*)wrk->ws->f, WRK_ACCEPT_MAGIC);
+	CAST_OBJ_NOTNULL(wa, (void*)wrk->aws->f, WRK_ACCEPT_MAGIC);
 	sp = wrk->sp;
 	CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
 	sp->fd = wa->acceptsock;
diff --git a/bin/varnishd/cache/cache_busyobj.c b/bin/varnishd/cache/cache_busyobj.c
index 51207df..65791e8 100644
--- a/bin/varnishd/cache/cache_busyobj.c
+++ b/bin/varnishd/cache/cache_busyobj.c
@@ -47,7 +47,7 @@ struct vbo {
 #define VBO_MAGIC		0xde3d8223
 	struct lock		mtx;
 	unsigned		refcount;
-	uint16_t		nhttp;
+	char			*end;
 	struct busyobj		bo;
 };
 
@@ -67,7 +67,9 @@ vbo_size_calc(volatile unsigned *u)
 
 	http_space = HTTP_estimate(nhttp);
 
-	*u = sizeof(struct vbo) + http_space * 2L;
+	*u = sizeof(struct vbo) +
+	    http_space * 2L +
+	    cache_param->workspace_backend;
 }
 
 /*--------------------------------------------------------------------
@@ -91,23 +93,12 @@ static struct vbo *
 vbo_New(void)
 {
 	struct vbo *vbo;
-	uint16_t nhttp;
-	ssize_t http_space;
 	unsigned sz;
 
 	vbo = MPL_Get(vbopool, &sz);
-	nhttp = (uint16_t)cache_param->http_max_hdr;
-	http_space = HTTP_estimate(nhttp);
-	if (sizeof *vbo + 2 * http_space > sz) {
-		/* Could be transient, try again */
-		MPL_Free(vbopool, vbo);
-		vbo_size_calc(&vbosize);
-		vbo = MPL_Get(vbopool, &sz);
-		assert (sizeof *vbo + 2 * http_space <= sz);
-	}
 	AN(vbo);
 	vbo->magic = VBO_MAGIC;
-	vbo->nhttp = nhttp;
+	vbo->end = (char *)vbo + sz;
 	Lck_New(&vbo->mtx, lck_busyobj);
 	return (vbo);
 }
@@ -130,10 +121,15 @@ struct busyobj *
 VBO_GetBusyObj(struct worker *wrk)
 {
 	struct vbo *vbo = NULL;
+	uint16_t nhttp;
+	unsigned httpsz;
 	char *p;
 
 	CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC);
 
+	nhttp = (uint16_t)cache_param->http_max_hdr;
+	httpsz = HTTP_estimate(nhttp);
+
 	if (wrk->nvbo != NULL) {
 		vbo = wrk->nvbo;
 		wrk->nvbo = NULL;
@@ -151,9 +147,11 @@ VBO_GetBusyObj(struct worker *wrk)
 	vbo->bo.vbo = vbo;
 
 	p = (void*)(vbo + 1);
-	vbo->bo.bereq = HTTP_create(p, vbo->nhttp);
-	p += HTTP_estimate(vbo->nhttp);
-	vbo->bo.beresp = HTTP_create(p, vbo->nhttp);
+	vbo->bo.bereq = HTTP_create(p, nhttp);
+	p += httpsz;
+	vbo->bo.beresp = HTTP_create(p, nhttp);
+	p += httpsz;
+	WS_Init(vbo->bo.ws, "bo", p, vbo->end - p);
 
 	return (&vbo->bo);
 }
@@ -197,7 +195,7 @@ VBO_DerefBusyObj(struct worker *wrk, struct busyobj **pbo)
 
 		if (cache_param->bo_cache && wrk->nvbo == NULL)
 			wrk->nvbo = vbo;
-		else 
+		else
 			VBO_Free(&vbo);
 	}
 }
diff --git a/bin/varnishd/cache/cache_center.c b/bin/varnishd/cache/cache_center.c
index a8148b5..6692491 100644
--- a/bin/varnishd/cache/cache_center.c
+++ b/bin/varnishd/cache/cache_center.c
@@ -435,9 +435,9 @@ cnt_done(struct sess *sp, struct worker *wrk, struct req *req)
 
 	if (wrk->stats.client_req >= cache_param->wthread_stats_rate)
 		WRK_SumStat(wrk);
-	/* Reset the workspace to the session-watermark */
+
 	WS_Reset(req->ws, NULL);
-	WS_Reset(wrk->ws, NULL);
+	WS_Reset(wrk->aws, NULL);
 
 	sp->t_req = sp->t_idle;
 	i = HTC_Reinit(req->htc);
@@ -569,7 +569,7 @@ cnt_fetch(struct sess *sp, struct worker *wrk, struct req *req)
 	AZ(wrk->busyobj->should_close);
 	AZ(req->storage_hint);
 
-	http_Setup(wrk->busyobj->beresp, wrk->ws);
+	http_Setup(wrk->busyobj->beresp, wrk->busyobj->ws);
 
 	need_host_hdr = !http_GetHdr(wrk->busyobj->bereq, H_Host, NULL);
 
@@ -1230,9 +1230,8 @@ cnt_miss(struct sess *sp, struct worker *wrk, struct req *req)
 	CHECK_OBJ_NOTNULL(wrk->busyobj, BUSYOBJ_MAGIC);
 	AZ(req->obj);
 
-	WS_Reset(wrk->ws, NULL);
 	wrk->busyobj = VBO_GetBusyObj(wrk);
-	http_Setup(wrk->busyobj->bereq, wrk->ws);
+	http_Setup(wrk->busyobj->bereq, wrk->busyobj->ws);
 	http_FilterReq(sp, HTTPH_R_FETCH);
 	http_ForceGet(wrk->busyobj->bereq);
 	if (cache_param->http_gzip_support) {
@@ -1306,9 +1305,7 @@ cnt_pass(struct sess *sp, struct worker *wrk, const struct req *req)
 	AZ(wrk->busyobj);
 
 	wrk->busyobj = VBO_GetBusyObj(wrk);
-	WS_Reset(wrk->ws, NULL);
-	wrk->busyobj = VBO_GetBusyObj(wrk);
-	http_Setup(wrk->busyobj->bereq, wrk->ws);
+	http_Setup(wrk->busyobj->bereq, wrk->busyobj->ws);
 	http_FilterReq(sp, HTTPH_R_PASS);
 
 	VCL_pass_method(sp);
@@ -1362,9 +1359,7 @@ cnt_pipe(struct sess *sp, struct worker *wrk, const struct req *req)
 
 	wrk->acct_tmp.pipe++;
 	wrk->busyobj = VBO_GetBusyObj(wrk);
-	WS_Reset(wrk->ws, NULL);
-	wrk->busyobj = VBO_GetBusyObj(wrk);
-	http_Setup(wrk->busyobj->bereq, wrk->ws);
+	http_Setup(wrk->busyobj->bereq, wrk->busyobj->ws);
 	http_FilterReq(sp, 0);
 
 	VCL_pipe_method(sp);
@@ -1674,7 +1669,7 @@ CNT_Session(struct sess *sp)
 		CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
 		CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC);
 		CHECK_OBJ_ORNULL(wrk->nobjhead, OBJHEAD_MAGIC);
-		WS_Assert(wrk->ws);
+		WS_Assert(wrk->aws);
 
 		switch (sp->step) {
 #define STEP(l,u,arg) \
@@ -1688,7 +1683,7 @@ CNT_Session(struct sess *sp)
 		default:
 			WRONG("State engine misfire");
 		}
-		WS_Assert(wrk->ws);
+		WS_Assert(wrk->aws);
 		CHECK_OBJ_ORNULL(wrk->nobjhead, OBJHEAD_MAGIC);
 	}
 	WSL_Flush(wrk, 0);
diff --git a/bin/varnishd/cache/cache_cli.c b/bin/varnishd/cache/cache_cli.c
index de8265d..dd76c91 100644
--- a/bin/varnishd/cache/cache_cli.c
+++ b/bin/varnishd/cache/cache_cli.c
@@ -129,6 +129,7 @@ cli_debug_sizeof(struct cli *cli, const char * const *av, void *priv)
 	SZOF(struct worker);
 	SZOF(struct wrk_accept);
 	SZOF(struct storage);
+	SZOF(struct busyobj);
 	SZOF(struct object);
 	SZOF(struct objcore);
 	SZOF(struct objhead);
diff --git a/bin/varnishd/cache/cache_esi_deliver.c b/bin/varnishd/cache/cache_esi_deliver.c
index a9bc694..9747919 100644
--- a/bin/varnishd/cache/cache_esi_deliver.c
+++ b/bin/varnishd/cache/cache_esi_deliver.c
@@ -67,7 +67,7 @@ ved_include(struct sess *sp, const char *src, const char *host)
 
 	/* Take a workspace snapshot */
 	sp_ws_wm = WS_Snapshot(sp->req->ws);
-	wrk_ws_wm = WS_Snapshot(w->ws);
+	wrk_ws_wm = WS_Snapshot(w->aws); /* XXX ? */
 
 	http_SetH(sp->req->http, HTTP_HDR_URL, src);
 	if (host != NULL && *host != '\0')  {
@@ -111,7 +111,7 @@ ved_include(struct sess *sp, const char *src, const char *host)
 
 	/* Reset the workspace */
 	WS_Reset(sp->req->ws, sp_ws_wm);
-	WS_Reset(w->ws, wrk_ws_wm);
+	WS_Reset(w->aws, wrk_ws_wm);	/* XXX ? */
 
 	WRW_Reserve(sp->wrk, &sp->fd);
 	if (sp->wrk->res_mode & RES_CHUNKED)
@@ -476,7 +476,7 @@ ESI_DeliverChild(const struct sess *sp)
 	 * padding it, as necessary, to a byte boundary.
 	 */
 
-	dbits = (void*)WS_Alloc(sp->wrk->ws, 8);
+	dbits = (void*)WS_Alloc(sp->req->ws, 8);
 	AN(dbits);
 	obj = sp->req->obj;
 	CHECK_OBJ_NOTNULL(obj, OBJECT_MAGIC);
diff --git a/bin/varnishd/cache/cache_esi_parse.c b/bin/varnishd/cache/cache_esi_parse.c
index 8352717..1d705b1 100644
--- a/bin/varnishd/cache/cache_esi_parse.c
+++ b/bin/varnishd/cache/cache_esi_parse.c
@@ -1004,7 +1004,7 @@ VEP_Init(struct worker *wrk, vep_callback_t *cb)
 	CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC);
 	CHECK_OBJ_NOTNULL(wrk->busyobj, BUSYOBJ_MAGIC);
 	AZ(wrk->busyobj->vep);
-	vep = (void*)WS_Alloc(wrk->ws, sizeof *vep);
+	vep = (void*)WS_Alloc(wrk->busyobj->ws, sizeof *vep);
 	AN(vep);
 
 	memset(vep, 0, sizeof *vep);
diff --git a/bin/varnishd/cache/cache_fetch.c b/bin/varnishd/cache/cache_fetch.c
index abef6b1..c4c0718 100644
--- a/bin/varnishd/cache/cache_fetch.c
+++ b/bin/varnishd/cache/cache_fetch.c
@@ -446,7 +446,7 @@ FetchHdr(struct sess *sp, int need_host_hdr, int sendbody)
 
 	/* Receive response */
 
-	HTC_Init(htc, wrk->ws, vc->fd, vc->vsl_id,
+	HTC_Init(htc, wrk->busyobj->ws, vc->fd, vc->vsl_id,
 	    cache_param->http_resp_size,
 	    cache_param->http_resp_hdr_len);
 
diff --git a/bin/varnishd/cache/cache_hash.c b/bin/varnishd/cache/cache_hash.c
index d967291..c8cb6cc 100644
--- a/bin/varnishd/cache/cache_hash.c
+++ b/bin/varnishd/cache/cache_hash.c
@@ -521,8 +521,8 @@ HSH_Purge(const struct sess *sp, struct objhead *oh, double ttl, double grace)
 	struct object *o;
 
 	CHECK_OBJ_NOTNULL(oh, OBJHEAD_MAGIC);
-	spc = WS_Reserve(sp->wrk->ws, 0);
-	ocp = (void*)sp->wrk->ws->f;
+	spc = WS_Reserve(sp->req->ws, 0);
+	ocp = (void*)sp->req->ws->f;
 	Lck_Lock(&oh->mtx);
 	assert(oh->refcnt > 0);
 	nobj = 0;
@@ -565,7 +565,7 @@ HSH_Purge(const struct sess *sp, struct objhead *oh, double ttl, double grace)
 		EXP_Rearm(o);
 		(void)HSH_Deref(sp->wrk, NULL, &o);
 	}
-	WS_Release(sp->wrk->ws, 0);
+	WS_Release(sp->req->ws, 0);
 }
 
 
diff --git a/bin/varnishd/cache/cache_panic.c b/bin/varnishd/cache/cache_panic.c
index b09bcb8..5a2a805 100644
--- a/bin/varnishd/cache/cache_panic.c
+++ b/bin/varnishd/cache/cache_panic.c
@@ -196,7 +196,7 @@ pan_wrk(const struct worker *wrk)
 {
 
 	VSB_printf(pan_vsp, "  worker = %p {\n", wrk);
-	pan_ws(wrk->ws, 4);
+	pan_ws(wrk->aws, 4);
 	if (wrk->busyobj != NULL && wrk->busyobj->bereq->ws != NULL)
 		pan_http("bereq", wrk->busyobj->bereq, 4);
 	if (wrk->busyobj != NULL && wrk->busyobj->beresp->ws != NULL)
@@ -209,6 +209,7 @@ pan_busyobj(const struct busyobj *bo)
 {
 
 	VSB_printf(pan_vsp, "  busyobj = %p {\n", bo);
+	pan_ws(bo->ws, 4);
 	if (bo->is_gzip)	VSB_printf(pan_vsp, "    is_gzip\n");
 	if (bo->is_gunzip)	VSB_printf(pan_vsp, "    is_gunzip\n");
 	if (bo->do_gzip)	VSB_printf(pan_vsp, "    do_gzip\n");
diff --git a/bin/varnishd/cache/cache_pool.c b/bin/varnishd/cache/cache_pool.c
index dab5b11..be4af0a 100644
--- a/bin/varnishd/cache/cache_pool.c
+++ b/bin/varnishd/cache/cache_pool.c
@@ -162,8 +162,8 @@ pool_accept(struct worker *wrk, void *arg)
 	CAST_OBJ_NOTNULL(ps, arg, POOLSOCK_MAGIC);
 
 	CHECK_OBJ_NOTNULL(ps->lsock, LISTEN_SOCK_MAGIC);
-	assert(sizeof *wa == WS_Reserve(wrk->ws, sizeof *wa));
-	wa = (void*)wrk->ws->f;
+	assert(sizeof *wa == WS_Reserve(wrk->aws, sizeof *wa));
+	wa = (void*)wrk->aws->f;
 	while (1) {
 		memset(wa, 0, sizeof *wa);
 		wa->magic = WRK_ACCEPT_MAGIC;
@@ -171,7 +171,7 @@ pool_accept(struct worker *wrk, void *arg)
 		if (ps->lsock->sock < 0) {
 			/* Socket Shutdown */
 			FREE_OBJ(ps);
-			WS_Release(wrk->ws, 0);
+			WS_Release(wrk->aws, 0);
 			return;
 		}
 		if (VCA_Accept(ps->lsock, wa) < 0) {
@@ -192,8 +192,8 @@ pool_accept(struct worker *wrk, void *arg)
 		}
 		VTAILQ_REMOVE(&pp->idle_queue, &wrk2->task, list);
 		Lck_Unlock(&pp->mtx);
-		assert(sizeof *wa2 == WS_Reserve(wrk2->ws, sizeof *wa2));
-		wa2 = (void*)wrk2->ws->f;
+		assert(sizeof *wa2 == WS_Reserve(wrk2->aws, sizeof *wa2));
+		wa2 = (void*)wrk2->aws->f;
 		memcpy(wa2, wa, sizeof *wa);
 		wrk2->task.func = SES_pool_accept_task;
 		wrk2->task.priv = pp->sesspool;
@@ -277,7 +277,7 @@ Pool_Work_Thread(void *priv, struct worker *wrk)
 
 		CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC);
 
-		WS_Reset(wrk->ws, NULL);
+		WS_Reset(wrk->aws, NULL);
 
 		tp = VTAILQ_FIRST(&pp->front_queue);
 		if (tp != NULL) {
diff --git a/bin/varnishd/cache/cache_session.c b/bin/varnishd/cache/cache_session.c
index 2e080f1..58ff960 100644
--- a/bin/varnishd/cache/cache_session.c
+++ b/bin/varnishd/cache/cache_session.c
@@ -139,7 +139,7 @@ ses_pool_task(struct worker *wrk, void *arg)
 	CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC);
 	CAST_OBJ_NOTNULL(sp, arg, SESS_MAGIC);
 
-	AZ(wrk->ws->r);
+	AZ(wrk->aws->r);
 	wrk->lastused = NAN;
 	THR_SetSession(sp);
 	if (wrk->sp == NULL)
@@ -153,7 +153,7 @@ ses_pool_task(struct worker *wrk, void *arg)
 	/* Cannot access sp now */
 	THR_SetSession(NULL);
 	wrk->sp = NULL;
-	WS_Assert(wrk->ws);
+	WS_Assert(wrk->aws);
 	AZ(wrk->busyobj);
 	AZ(wrk->wrw.wfd);
 	assert(wrk->wlp == wrk->wlb);
@@ -177,7 +177,7 @@ SES_pool_accept_task(struct worker *wrk, void *arg)
 
 	/* Turn accepted socket into a session */
 	AZ(wrk->sp);
-	AN(wrk->ws->r);
+	AN(wrk->aws->r);
 	wrk->sp = ses_new(pp);
 	if (wrk->sp == NULL) {
 		VCA_FailSess(wrk);
@@ -185,7 +185,7 @@ SES_pool_accept_task(struct worker *wrk, void *arg)
 	}
 	VCA_SetupSess(wrk);
 	wrk->sp->step = STP_FIRST;
-	WS_Release(wrk->ws, 0);
+	WS_Release(wrk->aws, 0);
 	ses_pool_task(wrk, wrk->sp);
 }
 
diff --git a/bin/varnishd/cache/cache_vrt.c b/bin/varnishd/cache/cache_vrt.c
index 2623bcc..643f0a3 100644
--- a/bin/varnishd/cache/cache_vrt.c
+++ b/bin/varnishd/cache/cache_vrt.c
@@ -205,7 +205,7 @@ VRT_WrkString(const struct sess *sp, const char *p, ...)
 
 	CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
 	va_start(ap, p);
-	b = VRT_String(sp->wrk->ws, NULL, p, ap);
+	b = VRT_String(sp->wrk->aws, NULL, p, ap);
 	va_end(ap);
 	return (b);
 }
diff --git a/bin/varnishd/cache/cache_vrt_var.c b/bin/varnishd/cache/cache_vrt_var.c
index c4c0c56..ec067a2 100644
--- a/bin/varnishd/cache/cache_vrt_var.c
+++ b/bin/varnishd/cache/cache_vrt_var.c
@@ -297,7 +297,7 @@ VRT_l_beresp_storage(struct sess *sp, const char *str, ...)
 	char *b;
 
 	va_start(ap, str);
-	b = VRT_String(sp->wrk->ws, NULL, str, ap);
+	b = VRT_String(sp->wrk->busyobj->ws, NULL, str, ap);
 	va_end(ap);
 	sp->req->storage_hint = b;
 }
diff --git a/bin/varnishd/cache/cache_wrk.c b/bin/varnishd/cache/cache_wrk.c
index 6087991..32ad21d 100644
--- a/bin/varnishd/cache/cache_wrk.c
+++ b/bin/varnishd/cache/cache_wrk.c
@@ -152,7 +152,7 @@ wrk_thread_real(void *priv, unsigned shm_workspace, unsigned sess_workspace,
 	w->wrw.ciov = siov;
 	AZ(pthread_cond_init(&w->cond, NULL));
 
-	WS_Init(w->ws, "wrk", ws, sess_workspace);
+	WS_Init(w->aws, "wrk", ws, sess_workspace);
 
 	VSL(SLT_WorkThread, 0, "%p start", w);
 
@@ -182,7 +182,7 @@ WRK_thread(void *priv)
 		siov = IOV_MAX;
 	return (wrk_thread_real(priv,
 	    cache_param->shm_workspace,
-	    cache_param->wthread_workspace, siov));
+	    cache_param->workspace_thread, siov));
 }
 
 void
diff --git a/bin/varnishd/common/params.h b/bin/varnishd/common/params.h
index 40fcf1d..1e51656 100644
--- a/bin/varnishd/common/params.h
+++ b/bin/varnishd/common/params.h
@@ -70,12 +70,14 @@ struct params {
 	unsigned		wthread_purge_delay;
 	unsigned		wthread_stats_rate;
 	unsigned		wthread_stacksize;
-	unsigned		wthread_workspace;
 
 	unsigned		queue_max;
 
 	/* Memory allocation hints */
 	unsigned		workspace_client;
+	unsigned		workspace_backend;
+	unsigned		workspace_thread;
+
 	unsigned		shm_workspace;
 	unsigned		http_req_size;
 	unsigned		http_req_hdr_len;
diff --git a/bin/varnishd/mgt/mgt_param.c b/bin/varnishd/mgt/mgt_param.c
index 56c8336..8c7a668 100644
--- a/bin/varnishd/mgt/mgt_param.c
+++ b/bin/varnishd/mgt/mgt_param.c
@@ -662,7 +662,7 @@ tweak_poolparam(struct cli *cli, const struct parspec *par, const char *arg)
 	"\nNB: Do not change this parameter, unless a developer tell " \
 	"you to do so."
 
-#define MEMPOOL_TEXT 							\
+#define MEMPOOL_TEXT							\
 	"The three numbers are:\n"					\
 	"   min_pool -- minimum size of free pool.\n"			\
 	"   max_pool -- maximum size of free pool.\n"			\
@@ -698,6 +698,18 @@ static const struct parspec input_parspec[] = {
 		"Bytes of HTTP protocol workspace for clients HTTP req/resp.",
 		DELAYED_EFFECT,
 		"64k", "bytes" },
+	{ "workspace_backend",
+		tweak_bytes_u, &mgt_param.workspace_backend, 1024, UINT_MAX,
+		"Bytes of HTTP protocol workspace for backend HTTP req/resp.",
+		DELAYED_EFFECT,
+		"64k", "bytes" },
+	{ "workspace_thread",
+		tweak_bytes_u, &mgt_param.workspace_thread, 256, 256,
+		"Bytes of auxillary workspace per thread."
+		/* XXX: See comment in cache.h */
+		"This is not the workspace you are looking for.",
+		DELAYED_EFFECT,
+		"256", "bytes" },
 	{ "http_req_hdr_len",
 		tweak_bytes_u, &mgt_param.http_req_hdr_len,
 		40, UINT_MAX,
@@ -1194,7 +1206,7 @@ static const struct parspec input_parspec[] = {
 		"Disable this if you have very high hitrates and want"
 		"to save the memory of one busyobj per worker thread.",
 		0,
-		"true", ""},
+		"false", ""},
 
 	{ "pool_vbc", tweak_poolparam, &mgt_param.vbc_pool, 0, 10000,
 		"Parameters for backend connection memory pool.\n"
diff --git a/bin/varnishd/mgt/mgt_pool.c b/bin/varnishd/mgt/mgt_pool.c
index d34eef2..b716937 100644
--- a/bin/varnishd/mgt/mgt_pool.c
+++ b/bin/varnishd/mgt/mgt_pool.c
@@ -224,16 +224,5 @@ const struct parspec WRK_parspec[] = {
 		"many threads into the limited address space.\n",
 		EXPERIMENTAL,
 		"-1", "bytes" },
-	{ "thread_pool_workspace", tweak_uint, &mgt_param.wthread_workspace,
-		1024, UINT_MAX,
-		"Bytes of HTTP protocol workspace allocated for worker "
-		"threads. "
-		"This space must be big enough for the backend request "
-		"and responses, and response to the client plus any other "
-		"memory needs in the VCL code."
-		"Minimum is 1024 bytes.",
-		DELAYED_EFFECT,
-		"65536",
-		"bytes" },
 	{ NULL, NULL, NULL }
 };
diff --git a/bin/varnishtest/tests/r01038.vtc b/bin/varnishtest/tests/r01038.vtc
index a4173b4..ff94c72 100644
--- a/bin/varnishtest/tests/r01038.vtc
+++ b/bin/varnishtest/tests/r01038.vtc
@@ -45,7 +45,7 @@ server s1 {
 	txresp -body "foo8"
 } -start
 
-varnish v1 -arg "-p thread_pool_workspace=1024" -vcl+backend {
+varnish v1 -arg "-p workspace_backend=1024" -vcl+backend {
 	sub vcl_fetch {
 		set beresp.do_esi = true;
 	}



More information about the varnish-commit mailing list