From 43a7023809d7ed3687e7ffa84e3a8a94c46c6d8c Mon Sep 17 00:00:00 2001 From: wessels <> Date: Fri, 22 Jan 1999 06:15:35 +0000 Subject: [PATCH] From: Henrik Nordstrom This patch removes the last traces of cache_mem high/low water marks. Keep hot object store at cache_mem instead of cache_mem_high. --- src/cache_cf.cc | 4 ++-- src/cf.data.pre | 28 ++-------------------------- src/mem.cc | 4 ++-- src/snmp_agent.cc | 12 ++++++------ src/store.cc | 22 ++++++---------------- src/structs.h | 5 +++-- 6 files changed, 21 insertions(+), 54 deletions(-) diff --git a/src/cache_cf.cc b/src/cache_cf.cc index 030c50dfa9..f23d6fe46a 100644 --- a/src/cache_cf.cc +++ b/src/cache_cf.cc @@ -1,6 +1,6 @@ /* - * $Id: cache_cf.cc,v 1.318 1999/01/19 20:26:33 wessels Exp $ + * $Id: cache_cf.cc,v 1.319 1999/01/21 23:15:35 wessels Exp $ * * DEBUG: section 3 Configuration File Parsing * AUTHOR: Harvest Derived @@ -204,7 +204,7 @@ configDoConfigure(void) fatal("No cache_dir's specified in config file"); /* calculate Config.Swap.maxSize */ storeDirConfigure(); - if (Config.Swap.maxSize < (Config.Mem.maxSize >> 10)) + if (Config.Swap.maxSize < (Config.memMaxSize >> 10)) fatal("cache_swap is lower than cache_mem"); if (Config.Announce.period > 0) { Config.onoff.announce = 1; diff --git a/src/cf.data.pre b/src/cf.data.pre index 9601f27c67..8680231799 100644 --- a/src/cf.data.pre +++ b/src/cf.data.pre @@ -1,6 +1,6 @@ # -# $Id: cf.data.pre,v 1.131 1998/12/15 17:34:00 wessels Exp $ +# $Id: cf.data.pre,v 1.132 1999/01/21 23:15:36 wessels Exp $ # # # SQUID Internet Object Cache http://squid.nlanr.net/Squid/ @@ -433,7 +433,7 @@ NAME: cache_mem COMMENT: (bytes) TYPE: b_size_t DEFAULT: 8 MB -LOC: Config.Mem.maxSize +LOC: Config.memMaxSize DOC_START NOTE: THIS PARAMETER DOES NOT SPECIFY THE MAXIMUM PROCESS SIZE. IT PLACES A LIMIT ON ONE ASPECT OF SQUID'S MEMORY @@ -503,30 +503,6 @@ cache_swap_low 90 cache_swap_high 95 DOC_END - -NAME: cache_mem_low -COMMENT: (in percent, 0-100) -TYPE: int -DEFAULT: 75 -LOC: Config.Mem.lowWaterMark -DOC_NONE - -NAME: cache_mem_high -COMMENT: (in percent, 0-100) -TYPE: int -DEFAULT: 95 -LOC: Config.Mem.highWaterMark -DOC_START - The low- and high-water mark for cache memory storage. When - the amount of RAM used by the hot-object RAM cache reaches this - point, the cache starts throwing objects out of the RAM cache - (but they remain on disk). Defaults are 75% and 90%. - -cache_mem_low 75 -cache_mem_high 90 -DOC_END - - NAME: maximum_object_size COMMENT: (bytes) TYPE: b_size_t diff --git a/src/mem.cc b/src/mem.cc index bae37ee612..690a51f137 100644 --- a/src/mem.cc +++ b/src/mem.cc @@ -1,6 +1,6 @@ /* - * $Id: mem.cc,v 1.38 1998/12/05 00:54:31 wessels Exp $ + * $Id: mem.cc,v 1.39 1999/01/21 23:15:37 wessels Exp $ * * DEBUG: section 13 High Level Memory Pool Management * AUTHOR: Harvest Derived @@ -278,7 +278,7 @@ memInit(void) memDataInit(MEM_SQUIDCONFIG2, "SquidConfig2", sizeof(SquidConfig2), 0); memDataInit(MEM_STATCOUNTERS, "StatCounters", sizeof(StatCounters), 0); memDataInit(MEM_STMEM_BUF, "Store Mem Buffer", SM_PAGE_SIZE, - Config.Mem.maxSize / SM_PAGE_SIZE); + Config.memMaxSize / SM_PAGE_SIZE); memDataInit(MEM_STOREENTRY, "StoreEntry", sizeof(StoreEntry), 0); memDataInit(MEM_STORE_CLIENT, "store_client", sizeof(store_client), 0); memDataInit(MEM_SWAPDIR, "SwapDir", sizeof(SwapDir), 0); diff --git a/src/snmp_agent.cc b/src/snmp_agent.cc index 58f7669148..096cb216ed 100644 --- a/src/snmp_agent.cc +++ b/src/snmp_agent.cc @@ -1,6 +1,6 @@ /* - * $Id: snmp_agent.cc,v 1.62 1998/11/25 09:00:24 wessels Exp $ + * $Id: snmp_agent.cc,v 1.63 1999/01/21 23:15:38 wessels Exp $ * * DEBUG: section 49 SNMP Interface * AUTHOR: Kostas Anagnostakis @@ -117,19 +117,19 @@ snmp_confFn(variable_list * Var, snint * ErrP) Answer->val_len = sizeof(snint); Answer->val.integer = xmalloc(Answer->val_len); Answer->type = ASN_INTEGER; - *(Answer->val.integer) = (snint) Config.Mem.maxSize; + *(Answer->val.integer) = (snint) Config.MemMaxSize; break; - case CONF_ST_MHIWM: + case CONF_ST_MHIWM: /* DELETE ME */ Answer->val_len = sizeof(snint); Answer->val.integer = xmalloc(Answer->val_len); Answer->type = ASN_INTEGER; - *(Answer->val.integer) = (snint) Config.Mem.highWaterMark; + *(Answer->val.integer) = (snint) 0; break; - case CONF_ST_MLOWM: + case CONF_ST_MLOWM: /* DELETE ME */ Answer->val_len = sizeof(snint); Answer->val.integer = xmalloc(Answer->val_len); Answer->type = ASN_INTEGER; - *(Answer->val.integer) = (snint) Config.Mem.lowWaterMark; + *(Answer->val.integer) = (snint) 0; break; case CONF_ST_SWMAXSZ: Answer->val_len = sizeof(snint); diff --git a/src/store.cc b/src/store.cc index a742cb4b55..05e705679b 100644 --- a/src/store.cc +++ b/src/store.cc @@ -1,6 +1,6 @@ /* - * $Id: store.cc,v 1.485 1999/01/21 21:10:36 wessels Exp $ + * $Id: store.cc,v 1.486 1999/01/21 23:15:40 wessels Exp $ * * DEBUG: section 20 Storage Manager * AUTHOR: Harvest Derived @@ -94,8 +94,7 @@ static EVH storeLateRelease; * local variables */ static dlink_list inmem_list; -static int store_pages_high = 0; -static int store_pages_low = 0; +static int store_pages_max = 0; static int store_swap_high = 0; static int store_swap_low = 0; static int store_swap_mid = 0; @@ -666,7 +665,7 @@ storeGetMemSpace(int size) return; last_check = squid_curtime; pages_needed = (size / SM_PAGE_SIZE) + 1; - if (memInUse(MEM_STMEM_BUF) + pages_needed < store_pages_high) + if (memInUse(MEM_STMEM_BUF) + pages_needed < store_pages_max) return; if (store_rebuilding) return; @@ -684,7 +683,7 @@ storeGetMemSpace(int size) } released++; storePurgeMem(e); - if (memInUse(MEM_STMEM_BUF) + pages_needed < store_pages_high) + if (memInUse(MEM_STMEM_BUF) + pages_needed < store_pages_max) break; } debug(20, 3) ("storeGetMemSpace stats:\n"); @@ -928,7 +927,7 @@ storeInitHashValues(void) store_hash_buckets, store_maintain_rate, store_maintain_rate == 1 ? null_string : "s"); - debug(20, 1) ("Max Mem size: %d KB\n", Config.Mem.maxSize >> 10); + debug(20, 1) ("Max Mem size: %d KB\n", Config.memMaxSize >> 10); debug(20, 1) ("Max Swap size: %d KB\n", Config.Swap.maxSize); } @@ -966,21 +965,12 @@ storeInit(void) void storeConfigure(void) { - int store_mem_high = 0; - int store_mem_low = 0; - store_mem_high = (long) (Config.Mem.maxSize / 100) * - Config.Mem.highWaterMark; - store_mem_low = (long) (Config.Mem.maxSize / 100) * - Config.Mem.lowWaterMark; - store_swap_high = (long) (((float) Config.Swap.maxSize * (float) Config.Swap.highWaterMark) / (float) 100); store_swap_low = (long) (((float) Config.Swap.maxSize * (float) Config.Swap.lowWaterMark) / (float) 100); store_swap_mid = (store_swap_high >> 1) + (store_swap_low >> 1); - - store_pages_high = store_mem_high / SM_PAGE_SIZE; - store_pages_low = store_mem_low / SM_PAGE_SIZE; + store_pages_max = Config.memMaxSize / SM_PAGE_SIZE; } static int diff --git a/src/structs.h b/src/structs.h index 578079d2b9..58c9d876c4 100644 --- a/src/structs.h +++ b/src/structs.h @@ -1,7 +1,7 @@ /* - * $Id: structs.h,v 1.265 1999/01/19 20:43:46 wessels Exp $ + * $Id: structs.h,v 1.266 1999/01/21 23:15:41 wessels Exp $ * * * SQUID Internet Object Cache http://squid.nlanr.net/Squid/ @@ -199,7 +199,8 @@ struct _SquidConfig { size_t maxSize; int highWaterMark; int lowWaterMark; - } Mem , Swap; + } Swap; + size_t memMaxSize; struct { char *relayHost; u_short relayPort; -- 2.47.2