9 #define myctx (euscontexts[thr_self()]) 30 #ifdef __HEAP_EXPANDABLE 57 static inline unsigned long net_free(
int req) {
58 unsigned long total = 0;
62 idx < MAXBUDDY; idx++)
68 static int km[10] = {4096, 4800, 6000, 8192};
69 static int ks[10] = {256, 256, 384, 512};
82 for (i = 0; i < 4; i++) {
99 for (i = 0; i < 4; i++) {
117 #define my_gc_pri ctx->my_gc_pri 128 return gc_cushion <= 0
145 for (k = req;
buddy[k].
bp == 0; )
151 DPRINT1(
"\x1b[1;31mstarved(alloc_big:1, free/total=%d/%d)\x1b[0m",
154 for (k = req;
buddy[k].
bp == 0;) k++;
157 DPRINT1(
"\x1b[1;31mstarved(alloc_big:1, free/total=%d/%d)\x1b[0m",
160 for (k = req;
buddy[k].
bp == 0;) k++;
175 for (i = 0; i < k; i++) b->
b.
c[i] = 0;
183 printf(
"root_alloc_big: alloc 1 block (%d), 0x%lx\n", req, b );
200 DPRINT2(
"\x1b[0;32mstart GC: free rate = %lf, frag rate[%d] = %lf\x1b[0m",
208 #ifdef __GC_ALLOC_DRIVEN 217 #ifdef __GC_ALLOC_DRIVEN 238 register int i, j, k, kk;
241 static long buddyfill[MAXTHRBUDDY + 1] = {0, 500, 300, 20, 15, 10, 0};
248 for (i = 1; i < MAXTHRBUDDY; i++) {
249 k = kk = buddyfill[i] - tb[i].
count;
256 DPRINT1(
"\x1b[1;31mstarved(alloc_small:1, free/total=%d/%d)\x1b[0m",
281 tb[i].
count = buddyfill[i];
285 printf(
"root_alloc_small: alloc %d block(s) (%d)\n", kk, i);
314 DPRINT2(
"\x1b[0;32mstart GC: free rate = %lf, frag rate[%d] = %lf\x1b[0m",
321 #ifdef __GC_ALLOC_DRIVEN 330 #ifdef __GC_ALLOC_DRIVEN 349 register int req = 1, i, ss;
356 #if defined(DEBUG) || defined(DEBUG_COUNT) 357 static int count = 0;
362 printf(
"alloc:%d:nils(=%d) > s(=%d)!!\n", count, nils, s);
368 printf(
"alloc:%d:s=%d, e=%d, cid=%d, nils=%d\n",
369 count, s, e, cid, nils);
371 if (req >= MAXTHRBUDDY)
374 if (tb[req].count == 0) {
387 printf(
"alloc:%d:", count);
397 #if defined(DEBUG) || defined(UALLOC_DEBUG) 398 printf(
"alloc:%d:allocate for user[%d(buddysize=%d)] = 0x%lx: new list top = 0x%lx\n",
401 for (i = 0; i < ss; i++)
409 #ifdef __USE_MARK_BITMAP 470 printf(
"alloc:%d:fill NIL:nils = %d, s = %d\n",
474 while (i < nils) v[i++] =
NIL;
477 while (s < i) v[s++] =
NULL;
479 printf(
"alloc:%d:after filling NIL:", count );
#define REALTIME_ALLOC_LIMIT_IDX
bpointer rgc_root_alloc_big(register context *ctx, register int req)
long alloccount[MAXBUDDY]
#define DEFAULT_GC_THRESHOLD
dump_bcell(int k, struct buddyfree *b)
#define DEFAULT_EXPAND_SIZE_IDX
#define GC_ACTIVATE_CUSHION
#define ASSERT(condition)
long buddysize[MAXBUDDY+1]
static int recalc_gc_priority(int req)
struct _sweeping_state sweeping_state
pointer error(enum errorcode ec,...) pointer error(va_alist) va_dcl
pointer rgc_alloc(register int s, int e, int cid, register int nils)
int rw_rdlock(rwlock_t *)
struct buddyfree buddy[MAXBUDDY+1]
static int should_start_gc(int req)
static int rgc_expand_heap_or_complete_gc(int req)
int rw_unlock(rwlock_t *)
struct buddyfree * thr_buddy
static volatile int rem_cnt
static unsigned long net_free(int req)
static volatile int gc_pri
void do_a_little_gc_work(int m_unit, int s_unit)
void splitheap(int k, struct buddyfree *buddy)
void rgc_root_alloc_small(register context *ctx, register int req)