diff options
author | Alexander Færøy <ahf@torproject.org> | 2021-01-20 16:33:17 +0000 |
---|---|---|
committer | Alexander Færøy <ahf@torproject.org> | 2021-01-20 16:33:17 +0000 |
commit | c38c36e5f1c65b817a2f7e4d54e81f17b97228b6 (patch) | |
tree | 010dc5c1f38e16d9db81c2759b1a232d8c4a14fc /src/feature/dircache | |
parent | e5a0c739d4865b300e904d45c413d5c8f0da304c (diff) | |
download | tor-c38c36e5f1c65b817a2f7e4d54e81f17b97228b6.tar.gz tor-c38c36e5f1c65b817a2f7e4d54e81f17b97228b6.zip |
Limit the number of items in the consdiffmgr on Windows.
This patch limits the number of items in the consensus diff cache to 64
on the Windows platform. Hopefully, this will allow us to investigate a
smarter fix while avoiding the situation reported in tor#24857 where
Windows relay operators report Tor using 100% CPU.
See: tor#24857
Diffstat (limited to 'src/feature/dircache')
-rw-r--r-- | src/feature/dircache/consdiffmgr.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/feature/dircache/consdiffmgr.c b/src/feature/dircache/consdiffmgr.c index 10590cd6d2..21f536432c 100644 --- a/src/feature/dircache/consdiffmgr.c +++ b/src/feature/dircache/consdiffmgr.c @@ -177,6 +177,16 @@ typedef struct cdm_diff_t { /** Hashtable mapping flavor and source consensus digest to status. */ static HT_HEAD(cdm_diff_ht, cdm_diff_t) cdm_diff_ht = HT_INITIALIZER(); +#ifdef _WIN32 + // XXX(ahf): For tor#24857, a contributor suggested that on Windows, the CPU + // begins to spike at 100% once the number of files handled by the consensus + // diff manager becomes larger than 64. To see if the issue goes away, we + // hardcode this value to 64 now while we investigate a better solution. +# define CACHE_MAX_NUM 64 +#else +# define CACHE_MAX_NUM 128 +#endif + /** * Configuration for this module */ @@ -184,7 +194,7 @@ static consdiff_cfg_t consdiff_cfg = { // XXXX I'd like to make this number bigger, but it interferes with the // XXXX seccomp2 syscall filter, which tops out at BPF_MAXINS (4096) // XXXX rules. - /* .cache_max_num = */ 128 + /* .cache_max_num = */ CACHE_MAX_NUM }; static int consdiffmgr_ensure_space_for_files(int n); |