
phk at varnish-cache
Feb 20, 2012, 1:43 AM
Post #1 of 1
(79 views)
Permalink
|
|
[master] c53ab05 Get rid of the workthread VSL buffer.
|
|
commit c53ab05e9bc6f892d1823a3378bb47f054018906 Author: Poul-Henning Kamp <phk [at] FreeBSD> Date: Mon Feb 20 09:43:41 2012 +0000 Get rid of the workthread VSL buffer. diff --git a/bin/varnishd/cache/cache.h b/bin/varnishd/cache/cache.h index 028abe9..45f36f2 100644 --- a/bin/varnishd/cache/cache.h +++ b/bin/varnishd/cache/cache.h @@ -312,8 +312,6 @@ struct worker { struct VCL_conf *vcl; - struct vsl_log vsl[1]; - struct ws aws[1]; diff --git a/bin/varnishd/cache/cache_center.c b/bin/varnishd/cache/cache_center.c index 9aaa117..57a7e05 100644 --- a/bin/varnishd/cache/cache_center.c +++ b/bin/varnishd/cache/cache_center.c @@ -402,7 +402,7 @@ cnt_done(struct sess *sp, struct worker *wrk, struct req *req) req->xid, sp->t_req, sp->t_idle, dh, dp, da); } req->xid = 0; - VSL_Flush(wrk->vsl, 0); + VSL_Flush(sp->req->vsl, 0); sp->t_req = NAN; req->t_resp = NAN; @@ -1623,7 +1623,6 @@ CNT_Session(struct sess *sp) WS_Assert(wrk->aws); CHECK_OBJ_ORNULL(wrk->nobjhead, OBJHEAD_MAGIC); } - VSL_Flush(wrk->vsl, 0); #define ACCT(foo) AZ(wrk->acct_tmp.foo); #include "tbl/acct_fields.h" #undef ACCT diff --git a/bin/varnishd/cache/cache_dir.c b/bin/varnishd/cache/cache_dir.c index 5275680..6554b18 100644 --- a/bin/varnishd/cache/cache_dir.c +++ b/bin/varnishd/cache/cache_dir.c @@ -57,9 +57,10 @@ VDI_CloseFd(struct worker *wrk, struct vbc **vbp) VSLb(vc->vsl, SLT_BackendClose, "%s", bp->display_name); - /* Checkpoint log to flush all info related to this connection - before the OS reuses the FD */ - VSL_Flush(wrk->vsl, 0); + /* + * Checkpoint log to flush all info related to this connection + * before the OS reuses the FD + */ VSL_Flush(vc->vsl, 0); vc->vsl->wid = vc->orig_vsl_id; vc->vsl = NULL; @@ -91,11 +92,7 @@ VDI_RecycleFd(struct worker *wrk, struct vbc **vbp) VSLb(vc->vsl, SLT_BackendReuse, "%s", bp->display_name); - /* - * Flush the shmlog, so that another session reusing this backend - * will log chronologically later than our use of it. - */ - VSL_Flush(wrk->vsl, 0); + /* XXX: revisit this hack */ VSL_Flush(vc->vsl, 0); vc->vsl->wid = vc->orig_vsl_id; vc->vsl = NULL; diff --git a/bin/varnishd/cache/cache_esi_deliver.c b/bin/varnishd/cache/cache_esi_deliver.c index 669a594..dd3d98a 100644 --- a/bin/varnishd/cache/cache_esi_deliver.c +++ b/bin/varnishd/cache/cache_esi_deliver.c @@ -45,18 +45,18 @@ static void ved_include(struct sess *sp, const char *src, const char *host) { struct object *obj; - struct worker *w; + struct worker *wrk; char *sp_ws_wm; char *wrk_ws_wm; unsigned sxid, res_mode; - w = sp->wrk; + wrk = sp->wrk; if (sp->req->esi_level >= cache_param->max_esi_depth) return; sp->req->esi_level++; - (void)WRW_FlushRelease(w); + (void)WRW_FlushRelease(wrk); obj = sp->req->obj; sp->req->obj = NULL; @@ -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->aws); /* XXX ? */ + wrk_ws_wm = WS_Snapshot(wrk->aws); /* XXX ? */ http_SetH(sp->req->http, HTTP_HDR_URL, src); if (host != NULL && *host != '\0') { @@ -93,12 +93,11 @@ ved_include(struct sess *sp, const char *src, const char *host) sxid = sp->req->xid; while (1) { - sp->wrk = w; + sp->wrk = wrk; CNT_Session(sp); if (sp->step == STP_DONE) break; AZ(sp->wrk); - VSL_Flush(w->vsl, 0); DSL(0x20, SLT_Debug, sp->vsl_id, "loop waiting for ESI"); (void)usleep(10000); } @@ -111,7 +110,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->aws, wrk_ws_wm); /* XXX ? */ + WS_Reset(wrk->aws, wrk_ws_wm); /* XXX ? */ WRW_Reserve(sp->wrk, &sp->fd, sp->req->vsl, sp->req->t_resp); if (sp->req->res_mode & RES_CHUNKED) diff --git a/bin/varnishd/cache/cache_fetch.c b/bin/varnishd/cache/cache_fetch.c index 05ac8a3..8f76c24 100644 --- a/bin/varnishd/cache/cache_fetch.c +++ b/bin/varnishd/cache/cache_fetch.c @@ -442,9 +442,6 @@ FetchHdr(struct sess *sp, int need_host_hdr, int sendbody) return (retry); } - /* Checkpoint the vsl.here */ - VSL_Flush(wrk->vsl, 0); - /* XXX is this the right place? */ VSC_C_main->backend_req++; diff --git a/bin/varnishd/cache/cache_session.c b/bin/varnishd/cache/cache_session.c index f41b7ec..ba52ad3 100644 --- a/bin/varnishd/cache/cache_session.c +++ b/bin/varnishd/cache/cache_session.c @@ -133,7 +133,6 @@ ses_pool_task(struct worker *wrk, void *arg) THR_SetSession(NULL); WS_Assert(wrk->aws); AZ(wrk->wrw); - assert(wrk->vsl->wlp == wrk->vsl->wlb); if (cache_param->diag_bitmap & 0x00040000) { if (wrk->vcl != NULL) VCL_Rel(&wrk->vcl); diff --git a/bin/varnishd/cache/cache_wrk.c b/bin/varnishd/cache/cache_wrk.c index d28a58c..cc3a061 100644 --- a/bin/varnishd/cache/cache_wrk.c +++ b/bin/varnishd/cache/cache_wrk.c @@ -94,13 +94,11 @@ wrk_bgthread(void *arg) { struct bgthread *bt; struct worker wrk; - uint32_t logbuf[1024]; /* XXX: size ? */ CAST_OBJ_NOTNULL(bt, arg, BGTHREAD_MAGIC); THR_SetName(bt->name); memset(&wrk, 0, sizeof wrk); wrk.magic = WORKER_MAGIC; - VSL_Setup(wrk.vsl, logbuf, sizeof logbuf); (void)bt->func(&wrk, bt->priv); @@ -126,10 +124,9 @@ WRK_BgThread(pthread_t *thr, const char *name, bgthread_t *func, void *priv) /*--------------------------------------------------------------------*/ static void * -wrk_thread_real(void *priv, unsigned shm_workspace, unsigned thread_workspace) +wrk_thread_real(void *priv, unsigned thread_workspace) { struct worker *w, ww; - uint32_t wlog[shm_workspace / 4]; unsigned char ws[thread_workspace]; THR_SetName("cache-worker"); @@ -137,7 +134,6 @@ wrk_thread_real(void *priv, unsigned shm_workspace, unsigned thread_workspace) memset(w, 0, sizeof *w); w->magic = WORKER_MAGIC; w->lastused = NAN; - VSL_Setup(w->vsl, wlog, sizeof wlog); AZ(pthread_cond_init(&w->cond, NULL)); WS_Init(w->aws, "wrk", ws, thread_workspace); @@ -162,9 +158,7 @@ void * WRK_thread(void *priv) { - return (wrk_thread_real(priv, - cache_param->shm_workspace, - cache_param->workspace_thread)); + return (wrk_thread_real(priv, cache_param->workspace_thread)); } void diff --git a/bin/varnishd/mgt/mgt_param.c b/bin/varnishd/mgt/mgt_param.c index a5cde62..255a3ef 100644 --- a/bin/varnishd/mgt/mgt_param.c +++ b/bin/varnishd/mgt/mgt_param.c @@ -778,16 +778,6 @@ static const struct parspec input_parspec[] = { "Minimum is 1k bytes.", 0, "4k", "bytes" }, - { "shm_workspace", - tweak_bytes_u, &mgt_param.shm_workspace, 4096, UINT_MAX, - "Bytes of shmlog workspace allocated for worker threads. " - "If too big, it wastes some ram, if too small it causes " - "needless flushes of the SHM workspace.\n" - "These flushes show up in stats as " - "\"SHM flushes due to overflow\".\n" - "Minimum is 4096 bytes.", - DELAYED_EFFECT, - "8k", "bytes" }, { "shm_reclen", tweak_bytes_u, &mgt_param.shm_reclen, 16, 65535, "Maximum number of bytes in SHM log record.\n" _______________________________________________ varnish-commit mailing list varnish-commit [at] varnish-cache https://www.varnish-cache.org/lists/mailman/listinfo/varnish-commit
|