[master] 020aaff save another 8 bytes in struct sess by removing the waited pointer
Nils Goroll
nils.goroll at uplex.de
Fri May 29 14:03:06 CEST 2015
commit 020aaff72da04293b4b6cbc6d49a31daad820e7d
Author: Nils Goroll <nils.goroll at uplex.de>
Date: Fri May 29 14:02:50 2015 +0200
save another 8 bytes in struct sess by removing the waited pointer
diff --git a/bin/varnishd/cache/cache.h b/bin/varnishd/cache/cache.h
index fa7ec7a..f1cd990 100644
--- a/bin/varnishd/cache/cache.h
+++ b/bin/varnishd/cache/cache.h
@@ -636,8 +636,6 @@ struct sess {
struct pool *pool;
- struct waited *waited; // on ws while waiting
-
/* Session related fields ------------------------------------*/
struct ws ws[1];
diff --git a/bin/varnishd/cache/cache_session.c b/bin/varnishd/cache/cache_session.c
index e8824c8..9820758 100644
--- a/bin/varnishd/cache/cache_session.c
+++ b/bin/varnishd/cache/cache_session.c
@@ -431,10 +431,9 @@ ses_handle(struct waited *wp, enum wait_event ev, double now)
CHECK_OBJ_NOTNULL(wp, WAITED_MAGIC);
CAST_OBJ_NOTNULL(sp, wp->ptr, SESS_MAGIC);
- assert(sp->waited == wp);
+ assert((void *)sp->ws->f == wp);
wp->magic = 0;
wp = NULL;
- sp->waited = NULL;
WS_Release(sp->ws, 0);
@@ -470,6 +469,7 @@ void
SES_Wait(struct sess *sp)
{
struct pool *pp;
+ struct waited *wp;
CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
pp = sp->pool;
@@ -483,18 +483,20 @@ SES_Wait(struct sess *sp)
return;
}
- AZ(sp->waited);
+ /*
+ * put struct waited on the workspace
+ */
if (WS_Reserve(sp->ws, sizeof(struct waited))
< sizeof(struct waited)) {
SES_Delete(sp, SC_OVERLOAD, NAN);
}
- sp->waited = (void*)sp->ws->f;
- INIT_OBJ(sp->waited, WAITED_MAGIC);
- sp->waited->fd = sp->fd;
- sp->waited->ptr = sp;
- sp->waited->idle = sp->t_idle;
- sp->waited->waitfor = &pp->wf;
- if (Wait_Enter(pp->waiter, sp->waited))
+ wp = (void*)sp->ws->f;
+ INIT_OBJ(wp, WAITED_MAGIC);
+ wp->fd = sp->fd;
+ wp->ptr = sp;
+ wp->idle = sp->t_idle;
+ wp->waitfor = &pp->wf;
+ if (Wait_Enter(pp->waiter, wp))
SES_Delete(sp, SC_PIPE_OVERFLOW, NAN);
}
More information about the varnish-commit
mailing list