From ead04184f5c1c62d62e607ed21c101e9f47ed9cf Mon Sep 17 00:00:00 2001 From: phk Date: Sat, 16 Sep 2006 20:59:35 +0000 Subject: [PATCH] Use srcaddr mutex for srcaddr stats update to reduce contention on stat_mtx git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@1034 d4fa192b-c00b-0410-8231-f00ffab90ce4 --- varnish-cache/bin/varnishd/cache_session.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/varnish-cache/bin/varnishd/cache_session.c b/varnish-cache/bin/varnishd/cache_session.c index 8f96bcdd..4b6b8d9f 100644 --- a/varnish-cache/bin/varnishd/cache_session.c +++ b/varnish-cache/bin/varnishd/cache_session.c @@ -201,15 +201,17 @@ SES_Charge(struct sess *sp) ses_sum_acct(&sp->acct, a); - LOCK(&stat_mtx); if (sp->srcaddr != NULL) { + LOCK(&sp->srcaddr->sah->mtx); b = &sp->srcaddr->acct; ses_sum_acct(b, a); VSL(SLT_StatAddr, 0, "%s 0 %d %ju %ju %ju %ju %ju %ju %ju", sp->srcaddr->addr, sp->t_end.tv_sec - b->first, b->sess, b->req, b->pipe, b->pass, b->fetch, b->hdrbytes, b->bodybytes); + UNLOCK(&sp->srcaddr->sah->mtx); } + LOCK(&stat_mtx); VSL_stats->s_sess += a->sess; VSL_stats->s_req += a->req; VSL_stats->s_pipe += a->pipe; -- 2.39.5