-/*
- * Setup the paging constants for the clock algorithm.
- * Called after the system is initialized and the amount of memory
- * and number of paging devices is known.
- */
-setupclock()
-{
-
- /*
- * Setup thresholds for paging:
- * lotsfree is threshold where paging daemon turns on
- * desfree is amount of memory desired free. if less
- * than this for extended period, do swapping
- * minfree is minimal amount of free memory which is
- * tolerable.
- */
-
-#ifdef vax
- /*
- * Strategy of 4/22/81:
- * lotsfree is 1/4 of memory free.
- * desfree is 200k bytes, but at most 1/8 of memory
- * minfree is 64k bytes, but at most 1/2 of desfree
- */
- if (lotsfree == 0)
- lotsfree = LOOPPAGES / 4;
- if (desfree == 0) {
- desfree = (200*1024) / NBPG;
- if (desfree > LOOPPAGES / 8)
- desfree = LOOPPAGES / 8;
- }
- if (minfree == 0) {
- minfree = (64*1024) / NBPG;
- if (minfree > desfree/2)
- minfree = desfree / 2;
- }
-#endif
-#ifdef sun
- /*
- * Strategy of 3/17/83:
- * lotsfree is 1/8 of memory free.
- * desfree is 100k bytes, but at most 1/16 of memory
- * minfree is 32k bytes, but at most 1/2 of desfree
- */
- if (lotsfree == 0)
- lotsfree = LOOPPAGES / 8;
- if (desfree == 0) {
- desfree = (100*1024) / NBPG;
- if (desfree > LOOPPAGES / 16)
- desfree = LOOPPAGES / 16;
- }
- if (minfree == 0) {
- minfree = (32*1024) / NBPG;
- if (minfree > desfree/2)
- minfree = desfree / 2;
- }
-#endif
- /*
- * Maxpgio thresholds how much paging is acceptable.
- * This figures that 2/3 busy on an arm is all that is
- * tolerable for paging. We assume one operation per disk rev.
- */
- if (maxpgio == 0)
- maxpgio = (DISKRPM * 2) / 3;
-
- /*
- * Clock to scan using max of ~~10% of processor time for sampling,
- * this estimated to allow maximum of 200 samples per second.
- * This yields a ``fastscan'' of roughly (with CLSIZE=2):
- * <=1m 2m 3m 4m 8m
- * 5s 10s 15s 20s 40s
- */
-#ifdef vax
-#define LOTSOFMEM 2
-#endif
-#ifdef sun
-#define LOTSOFMEM 4
-#endif
- if (nswdev == 1 && physmem*NBPG > LOTSOFMEM*1024*(1024-16))
- printf("WARNING: should run interleaved swap with >= %dMb\n",
- LOTSOFMEM);
- if (fastscan == 0)
- fastscan = (LOOPPAGES/CLSIZE) / 200;
- if (fastscan < 5)
- fastscan = 5;
- if (nswdev >= 2)
- maxpgio = (maxpgio * 3) / 2;
-
- /*
- * Set slow scan time to 1/2 the fast scan time.
- */
- if (slowscan == 0)
- slowscan = 2 * fastscan;
-#ifdef notdef
- printf("slowscan %d, fastscan %d, maxpgio %d\n",
- slowscan, fastscan, maxpgio);
- printf("lotsfree %d, desfree %d, minfree %d\n",
- lotsfree, desfree, minfree);
-#endif
-}
-