[OpenAFS-devel] afs_osi_Sleep and afs_osi_Wakeup on Linux

chas williams chas@cmf.nrl.navy.mil
Wed, 05 Jun 2002 17:18:35 -0400


In message <Pine.LNX.3.96L.1020605170632.9946F-100000@scully.trafford.dementia.
org>,Derrick J Brashear writes:
>clearly one of us is missing something. it may be me, and that's fine,
>but, why is going to sleep while holding the glock ok?

other platforms do it.  this seems pretty reasonable.  about the only 
reason alloc is going to fail is that there is a shortage of memory.
if there is a shortage, it seems like a good idea to give the kernel
a moment or two try to garbage collect.  dropping the glock so afs
can continue to get into trouble seems like a bad idea.   how long
do you think afs will run before it needs memory again? 

look at solaris for example,

#define  AFS_KALLOC(n)   kmem_alloc(n, KM_SLEEP)
#define  AFS_KALLOC_NOSLEEP(n)   kmem_alloc(n, KM_NOSLEEP)

[i believe the only bit that actually uses the nosleep version is in
the memory cache]  additionally, if the designers of afs wanted the
GLOCK dropped why didnt they do it in afs_osi_Alloc()?  that would be
the perfect place.