Check for critical work every swtch

上级 15145902
...@@ -86,6 +86,7 @@ void xfreework(void* ptr, unsigned long nbytes); ...@@ -86,6 +86,7 @@ void xfreework(void* ptr, unsigned long nbytes);
#if defined(XV6_KERNEL) #if defined(XV6_KERNEL)
int wqcrit_push(work* w, int c); int wqcrit_push(work* w, int c);
void wqcrit_trywork(void);
#endif #endif
#if defined(XV6_USER) #if defined(XV6_USER)
......
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
#include "kmtrace.hh" #include "kmtrace.hh"
#include "sched.hh" #include "sched.hh"
#include "vm.hh" #include "vm.hh"
#include "wq.hh"
enum { sched_debug = 0 }; enum { sched_debug = 0 };
enum { steal_nonexec = 1 }; enum { steal_nonexec = 1 };
...@@ -30,6 +31,7 @@ post_swtch(void) ...@@ -30,6 +31,7 @@ post_swtch(void)
mycpu()->prev != idleproc()) mycpu()->prev != idleproc())
addrun(mycpu()->prev); addrun(mycpu()->prev);
release(&mycpu()->prev->lock); release(&mycpu()->prev->lock);
wqcrit_trywork();
} }
void void
......
...@@ -33,6 +33,13 @@ wq_push(work *w) ...@@ -33,6 +33,13 @@ wq_push(work *w)
return wq_->push(w, mycpuid()); return wq_->push(w, mycpuid());
} }
void
wqcrit_trywork(void)
{
while (wqcrit_->trywork(false))
;
}
int int
wqcrit_push(work *w, int c) wqcrit_push(work *w, int c)
{ {
......
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论