[4650] in Athena Bugs
text caching, swapping area
daemon@ATHENA.MIT.EDU (edg@ATHENA.MIT.EDU)
Sat Mar 31 15:07:58 1990
From: edg@ATHENA.MIT.EDU
To: bugs@ATHENA.MIT.EDU
Date: Sat, 31 Mar 90 15:07:41 EST
I suggest the following changes in sys/vm_text.c and sys/subr_rmap.c to fix
text cache bug and swapping space allocation bug.
1. vm_text.c : Cached texts count "xcache" should be fixed when file system is
unmounted. I also think that 10 is more reasonable value for
maximum number of "sticky" texts then default value 52.
*** /paris/source/vax/sys/sys/vm_text.c Tue Mar 14 23:00:06 1989
--- /site/sys/sys/vm_text.c Thu Mar 29 11:23:41 1990
***************
*** 97,103 ****
*/
struct text *xhead, **xtail; /* text table free list */
int xcache; /* number of "sticky" texts retained */
! int maxtextcache = -1; /* maximum number of "sticky" texts */
struct xstats xstats; /* cache statistics */
/*
--- 97,104 ----
*/
struct text *xhead, **xtail; /* text table free list */
int xcache; /* number of "sticky" texts retained */
! /*int maxtextcache = -1; /* maximum number of "sticky" texts */
! int maxtextcache = 10; /* maximum number of "sticky" texts */
struct xstats xstats; /* cache statistics */
/*
***************
*** 439,453 ****
register struct text *xp;
for (xp = text; xp < textNTEXT; xp++)
! if (xp->x_vptr != NULL && (xp->x_vptr->v_vfsp == vfsp)) {
xuntext(xp);
! if (xp->x_count == 0 &&
! xp->x_forw == NULL &&
! xp->x_back == NULL) {
! FREE_AT_HEAD(xp);
! }
}
! mpurgevfs(vfsp);
}
/*
* remove a shared text segment from the text table, if possible.
--- 440,458 ----
register struct text *xp;
for (xp = text; xp < textNTEXT; xp++)
! if (xp->x_vptr != NULL && (xp->x_vptr->v_vfsp == vfsp ||
! vfsp == NULL)) {
xuntext(xp);
! if (xp->x_count == 0)
! if (xp->x_forw == NULL &&
! xp->x_back == NULL) {
! FREE_AT_HEAD(xp);
! }
! else
! xcache--;
}
! if (vfsp != NULL)
! mpurgevfs(vfsp);
}
/*
* remove a shared text segment from the text table, if possible.
2. subr_rmap.c: when attempt to allocate swapping space failed, text cache
flushing and next attempt should be done.
*** /paris/source/vax/sys/sys/subr_rmap.c Sat May 30 20:34:07 1987
--- /site/sys/sys/subr_rmap.c Sat Mar 31 12:46:18 1990
***************
*** 20,25 ****
--- 20,28 ----
#include "proc.h"
#include "text.h"
#include "kernel.h"
+ #if defined(NFS) || defined(VFS)
+ #include "vfs.h"
+ #endif
/*
* Resource map handling routines.
***************
*** 100,113 ****
register int addr;
register struct mapent *bp;
swblk_t first, rest;
if (size <= 0 || mp == swapmap && size > dmmax)
panic("rmalloc");
! /*
! * Search for a piece of the resource map which has enough
! * free space to accomodate the request.
! */
! for (bp = ep; bp->m_size; bp++) {
if (bp->m_size >= size) {
/*
* If allocating from swapmap,
--- 103,118 ----
register int addr;
register struct mapent *bp;
swblk_t first, rest;
+ int i = 1;
if (size <= 0 || mp == swapmap && size > dmmax)
panic("rmalloc");
! do {
! /*
! * Search for a piece of the resource map which has enough
! * free space to accomodate the request.
! */
! for (bp = ep; bp->m_size; bp++) {
if (bp->m_size >= size) {
/*
* If allocating from swapmap,
***************
*** 143,149 ****
panic("rmalloc swapmap");
return (addr);
}
! }
return (0);
}
--- 148,161 ----
panic("rmalloc swapmap");
return (addr);
}
! }
! if (mp == swapmap)
! #if defined(NFS) || defined(VFS)
! xumount( (struct vfs *) 0 );
! #else
! xumount( NODEV );
! #endif
! } while (mp == swapmap && i--);
return (0);
}
--Ed