From: Olivier Houchard Date: Thu, 9 Jul 2026 11:25:54 +0000 (+0200) Subject: MEDIUM: fd: Add the tune.fd.tables option X-Git-Url: http://git.ipfire.org/gitweb/?a=commitdiff_plain;h=5664f21c3690c584cef0dceb59f494ad183f9c98;p=thirdparty%2Fhaproxy.git MEDIUM: fd: Add the tune.fd.tables option Add a new experimental option, tune.fd.tables, that can be set to either "shared" (the default) or "per-thread-group", to enable per-thread group file descriptor tables. This can give a nice performance boost when running with a lot of threads, as we observe a lot of contention on the file descriptor table lock in the kernel. --- diff --git a/src/cfgparse-global.c b/src/cfgparse-global.c index d9f25afd0..34200cc41 100644 --- a/src/cfgparse-global.c +++ b/src/cfgparse-global.c @@ -1484,6 +1484,22 @@ static int cfg_parse_global_tune_opts(char **args, int section_type, } return 0; } + else if (strcmp(args[0], "tune.fd.tables") == 0) { +#ifdef CLONE_FILES + if (strcmp(args[1], "per-thread-group") == 0) + global.tune.options |= GTUNE_NO_TG_FD_SHARING; + else if (strcmp(args[1], "shared") == 0) + global.tune.options &= ~GTUNE_NO_TG_FD_SHARING; + else { + memprintf(err, "'%s' expects 'shared' or 'per-thread-group', got '%s'", args[0], args[1]); + return -1; + } + return 0; +#else + memprintf(err, "'%s' is not supported on that platform", args[0]); + return -1; +#endif + } else { BUG_ON(1, "Triggered in cfg_parse_global_tune_opts() by unsupported keyword."); return -1; @@ -1882,6 +1898,7 @@ static struct cfg_kw_list cfg_kws = {ILH, { { CFG_GLOBAL, "tune.defaults.purge", cfg_parse_global_tune_opts }, { CFG_GLOBAL, "tune.disable-fast-forward", cfg_parse_global_tune_forward_opts }, { CFG_GLOBAL, "tune.disable-zero-copy-forwarding", cfg_parse_global_tune_forward_opts }, + { CFG_GLOBAL, "tune.fd.tables", cfg_parse_global_tune_opts, KWF_EXPERIMENTAL }, { CFG_GLOBAL, "tune.glitches.kill.cpu-usage", cfg_parse_global_tune_opts }, { CFG_GLOBAL, "tune.http.cookielen", cfg_parse_global_tune_opts }, { CFG_GLOBAL, "tune.http.logurilen", cfg_parse_global_tune_opts },