#include "../afs/afs_atomlist.h"
#include "../afs/afs_lhash.h"
-#define MAX_KMALLOC_SIZE AFS_SMALLOCSIZ /* Max we should alloc with kmalloc */
+#define MAX_KMALLOC_SIZE PAGE_SIZE /* Max we should alloc with kmalloc */
#define MAX_BUCKET_LEN 30 /* max. no. of entries per buckets we expect to see */
#define STAT_INTERVAL 8192 /* we collect stats once every STAT_INTERVAL allocs*/
* returns NULL if we failed to allocate memory.
* or pointer to memory if we succeeded.
*/
-static void *linux_alloc(unsigned int asize)
+static void *linux_alloc(unsigned int asize, int drop_glock)
{
void *new = NULL;
int max_retry = 10;
#else
current->state = TASK_INTERRUPTIBLE;
#endif
+ if (drop_glock) AFS_GUNLOCK();
schedule_timeout(HZ);
+ if (drop_glock) AFS_GLOCK();
#ifdef set_current_state
set_current_state(TASK_RUNNING);
#else
struct semaphore afs_linux_alloc_sem = MUTEX;
#endif
-void *osi_linux_alloc(unsigned int asize)
+void *osi_linux_alloc(unsigned int asize, int drop_glock)
{
void *new = NULL;
struct osi_linux_mem *lmem;
- new = linux_alloc(asize); /* get a chunk of memory of size asize */
+ new = 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);
#define _OSI_PROTO_H_
/* osi_alloc.c */
-extern void *osi_linux_alloc(unsigned int size);
+extern void *osi_linux_alloc(unsigned int size, int drop_glock);
extern void osi_linux_free(void *addr);
extern void osi_linux_free_afs_memory(void);
/* Debugging aid */
AFS_ASSERT_GLOCK();
hashcode = afs_evhash(event);
- newp = osi_AllocSmallSpace(sizeof(afs_event_t));
+ newp = osi_linux_alloc(sizeof(afs_event_t), 0);
afs_evhashcnt++;
newp->next = afs_evhasht[hashcode];
afs_evhasht[hashcode] = newp;
AFS_STATS(afs_stats_cmperf.OutStandingAllocs++);
AFS_STATS(afs_stats_cmperf.OutStandingMemUsage += x);
#ifdef AFS_LINUX20_ENV
- return osi_linux_alloc(x);
+ return osi_linux_alloc(x, 1);
#else
size = x;
tm = (struct osimem *) AFS_KALLOC(size);