[OpenAFS-devel] lots of vmalloc failures lately...
chas williams (contractor)
chas@cmf.nrl.navy.mil
Mon, 26 Apr 2004 11:28:30 -0400
In message <5C51DC2B8353AB4BA2CD04B34F2EE79C3EFF20@umr-umail1.umr.edu>,"Neuling
er, Nathan" writes:
>I've been seeing a lot more vmalloc failures on a couple of my boxes
>recently... running with a 350MB disk cache.
>
>Unfortunately, the result is almost always that AFS on the box becomes
>completely unusable, and the load usually shoots through the roof over
>the next few minutes.
i have a patch you could try --
Index: src/afs/afs.h
===================================================================
RCS file: /cvs/openafs/src/afs/afs.h,v
retrieving revision 1.45
diff -u -u -r1.45 afs.h
--- src/afs/afs.h 5 Apr 2004 22:39:51 -0000 1.45
+++ src/afs/afs.h 16 Apr 2004 21:18:59 -0000
@@ -926,6 +926,7 @@
/* kept in memory */
struct dcache {
struct afs_q lruq; /* Free queue for in-memory images */
+ struct afs_q dirty; /* Queue of dirty entries that need written */
afs_rwlock_t lock; /* Protects validPos, some f */
afs_rwlock_t tlock; /* Atomizes updates to refCount */
afs_rwlock_t mflock; /* Atomizes accesses/updates to mflags */
Index: src/afs/afs_dcache.c
===================================================================
RCS file: /cvs/openafs/src/afs/afs_dcache.c,v
retrieving revision 1.40
diff -u -u -r1.40 afs_dcache.c
--- src/afs/afs_dcache.c 15 Jul 2003 23:14:12 -0000 1.40
+++ src/afs/afs_dcache.c 16 Apr 2004 21:18:59 -0000
@@ -2582,8 +2582,8 @@
{
register struct dcache *tdc;
register afs_int32 i, touchedit = 0;
- struct dcache **ents;
- int entmax, entcount;
+
+ struct afs_q DirtyQ, *tq;
AFS_STATCNT(afs_WriteThroughDSlots);
@@ -2593,9 +2593,7 @@
* for every dcache entry, and exit xdcache.
*/
MObtainWriteLock(&afs_xdcache, 283);
- entmax = afs_cacheFiles;
- ents = afs_osi_Alloc(entmax * sizeof(struct dcache *));
- entcount = 0;
+ QInit(&DirtyQ);
for (i = 0; i < afs_cacheFiles; i++) {
tdc = afs_indexTable[i];
@@ -2605,7 +2603,7 @@
tdc->refCount++;
ReleaseWriteLock(&tdc->tlock);
- ents[entcount++] = tdc;
+ QAdd(&DirtyQ, &tdc->dirty);
}
}
MReleaseWriteLock(&afs_xdcache);
@@ -2616,9 +2614,11 @@
* afs_cacheInodep, and flush it. Don't forget to put back
* the refcounts.
*/
- for (i = 0; i < entcount; i++) {
- tdc = ents[i];
+#define DQTODC(q) ((struct dcache *)(((char *) (q)) - sizeof(struct afs_q)))
+
+ for (tq = DirtyQ.prev; tq != &DirtyQ; tq = QPrev(tq)) {
+ tdc = DQTODC(tq);
if (tdc->dflags & DFEntryMod) {
int wrLock;
@@ -2638,7 +2638,6 @@
afs_PutDCache(tdc);
}
- afs_osi_Free(ents, entmax * sizeof(struct dcache *));
MObtainWriteLock(&afs_xdcache, 617);
if (!touchedit && (cacheDiskType != AFS_FCACHE_TYPE_MEM)) {