[OpenAFS-devel] [PATCH] crget() memory allocation oddity

Joe Buehler jbuehler@spirentcom.com
Fri, 02 Jun 2006 10:09:39 -0400


Looking at some code to try and find out why the linux 1.4.1
client panics in crget(), one thing I see is this in
src/afs/LINUX/osi_cred.c:

/* Setup a pool for creds. Allocate several at a time. */
#define CRED_ALLOC_STEP 29	/* at 140 bytes/cred = 4060 bytes. */

The size of cred_t seems to have changed since that was written.
As a result, the cred_t lists are no longer allocated in single
page chunks.  Which in turn means that vmalloc() is used
to allocate them, instead of kmalloc() -- and vmalloc is what
is failing.

The following patch seems appropriate:

--- src/afs/LINUX/osi_cred.c.~1~	2005-04-03 15:49:21.000000000 -0400
+++ src/afs/LINUX/osi_cred.c	2006-06-02 10:04:45.000000000 -0400
@@ -21,7 +21,7 @@
 #include "afsincludes.h"

 /* Setup a pool for creds. Allocate several at a time. */
-#define CRED_ALLOC_STEP 29	/* at 140 bytes/cred = 4060 bytes. */
+#define CRED_ALLOC_STEP (PAGE_SIZE / sizeof(cred_t)) /* allocate <= 1 page at a time */


 static cred_t *cred_pool = NULL;
-- 
Joe Buehler