[OpenAFS-devel] lots of vmalloc failures lately...

Neulinger, Nathan nneul@umr.edu
Mon, 26 Apr 2004 10:07:27 -0500


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.

void *
osi_linux_alloc(unsigned int asize, int drop_glock)
{
    void *new =3D NULL;
    struct osi_linux_mem *lmem;

    new =3D linux_alloc(asize, drop_glock);       /* get a chunk of =
memory
of size asize */

    if (!new) {
        printf("afs_osi_Alloc: Can't vmalloc %d bytes.\n", asize);
        return new;
    }

    down(&afs_linux_alloc_sem);


One of the recent cases was a 20000 byte allocation in
afs_WriteThroughDSlots.=20

I suppose at the least, adding some failure checks to calls to
afs_osi_Alloc() would help this situation some... Not sure how safe it
will be to exit out of the loops in those routines, but how much worse
can it be than hosing the machine entirely.

For example in WriteThroughDSlots:

    MObtainWriteLock(&afs_xdcache, 283);
    entmax =3D afs_cacheFiles;
    ents =3D afs_osi_Alloc(entmax * sizeof(struct dcache *));
    entcount =3D 0;
    for (i =3D 0; i < afs_cacheFiles; i++) {
        tdc =3D afs_indexTable[i];

        /* Grab tlock in case the existing refcount isn't zero */
        if (tdc && !(afs_indexFlags[i] & (IFFree | IFDiscarded))) {
            ObtainWriteLock(&tdc->tlock, 623);
            tdc->refCount++;
            ReleaseWriteLock(&tdc->tlock);

            ents[entcount++] =3D tdc;
        }
    }
    MReleaseWriteLock(&afs_xdcache);


adding a=20

if ( ! ents )
{
	printf("afs_WriteThroughDSlots: failed allocation, terminating
early.\n");	MReleaseWriteLock(&afs_xdcache);
	return;
}

would seem to help this code path from hosing the machine... Might not
be good for the cache, but I don't know that for sure. If it would hose
the cache, should change that return to a panic().=20

-- Nathan

------------------------------------------------------------
Nathan Neulinger                       EMail:  nneul@umr.edu
University of Missouri - Rolla         Phone: (573) 341-6679
UMR Information Technology             Fax: (573) 341-4216