Subject: BUFCACHE diff.
To: None <port-arm32@netbsd.org>
From: Luke Mewburn <lukem@cs.rmit.edu.au>
List: port-arm32
Date: 11/05/1998 17:33:46
here's a patch to the arm32 machdep.c to implement the BUFCACHE
stuff i did on the i386 (and others have subsequently done for
other ports).
the last kernel i built with this was a month ago, but my cvs
update cleanly merged these changes. still, it probably pays to
check.
Index: machdep.c
===================================================================
RCS file: /cvsroot/src/sys/arch/arm32/arm32/machdep.c,v
retrieving revision 1.54
diff -c -r1.54 machdep.c
*** machdep.c 1998/10/19 22:09:18 1.54
--- machdep.c 1998/11/04 22:59:54
***************
*** 144,149 ****
--- 144,154 ----
#else
int bufpages = 0;
#endif
+ #ifdef BUFCACHE
+ int bufcache = BUFCACHE; /* % of RAM to use for buffer cache */
+ #else
+ int bufcache = 0; /* fallback to old algorithm */
+ #endif
int cold = 1;
***************
*** 599,616 ****
#endif
/*
! * Determine how many buffers to allocate. We use 10% of the
! * first 2MB of memory, and 5% of the rest, with a minimum of 16
! * buffers. We allocate 1/2 as many swap buffer headers as file
! * i/o buffers.
*/
-
if (bufpages == 0)
! if (physmem < arm_byte_to_page(2 * 1024 * 1024))
! bufpages = physmem / (10 * CLSIZE);
! else
! bufpages = (arm_byte_to_page(2 * 1024 * 1024)
! + physmem) / (20 * CLSIZE);
#ifdef DIAGNOSTIC
if (bufpages == 0)
--- 604,638 ----
#endif
/*
! * If necessary, determine the number of pages to use for the
! * buffer cache. We allocate 1/2 as many swap buffer headers
! * as file I/O buffers.
*/
if (bufpages == 0)
! if (bufcache == 0) { /* use old algorithm */
! /*
! * Determine how many buffers to allocate. We use 10%
! * of the first 2MB of memory, and 5% of the rest, with
! * a minimum of 16 buffers.
! */
! if (physmem < arm_byte_to_page(2 * 1024 * 1024))
! bufpages = physmem / (10 * CLSIZE);
! else
! bufpages = (arm_byte_to_page(2 * 1024 * 1024)
! + physmem) / (20 * CLSIZE);
! } else {
! /*
! * Set size of buffer cache to physmem/bufcache * 100
! * (i.e., bufcache % of physmem).
! */
! if (bufcache < 5 || bufcache > 95) {
! printf(
! "warning: unable to set bufcache to %d%% of RAM, using 10%%",
! bufcache);
! bufcache = 10;
! }
! bufpages= physmem / (CLSIZE * 100) * bufcache;
! }
#ifdef DIAGNOSTIC
if (bufpages == 0)