Guarantee gc threads try to run at least once a second.

I might have broken something, but gc threads were running too infrequently for testing. A gc thread might run at a higher rate due to the heuristic in gc_end_epoch.
上级 aed48c5c
......@@ -10,7 +10,6 @@ struct cpu {
struct segdesc gdt[NSEGS]; // x86 global descriptor table
struct taskstate ts; // Used by x86 to find stack for interrupt
struct context *scheduler; // swtch() here to enter scheduler
u64 last_rcu_gc_ticks;
struct wqframe *wqframe;
// Cpu-local storage variables; see below
......
......@@ -238,14 +238,6 @@ gc_delayed2(int a1, u64 a2, void (*dofree)(int,u64))
}
void
gc_start(void)
{
// XXX hack?
if (gc_state[mycpu()->id].cnt++ % 10000 == 0)
cv_wakeup(&gc_state[mycpu()->id].cv);
}
void
gc_begin_epoch(void)
{
if (myproc() == NULL) return;
......@@ -266,8 +258,7 @@ gc_end_epoch(void)
--myproc()->epoch_depth;
release(&myproc()->gc_epoch_lock);
if (myproc()->epoch_depth == 0 && gc_state[mycpu()->id].ndelayed > NGC)
gc_start();
cv_wakeup(&gc_state[mycpu()->id].cv);
}
void gc_dumpstat(void)
......@@ -290,7 +281,7 @@ gc_worker(void *x)
for (;;) {
u64 i;
acquire(&wl);
cv_sleep(&gc_state[mycpu()->id].cv, &wl);
cv_sleepto(&gc_state[mycpu()->id].cv, &wl, nsectime() + 1000000000);
release(&wl);
gc_state[mycpu()->id].nrun++;
u64 global = global_epoch;
......
......@@ -370,12 +370,6 @@ scheduler(void)
}
}
int now = ticks;
if (now - mycpu()->last_rcu_gc_ticks > 100) {
gc_start();
mycpu()->last_rcu_gc_ticks = now;
}
if (idle[mycpu()->id]) {
int worked;
do {
......
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论