Commit 6a92b339 authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Add a session workspace for the TCP addresses etc.

parent 146d1035
......@@ -766,6 +766,8 @@ struct sess {
/* Session related fields ------------------------------------*/
struct ws ws[1];
struct suckaddr *remote_addr;
struct suckaddr *local_addr;
......
......@@ -51,8 +51,6 @@
#include "vtcp.h"
#include "vtim.h"
static unsigned ses_size;
/*--------------------------------------------------------------------*/
struct sesspool {
......@@ -94,34 +92,28 @@ SES_Charge(struct worker *wrk, struct req *req)
*
* Layout is:
* struct sess
* struct vsa (local_addr)
* struct vsa (remote_addr)
* workspace
*/
static struct sess *
ses_new(struct sesspool *pp)
{
struct sess *sp;
char *s;
unsigned sz;
char *p, *e;
CHECK_OBJ_NOTNULL(pp, SESSPOOL_MAGIC);
sp = MPL_Get(pp->mpl_sess, &sz);
sp->magic = SESS_MAGIC;
sp->sesspool = pp;
s = (char *)sp;
s += sizeof *sp;
memset(s, 0, vsa_suckaddr_len);
sp->local_addr = (void*)s;
s += vsa_suckaddr_len;
memset(s, 0, vsa_suckaddr_len);
sp->remote_addr = (void*)s;
s += vsa_suckaddr_len;
assert((char *)sp + sz == s);
e = (char*)sp + sz;
p = (char*)(sp + 1);
p = (void*)PRNDUP(p);
assert(p < e);
WS_Init(sp->ws, "sess", p, e - p);
sp->local_addr = (void*)WS_Alloc(sp->ws, vsa_suckaddr_len);
sp->remote_addr = (void*)WS_Alloc(sp->ws, vsa_suckaddr_len);
sp->t_open = NAN;
sp->t_idle = NAN;
......@@ -454,8 +446,8 @@ SES_NewPool(struct pool *wp, unsigned pool_no)
pp->mpl_req = MPL_New(nb, &cache_param->req_pool,
&cache_param->workspace_client);
bprintf(nb, "sess%u", pool_no);
ses_size = sizeof (struct sess) + vsa_suckaddr_len * 2L;
pp->mpl_sess = MPL_New(nb, &cache_param->sess_pool, &ses_size);
pp->mpl_sess = MPL_New(nb, &cache_param->sess_pool,
&cache_param->workspace_session);
return (pp);
}
......
......@@ -89,8 +89,9 @@ struct params {
unsigned wthread_queue_limit;
/* Memory allocation hints */
unsigned workspace_client;
unsigned workspace_backend;
unsigned workspace_client;
unsigned workspace_session;
unsigned workspace_thread;
unsigned vsl_buffer;
......
......@@ -81,6 +81,13 @@ struct parspec mgt_parspec[] = {
"cache at the end of ttl+grace+keep.",
OBJ_STICKY,
"0", "seconds" },
{ "workspace_session",
tweak_bytes_u, &mgt_param.workspace_session,
"256", NULL,
"Bytes of workspace for session and TCP connection addresses."
" If larger than 4k, use a multiple of 4k for VM efficiency.",
DELAYED_EFFECT,
"512", "bytes" },
{ "workspace_client",
tweak_bytes_u, &mgt_param.workspace_client,
"3072", NULL,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment