[master] ed09c766a Document thread_pool_stack's default value

Dridi Boukelmoune dridi.boukelmoune at gmail.com
Mon Mar 2 14:09:09 UTC 2020


commit ed09c766a5692a6f24b40b58703ecded4df5e264
Author: Dridi Boukelmoune <dridi.boukelmoune at gmail.com>
Date:   Mon Mar 2 11:38:29 2020 +0100

    Document thread_pool_stack's default value
    
    It turns out it's not just minimum and maximum values that can be
    dynamic.

diff --git a/bin/varnishd/mgt/mgt_param.c b/bin/varnishd/mgt/mgt_param.c
index 1ce83dee6..27610d57c 100644
--- a/bin/varnishd/mgt/mgt_param.c
+++ b/bin/varnishd/mgt/mgt_param.c
@@ -766,15 +766,16 @@ MCF_DumpRstParam(void)
 
 		if (pp->units != NULL && *pp->units != '\0')
 			printf("\t* Units: %s\n", pp->units);
-		printf("\t* Default: %s\n", pp->def);
-		if (pp->dyn_min_reason != NULL)
-			printf("\t* Minimum: %s\n", pp->dyn_min_reason);
-		else if (pp->min != NULL)
-			printf("\t* Minimum: %s\n", pp->min);
-		if (pp->dyn_max_reason != NULL)
-			printf("\t* Maximum: %s\n", pp->dyn_max_reason);
-		else if (pp->max != NULL)
-			printf("\t* Maximum: %s\n", pp->max);
+#define MCF_DYN_REASON(lbl, nm)					\
+		if (pp->dyn_ ## nm ## _reason != NULL)		\
+			printf("\t* " #lbl ": %s\n",		\
+			    pp->dyn_ ## nm ## _reason);		\
+		else if (pp->nm != NULL)			\
+			printf("\t* " #lbl ": %s\n", pp->nm);
+		MCF_DYN_REASON(Default, def);
+		MCF_DYN_REASON(Minimum, min);
+		MCF_DYN_REASON(Maximum, max);
+#undef MCF_DYN_REASON
 		/*
 		 * XXX: we should mark the params with one/two flags
 		 * XXX: that say if ->min/->max are valid, so we
diff --git a/bin/varnishd/mgt/mgt_param.h b/bin/varnishd/mgt/mgt_param.h
index e3a68fbee..a23616686 100644
--- a/bin/varnishd/mgt/mgt_param.h
+++ b/bin/varnishd/mgt/mgt_param.h
@@ -59,6 +59,7 @@ struct parspec {
 
 	const char	*dyn_min_reason;
 	const char	*dyn_max_reason;
+	const char	*dyn_def_reason;
 	char		*dyn_min;
 	char		*dyn_max;
 	char		*dyn_def;
diff --git a/bin/varnishd/mgt/mgt_pool.c b/bin/varnishd/mgt/mgt_pool.c
index 4d30ca427..63b3ede40 100644
--- a/bin/varnishd/mgt/mgt_pool.c
+++ b/bin/varnishd/mgt/mgt_pool.c
@@ -228,7 +228,7 @@ struct parspec WRK_parspec[] = {
 		EXPERIMENTAL },
 	{ "thread_pool_stack",
 		tweak_bytes, &mgt_param.wthread_stacksize,
-		NULL, NULL, NULL,	// default set in mgt_main.c
+		NULL, NULL, NULL,	// default set in mgt_param.c
 		"bytes",
 		"Worker thread stack size.\n"
 		"This will likely be rounded up to a multiple of 4k"
@@ -264,6 +264,7 @@ struct parspec WRK_parspec[] = {
 		" overflow occurs. Setting it in 150%-200%"
 		" increments is recommended until stack overflows"
 		" cease to occur.",
-		DELAYED_EFFECT },
+		DELAYED_EFFECT,
+		NULL, NULL, "sysconf(_SC_THREAD_STACK_MIN)" },
 	{ NULL, NULL, NULL }
 };


More information about the varnish-commit mailing list