mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 01:55:19 +00:00
Support Priority Boosting during Wait Satisfaction and Thread Abortion, and use it where necessary. Should provide a bit more responsiveness.
svn path=/trunk/; revision=14049
This commit is contained in:
parent
3d801bebec
commit
8b97b835f2
9 changed files with 27 additions and 19 deletions
|
@ -160,7 +160,11 @@ VOID inline FASTCALL KeInitializeDispatcherHeader(DISPATCHER_HEADER* Header, ULO
|
|||
VOID KeDumpStackFrames(PULONG Frame);
|
||||
BOOLEAN KiTestAlert(VOID);
|
||||
|
||||
VOID FASTCALL KiAbortWaitThread(struct _KTHREAD* Thread, NTSTATUS WaitStatus);
|
||||
VOID
|
||||
FASTCALL
|
||||
KiAbortWaitThread(PKTHREAD Thread,
|
||||
NTSTATUS WaitStatus,
|
||||
KPRIORITY Increment);
|
||||
|
||||
BOOLEAN STDCALL KiInsertTimer(PKTIMER Timer, LARGE_INTEGER DueTime);
|
||||
|
||||
|
|
|
@ -276,7 +276,7 @@ KeInsertQueueApc(PKAPC Apc,
|
|||
(Apc->NormalRoutine == NULL)) {
|
||||
|
||||
DPRINT("Waking up Thread for Kernel-Mode APC Delivery \n");
|
||||
KiAbortWaitThread(Thread, STATUS_KERNEL_APC);
|
||||
KiAbortWaitThread(Thread, STATUS_KERNEL_APC, PriorityBoost);
|
||||
}
|
||||
|
||||
} else if ((Thread->State == THREAD_STATE_BLOCKED) &&
|
||||
|
@ -285,7 +285,7 @@ KeInsertQueueApc(PKAPC Apc,
|
|||
|
||||
DPRINT("Waking up Thread for User-Mode APC Delivery \n");
|
||||
Thread->ApcState.UserApcPending = TRUE;
|
||||
KiAbortWaitThread(Thread, STATUS_USER_APC);
|
||||
KiAbortWaitThread(Thread, STATUS_USER_APC, PriorityBoost);
|
||||
}
|
||||
|
||||
/* Return Sucess if we are here */
|
||||
|
|
|
@ -1,11 +1,12 @@
|
|||
/* $Id$
|
||||
/*
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
* FILE: ntoskrnl/ke/event.c
|
||||
* PURPOSE: Implements events
|
||||
*
|
||||
* PROGRAMMERS: David Welch (welch@mcmail.com)
|
||||
* PROGRAMMERS: Alex Ionescu (alex@relsoft.net)
|
||||
* David Welch (welch@mcmail.com)
|
||||
*/
|
||||
|
||||
/* INCLUDES *****************************************************************/
|
||||
|
@ -203,7 +204,7 @@ KeSetEvent(PKEVENT Event,
|
|||
|
||||
/* We can satisfy wait simply by waking the thread, since our signal state is 0 now */
|
||||
DPRINT("WaitAny or Sync Event, just unwait the thread\n");
|
||||
KiAbortWaitThread(WaitBlock->Thread, WaitBlock->WaitKey);
|
||||
KiAbortWaitThread(WaitBlock->Thread, WaitBlock->WaitKey, Increment);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -259,7 +260,7 @@ KeSetEventBoostPriority(IN PKEVENT Event,
|
|||
|
||||
/* Reset the Quantum and Unwait the Thread */
|
||||
WaitingThread->Quantum = WaitingThread->ApcState.Process->ThreadQuantum;
|
||||
KiAbortWaitThread(WaitingThread, STATUS_SUCCESS);
|
||||
KiAbortWaitThread(WaitingThread, STATUS_SUCCESS, EVENT_INCREMENT);
|
||||
}
|
||||
|
||||
/* Release the Dispatcher Database Lock */
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
* FILE: ntoskrnl/ke/kthread.c
|
||||
* PURPOSE: Microkernel thread support
|
||||
*
|
||||
* PROGRAMMERS: Alex Ionescu (alex@relsoft.net) - Commented, reorganized some stuff, fixed/implemented some functions.
|
||||
* PROGRAMMERS: Alex Ionescu (alex@relsoft.net)
|
||||
* David Welch (welch@cwcom.net)
|
||||
*/
|
||||
|
||||
|
@ -14,6 +14,7 @@
|
|||
#define NDEBUG
|
||||
#include <internal/debug.h>
|
||||
|
||||
#define THREAD_ALERT_INCREMENT 2
|
||||
/* FUNCTIONS *****************************************************************/
|
||||
|
||||
ULONG
|
||||
|
@ -36,7 +37,7 @@ KeAlertResumeThread(IN PKTHREAD Thread)
|
|||
if (Thread->State == THREAD_STATE_BLOCKED && Thread->Alertable) {
|
||||
|
||||
DPRINT("Aborting Wait\n");
|
||||
KiAbortWaitThread(Thread, STATUS_ALERTED);
|
||||
KiAbortWaitThread(Thread, STATUS_ALERTED, THREAD_ALERT_INCREMENT);
|
||||
|
||||
} else {
|
||||
|
||||
|
@ -89,7 +90,7 @@ KeAlertThread(PKTHREAD Thread,
|
|||
Thread->Alertable) {
|
||||
|
||||
DPRINT("Aborting Wait\n");
|
||||
KiAbortWaitThread(Thread, STATUS_ALERTED);
|
||||
KiAbortWaitThread(Thread, STATUS_ALERTED, THREAD_ALERT_INCREMENT);
|
||||
|
||||
} else {
|
||||
|
||||
|
|
|
@ -1,11 +1,12 @@
|
|||
/* $Id$
|
||||
*
|
||||
/*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
* FILE: ntoskrnl/ke/queue.c
|
||||
* PURPOSE: Implements kernel queues
|
||||
*
|
||||
* PROGRAMMERS: Eric Kohl (ekohl@rz-online.de)
|
||||
* PROGRAMMERS: Alex Ionescu (alex@relsoft.net)
|
||||
* Gunnar Dalsnes
|
||||
* Eric Kohl (ekohl@rz-online.de)
|
||||
*/
|
||||
|
||||
/* INCLUDES *****************************************************************/
|
||||
|
@ -409,7 +410,7 @@ KiWakeQueue(IN PKQUEUE Queue)
|
|||
/* Unwait the Thread */
|
||||
DPRINT("Unwaiting Thread\n");
|
||||
WaitBlock = CONTAINING_RECORD(WaitEntry, KWAIT_BLOCK, WaitListEntry);
|
||||
KiAbortWaitThread(WaitBlock->Thread, (NTSTATUS)QueueEntry);
|
||||
KiAbortWaitThread(WaitBlock->Thread, (NTSTATUS)QueueEntry, IO_NO_INCREMENT);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -111,7 +111,7 @@ KeReleaseSemaphore(PKSEMAPHORE Semaphore,
|
|||
if (InitialState == 0 && !IsListEmpty(&Semaphore->Header.WaitListHead)) {
|
||||
|
||||
/* Wake the Semaphore */
|
||||
KiWaitTest(&Semaphore->Header, SEMAPHORE_INCREMENT);
|
||||
KiWaitTest(&Semaphore->Header, Increment);
|
||||
}
|
||||
|
||||
/* If the Wait is true, then return with a Wait and don't unlock the Dispatcher Database */
|
||||
|
|
|
@ -291,7 +291,7 @@ KiHandleExpiredTimer(PKTIMER Timer)
|
|||
/* Set it as Signaled */
|
||||
DPRINT("Setting Timer as Signaled\n");
|
||||
Timer->Header.SignalState = TRUE;
|
||||
KiWaitTest(&Timer->Header, 0);
|
||||
KiWaitTest(&Timer->Header, IO_NO_INCREMENT);
|
||||
|
||||
/* If the Timer is periodic, reinsert the timer with the new due time */
|
||||
if (Timer->Period) {
|
||||
|
|
|
@ -702,7 +702,7 @@ KiWaitTest(PDISPATCHER_HEADER Object,
|
|||
|
||||
/* All waits satisfied, unwait the thread */
|
||||
DPRINT("Unwaiting the Thread\n");
|
||||
KiAbortWaitThread(CurrentWaitBlock->Thread, CurrentWaitBlock->WaitKey);
|
||||
KiAbortWaitThread(CurrentWaitBlock->Thread, CurrentWaitBlock->WaitKey, Increment);
|
||||
|
||||
SkipUnwait:
|
||||
/* Next entry */
|
||||
|
@ -716,7 +716,8 @@ SkipUnwait:
|
|||
VOID
|
||||
FASTCALL
|
||||
KiAbortWaitThread(PKTHREAD Thread,
|
||||
NTSTATUS WaitStatus)
|
||||
NTSTATUS WaitStatus,
|
||||
KPRIORITY Increment)
|
||||
{
|
||||
PKWAIT_BLOCK WaitBlock;
|
||||
|
||||
|
|
|
@ -297,7 +297,7 @@ PsTerminateOtherThread(PETHREAD Thread,
|
|||
if (THREAD_STATE_BLOCKED == Thread->Tcb.State && UserMode == Thread->Tcb.WaitMode)
|
||||
{
|
||||
DPRINT("Unblocking thread\n");
|
||||
KiAbortWaitThread((PKTHREAD)Thread, STATUS_THREAD_IS_TERMINATING);
|
||||
KiAbortWaitThread((PKTHREAD)Thread, STATUS_THREAD_IS_TERMINATING, IO_NO_INCREMENT);
|
||||
}
|
||||
KeReleaseDispatcherDatabaseLock(OldIrql);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue