- Implement KiReleaseProcessLockFromDpcLevel and use it in KeTerminateThread. We were lowering to PASSIVE during thread termination, and then doing a context switch at PASSIVE, which you can guess is pretty bad.

svn path=/trunk/; revision=24068
This commit is contained in:
Alex Ionescu 2006-09-11 12:00:02 +00:00
parent 07dc58982f
commit 5fb31962db
3 changed files with 10 additions and 2 deletions

View file

@ -688,6 +688,14 @@ KiReleaseProcessLock(IN PKLOCK_QUEUE_HANDLE Handle)
KeReleaseInStackQueuedSpinLock(Handle);
}
FORCEINLINE
VOID
KiReleaseProcessLockFromDpcLevel(IN PKLOCK_QUEUE_HANDLE Handle)
{
/* Release the lock */
KeReleaseInStackQueuedSpinLockFromDpcLevel(Handle);
}
//
// This routine queues a thread that is ready on the PRCB's ready lists.
// If this thread cannot currently run on this CPU, then the thread is

View file

@ -1315,7 +1315,7 @@ KeTerminateThread(IN KPRIORITY Increment)
RemoveEntryList(&Thread->ThreadListEntry);
/* Release the process lock */
KiReleaseProcessLock(&LockHandle);
KiReleaseProcessLockFromDpcLevel(&LockHandle);
/* Set us as terminated, decrease the Process's stack count */
Thread->State = Terminated;

View file

@ -169,9 +169,9 @@ KiSwapThread(IN PKTHREAD CurrentThread,
IN PKPRCB Prcb)
{
BOOLEAN ApcState;
ASSERT(KeGetCurrentIrql() >= DISPATCH_LEVEL);
/* Find a new thread to run */
DPRINT("Dispatching Thread as blocked\n");
ApcState = KiDispatchThreadNoLock(Waiting);
/* Check if we need to deliver APCs */