Discard process' pending request upon incoming PM request

When a process wants something done from VFS, but VFS has no worker
threads available, the request is stored and executed later. However,
when PM also sends a request for that process at the same time, discard
the pending request from the process and give priority to PM. The request
PM sends is either an EXIT or a DUMPCORE request, so we're not interested
in executing the pending request anyway.
This commit is contained in:
Thomas Veerman 2011-12-09 10:43:13 +00:00
parent e7db2d3588
commit 94da86cbee

View file

@ -881,9 +881,15 @@ PRIVATE void service_pm()
okendpt(m_in.PM_PROC, &slot);
fp = &fproc[slot];
assert(!(fp->fp_flags & FP_PENDING));
fp->fp_job.j_m_in = m_in;
fp->fp_flags |= FP_PM_PENDING;
if (fp->fp_flags & FP_PENDING) {
/* This process has a request pending, but PM wants it gone.
* Forget about the pending request and satisfy PM's request
* instead. Note that a pending request AND an EXEC request
* are mutually exclusive. Also, PM should send only one
* request/process at a time.
*/
assert(fp->fp_job.j_m_in.m_source != PM_PROC_NR);
}
/* PM requests on behalf of a proc are handled after the system call
* that might be in progress for that proc has finished. If the proc
@ -891,9 +897,11 @@ PRIVATE void service_pm()
if (!(fp->fp_flags & FP_PENDING) && mutex_trylock(&fp->fp_lock) == 0) {
mutex_unlock(&fp->fp_lock);
worker_start(do_dummy);
yield();
}
fp->fp_job.j_m_in = m_in;
fp->fp_flags |= FP_PM_PENDING;
return;
case PM_FORK: