From: Kenn H. <ke...@us...> - 2001-01-29 01:02:39
|
Update of /cvsroot/linux-vax/kernel-2.4/mm In directory usw-pr-cvs1:/tmp/cvs-serv28465 Modified Files: slab.c Log Message: Temporary hacks to get the slab allocator to work with our 512 byte page size. Index: slab.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/mm/slab.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- slab.c 2001/01/14 16:42:29 1.1.1.1 +++ slab.c 2001/01/29 01:02:30 1.2 @@ -85,9 +85,9 @@ * FORCED_DEBUG - 1 enables SLAB_RED_ZONE and SLAB_POISON (if possible) */ -#define DEBUG 0 +#define DEBUG 1 #define STATS 0 -#define FORCED_DEBUG 0 +#define FORCED_DEBUG 1 /* * Parameters for kmem_cache_reap @@ -293,7 +293,11 @@ #endif /* maximum size of an obj (in 2^order pages) */ +#if PAGE_SIZE == 512 /* temporary for VAX */ +#define MAX_OBJ_ORDER 8 /* 256 pages */ +#else #define MAX_OBJ_ORDER 5 /* 32 pages */ +#endif /* * Do not go above this order unless 0 objects fit into the slab. @@ -305,8 +309,11 @@ /* * Absolute limit for the gfp order */ +#if PAGE_SIZE == 512 /* temporary for VAX */ +#define MAX_GFP_ORDER 8 /* 256 pages */ +#else #define MAX_GFP_ORDER 5 /* 32 pages */ - +#endif /* Macros for storing/retrieving the cachep and or slab from the * global 'mem_map'. These are used to find the slab an obj belongs to. @@ -325,7 +332,7 @@ } cache_sizes_t; static cache_sizes_t cache_sizes[] = { -#if PAGE_SIZE == 4096 +#if PAGE_SIZE == 4096 || PAGE_SIZE == 512 /* temporarly for VAX */ { 32, NULL, NULL}, #endif { 64, NULL, NULL}, @@ -1532,6 +1539,15 @@ void * kmalloc (size_t size, int flags) { cache_sizes_t *csizep = cache_sizes; + + /* With the VAX's 512-byte pages, kmalloc doesn't work for + sizes between 33 and 128 bytes (inclusive). I don't know + why, ( and I'm not really interested in fixing it, since + we'll be moving to a 4K page soon), so this just fudges + around the issue */ + if ((size >= 33) && (size <= 128)) { + size = 129; + } for (; csizep->cs_size; csizep++) { if (size > csizep->cs_size) |