Block* iallocb(int size) { Block *b; static int m1, m2; if(ialloc.bytes > conf.ialloc){ if((m1++%10000)==0) print("iallocb: limited %lud/%lud\n", ialloc.bytes, conf.ialloc); return 0; } if((b = _allocb(size)) == nil){ if((m2++%10000)==0) print("iallocb: no memory %lud/%lud\n", ialloc.bytes, conf.ialloc); return nil; } setmalloctag(b, getcallerpc(&size)); b->flag = BINTR; ilock(&ialloc.lk); ialloc.bytes += b->lim - b->base; iunlock(&ialloc.lk); return b; }
Block* allocb(int size) { Block *b; /* * Check in a process and wait until successful. * Can still error out of here, though. */ if(up == nil) panic("allocb without up: %#p\n", getcallerpc(&size)); if((b = _allocb(size)) == nil){ mallocsummary(); panic("allocb: no memory for %d bytes\n", size); } return b; }
Block* allocb(int size) { Block *b; /* * Check in a process and wait until successful. * Can still error out of here, though. */ if(up == nil) panic("allocb without up: %#p", getcallerpc(&size)); if((b = _allocb(size)) == nil){ splhi(); xsummary(); mallocsummary(); delay(500); panic("allocb: no memory for %d bytes; caller %#p", size, getcallerpc(&size)); } setmalloctag(b, getcallerpc(&size)); return b; }
Block* iallocb(int size) { Block *b; static int m1, m2, mp; if(ialloc.bytes > conf.ialloc){ if((m1++%10000)==0){ if(mp++ > 1000){ active.exiting = 1; exit(0); } iprint("iallocb: limited %lud/%lud\n", ialloc.bytes, conf.ialloc); } return nil; } if((b = _allocb(size)) == nil){ if((m2++%10000)==0){ if(mp++ > 1000){ active.exiting = 1; exit(0); } iprint("iallocb: no memory %lud/%lud\n", ialloc.bytes, conf.ialloc); } return nil; } b->flag = BINTR; ilock(&ialloc); ialloc.bytes += b->lim - b->base; iunlock(&ialloc); return b; }
/* * interrupt time allocation */ struct block *iallocb(int size) { struct block *b; #if 0 /* conf is some inferno global config */ if (atomic_read(&ialloc_bytes) > conf.ialloc) { //printk("iallocb: limited %lu/%lu\n", atomic_read(&ialloc_bytes), // conf.ialloc); return NULL; } #endif b = _allocb(size, 0); /* no KMALLOC_WAIT */ if (b == NULL) { //printk("iallocb: no memory %lu/%lu\n", atomic_read(&ialloc_bytes), // conf.ialloc); return NULL; } b->flag = BINTR; atomic_add(&ialloc_bytes, b->lim - b->base); return b; }
struct block *allocb(int size) { return _allocb(size, KMALLOC_WAIT); }