提交 726b49a0 创建 作者: Austin Clements's avatar Austin Clements

Init distrefs as kernel init time

Fixes sharing on distref's lazy init flag
上级 0bfacd12
......@@ -241,23 +241,17 @@ distref_wakeup()
void
distref_check(distributed_refcnt *dr)
{
static bool initialized;
static spinlock initlock("distref initlock");
// Add it to the maybe-free list
if (workers.load()->enqueue(dr))
distref_wakeup();
}
if (!initialized) {
acquire(&initlock);
if (!initialized) {
void
initdistref()
{
struct proc *t = threadalloc(distref_thread, nullptr);
acquire(&t->lock);
safestrcpy(t->name, "distref_thread", sizeof(t->name));
addrun(t);
release(&t->lock);
initialized = true;
}
release(&initlock);
}
// Add it to the maybe-free list
if (workers.load()->enqueue(dr))
distref_wakeup();
}
......@@ -40,6 +40,7 @@ void initidle(void);
void initcpprt(void);
void initfutex(void);
void initcmdline(void);
void initdistref(void);
void idleloop(void);
#define IO_RTC 0x70
......@@ -161,6 +162,7 @@ cmain(u64 mbmagic, u64 mbaddr)
initsched(); // scheduler run queues
initidle();
initgc(); // gc epochs and threads
initdistref(); // distref collector thread
initdisk(); // disk
initbio(); // buffer cache
initinode(); // inode cache
......
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论