From 1c0260c71185a41f1ec3d1c08f20c53c76f31cdd Mon Sep 17 00:00:00 2001 From: Jeffrey Altman Date: Sat, 17 Aug 2013 10:18:53 -0400 Subject: [PATCH] Windows: Cap Cache Size on X86 Since we know the cache size cannot be arbitrary size because it must fit into contiguous process memory and because it is difficult to compute the actual size limit, cap the size to 716800KB. Change-Id: I850f489dc8a392875582e52d8d511dedf69aec9c Reviewed-on: http://gerrit.openafs.org/10151 Tested-by: BuildBot Reviewed-by: Jeffrey Altman --- src/WINNT/afsd/afsd_init.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/WINNT/afsd/afsd_init.c b/src/WINNT/afsd/afsd_init.c index 244ed448f..5ef1aeb85 100644 --- a/src/WINNT/afsd/afsd_init.c +++ b/src/WINNT/afsd/afsd_init.c @@ -732,6 +732,19 @@ afsd_InitCM(char **reasonP) if (code != ERROR_SUCCESS) cacheSize = CM_CONFIGDEFAULT_CACHESIZE; +#if defined(_X86) + /* + * For 32-bit systems the max process space is 2GB and the + * max cache size is the max contiguous free address space. + * Since it is too hard to calculate what that is simply + * cap the value at 716800. + */ + if (cacheSize > 716800) { + afsi_log("Requested Cache size %u", cacheSize); + cacheSize = 716800; + } +#endif + if (cm_virtualCache) { MEMORYSTATUSEX memStatus; DWORD maxCacheSize; -- 2.39.5