Commit a6de1269 authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Use tweak_bytes() for wthread params.

Reduce stacksize to 32k.
parent 27fd76aa
......@@ -69,7 +69,7 @@ struct params {
unsigned wthread_fail_delay;
unsigned wthread_purge_delay;
unsigned wthread_stats_rate;
unsigned wthread_stacksize;
ssize_t wthread_stacksize;
unsigned queue_max;
......
......@@ -406,22 +406,19 @@ main(int argc, char * const *argv)
* Adjust default parameters for 32 bit systems to conserve
* VM space.
*/
MCF_ParamSet(cli, "workspace_client", "16384");
MCF_ParamSet(cli, "workspace_client", "16k");
cli_check(cli);
MCF_ParamSet(cli, "workspace_backend", "16384");
MCF_ParamSet(cli, "workspace_backend", "16k");
cli_check(cli);
MCF_ParamSet(cli, "http_resp_size", "8192");
MCF_ParamSet(cli, "http_resp_size", "8k");
cli_check(cli);
MCF_ParamSet(cli, "http_req_size", "12288");
MCF_ParamSet(cli, "http_req_size", "12k");
cli_check(cli);
MCF_ParamSet(cli, "thread_pool_stack", "32bit");
cli_check(cli);
MCF_ParamSet(cli, "gzip_buffer", "4096");
MCF_ParamSet(cli, "gzip_buffer", "4k");
cli_check(cli);
}
......
......@@ -350,7 +350,7 @@ tweak_generic_bytes(struct cli *cli, volatile ssize_t *dest, const char *arg,
/*--------------------------------------------------------------------*/
static void
void
tweak_bytes(struct cli *cli, const struct parspec *par, const char *arg)
{
volatile ssize_t *dest;
......
......@@ -54,6 +54,7 @@ int tweak_generic_uint(struct cli *cli,
void tweak_uint(struct cli *cli, const struct parspec *par, const char *arg);
void tweak_timeout(struct cli *cli,
const struct parspec *par, const char *arg);
void tweak_bytes(struct cli *cli, const struct parspec *par, const char *arg);
/* mgt_pool.c */
extern const struct parspec WRK_parspec[];
......@@ -73,21 +73,13 @@ static void
tweak_stack_size(struct cli *cli, const struct parspec *par,
const char *arg)
{
unsigned low, u;
char buf[12];
ssize_t low;
low = sysconf(_SC_THREAD_STACK_MIN);
if (arg != NULL && !strcmp(arg, "32bit")) {
u = 65536;
if (u < low)
u = low;
sprintf(buf, "%u", u);
arg = buf;
}
(void)tweak_generic_uint(cli, &mgt_param.wthread_stacksize, arg,
low, (uint)par->max);
tweak_bytes(cli, par, arg);
if (mgt_param.wthread_stacksize < low)
mgt_param.wthread_stacksize = low;
}
/*--------------------------------------------------------------------*/
......@@ -221,9 +213,8 @@ const struct parspec WRK_parspec[] = {
tweak_stack_size, &mgt_param.wthread_stacksize, 0, UINT_MAX,
"Worker thread stack size.\n"
"This is likely rounded up to a multiple of 4k by the kernel.\n"
"On 32bit systems you may need to tweak this down to fit "
"many threads into the limited address space.\n",
"The kernel/OS has a lower limit which will be enforced.\n",
EXPERIMENTAL,
"-1", "bytes" },
"32k", "bytes" },
{ NULL, NULL, 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