The smart scheduler is not optional.

This commit is contained in:
Mathieu Bérard 2008-08-11 13:52:38 -04:00 committed by Adam Jackson
parent 2e2ce817ce
commit 9f9268821b
11 changed files with 0 additions and 63 deletions

View File

@ -1041,7 +1041,6 @@ AC_SUBST([VENDOR_NAME_SHORT])
AC_SUBST([VENDOR_RELEASE]) AC_SUBST([VENDOR_RELEASE])
AC_SUBST([VENDOR_MAN_VERSION]) AC_SUBST([VENDOR_MAN_VERSION])
AC_DEFINE(SMART_SCHEDULE, 1, [Include time-based scheduler])
AC_DEFINE(NO_LIBCWRAPPER, 1, [Define to 1 if modules should avoid the libcwrapper]) AC_DEFINE(NO_LIBCWRAPPER, 1, [Define to 1 if modules should avoid the libcwrapper])
if test "x$DEBUGGING" = xyes; then if test "x$DEBUGGING" = xyes; then

View File

@ -90,9 +90,7 @@ DamageExtNotify (DamageExtPtr pDamageExt, BoxPtr pBoxes, int nBoxes)
if (pDamageClient->critical > 0) if (pDamageClient->critical > 0)
{ {
SetCriticalOutputPending (); SetCriticalOutputPending ();
#ifdef SMART_SCHEDULE
pClient->smart_priority = SMART_MAX_PRIORITY; pClient->smart_priority = SMART_MAX_PRIORITY;
#endif
} }
} }

View File

@ -237,7 +237,6 @@ UpdateCurrentTimeIf(void)
currentTime = systime; currentTime = systime;
} }
#ifdef SMART_SCHEDULE
#undef SMART_DEBUG #undef SMART_DEBUG
@ -338,7 +337,6 @@ SmartScheduleClient (int *clientReady, int nready)
} }
return best; return best;
} }
#endif
#define MAJOROP ((xReq *)client->requestBuffer)->reqType #define MAJOROP ((xReq *)client->requestBuffer)->reqType
@ -350,9 +348,7 @@ Dispatch(void)
ClientPtr client; ClientPtr client;
int nready; int nready;
HWEventQueuePtr* icheck = checkForInput; HWEventQueuePtr* icheck = checkForInput;
#ifdef SMART_SCHEDULE
long start_tick; long start_tick;
#endif
nextFreeClientID = 1; nextFreeClientID = 1;
nClients = 0; nClients = 0;
@ -371,13 +367,11 @@ Dispatch(void)
nready = WaitForSomething(clientReady); nready = WaitForSomething(clientReady);
#ifdef SMART_SCHEDULE
if (nready && !SmartScheduleDisable) if (nready && !SmartScheduleDisable)
{ {
clientReady[0] = SmartScheduleClient (clientReady, nready); clientReady[0] = SmartScheduleClient (clientReady, nready);
nready = 1; nready = 1;
} }
#endif
/***************** /*****************
* Handle events in round robin fashion, doing input between * Handle events in round robin fashion, doing input between
* each round * each round
@ -399,16 +393,13 @@ Dispatch(void)
} }
isItTimeToYield = FALSE; isItTimeToYield = FALSE;
#ifdef SMART_SCHEDULE
start_tick = SmartScheduleTime; start_tick = SmartScheduleTime;
#endif
while (!isItTimeToYield) while (!isItTimeToYield)
{ {
if (*icheck[0] != *icheck[1]) if (*icheck[0] != *icheck[1])
ProcessInputEvents(); ProcessInputEvents();
FlushIfCriticalOutputPending(); FlushIfCriticalOutputPending();
#ifdef SMART_SCHEDULE
if (!SmartScheduleDisable && if (!SmartScheduleDisable &&
(SmartScheduleTime - start_tick) >= SmartScheduleSlice) (SmartScheduleTime - start_tick) >= SmartScheduleSlice)
{ {
@ -417,7 +408,6 @@ Dispatch(void)
client->smart_priority--; client->smart_priority--;
break; break;
} }
#endif
/* now, finally, deal with client requests */ /* now, finally, deal with client requests */
result = ReadRequestFromClient(client); result = ReadRequestFromClient(client);
@ -465,11 +455,9 @@ Dispatch(void)
} }
} }
FlushAllOutput(); FlushAllOutput();
#ifdef SMART_SCHEDULE
client = clients[clientReady[nready]]; client = clients[clientReady[nready]];
if (client) if (client)
client->smart_stop_tick = SmartScheduleTime; client->smart_stop_tick = SmartScheduleTime;
#endif
} }
dispatchException &= ~DE_PRIORITYCHANGE; dispatchException &= ~DE_PRIORITYCHANGE;
} }
@ -3453,9 +3441,7 @@ CloseDownClient(ClientPtr client)
if (client->index < nextFreeClientID) if (client->index < nextFreeClientID)
nextFreeClientID = client->index; nextFreeClientID = client->index;
clients[client->index] = NullClient; clients[client->index] = NullClient;
#ifdef SMART_SCHEDULE
SmartLastClient = NullClient; SmartLastClient = NullClient;
#endif
dixFreePrivates(client->devPrivates); dixFreePrivates(client->devPrivates);
xfree(client); xfree(client);
@ -3505,12 +3491,10 @@ void InitClient(ClientPtr client, int i, pointer ospriv)
#endif #endif
client->replyBytesRemaining = 0; client->replyBytesRemaining = 0;
client->fontResFunc = NULL; client->fontResFunc = NULL;
#ifdef SMART_SCHEDULE
client->smart_priority = 0; client->smart_priority = 0;
client->smart_start_tick = SmartScheduleTime; client->smart_start_tick = SmartScheduleTime;
client->smart_stop_tick = SmartScheduleTime; client->smart_stop_tick = SmartScheduleTime;
client->smart_check_tick = SmartScheduleTime; client->smart_check_tick = SmartScheduleTime;
#endif
client->clientPtr = NULL; client->clientPtr = NULL;
} }

View File

@ -2014,10 +2014,8 @@ TryClientEvents (ClientPtr client, DeviceIntPtr dev, xEvent *pEvents,
if (BitIsOn(criticalEvents, type)) if (BitIsOn(criticalEvents, type))
{ {
#ifdef SMART_SCHEDULE
if (client->smart_priority < SMART_MAX_PRIORITY) if (client->smart_priority < SMART_MAX_PRIORITY)
client->smart_priority++; client->smart_priority++;
#endif
SetCriticalOutputPending(); SetCriticalOutputPending();
} }

View File

@ -252,9 +252,6 @@
/* Support SHAPE extension */ /* Support SHAPE extension */
#undef SHAPE #undef SHAPE
/* Include time-based scheduler */
#undef SMART_SCHEDULE
/* Define to 1 on systems derived from System V Release 4 */ /* Define to 1 on systems derived from System V Release 4 */
#undef SVR4 #undef SVR4

View File

@ -129,17 +129,14 @@ typedef struct _Client {
struct _FontResolution * (*fontResFunc) ( /* no need for font.h */ struct _FontResolution * (*fontResFunc) ( /* no need for font.h */
ClientPtr /* pClient */, ClientPtr /* pClient */,
int * /* num */); int * /* num */);
#ifdef SMART_SCHEDULE
int smart_priority; int smart_priority;
long smart_start_tick; long smart_start_tick;
long smart_stop_tick; long smart_stop_tick;
long smart_check_tick; long smart_check_tick;
#endif
DeviceIntPtr clientPtr; DeviceIntPtr clientPtr;
} ClientRec; } ClientRec;
#ifdef SMART_SCHEDULE
/* /*
* Scheduling interface * Scheduling interface
*/ */
@ -155,7 +152,6 @@ extern void SmartScheduleStopTimer(void);
extern Bool SmartScheduleInit(void); extern Bool SmartScheduleInit(void);
#endif
/* This prototype is used pervasively in Xext, dix */ /* This prototype is used pervasively in Xext, dix */
#define DISPATCH_PROC(func) int func(ClientPtr /* client */) #define DISPATCH_PROC(func) int func(ClientPtr /* client */)

View File

@ -61,9 +61,6 @@
/* Support SHAPE extension */ /* Support SHAPE extension */
#undef SHAPE #undef SHAPE
/* Include time-based scheduler */
#undef SMART_SCHEDULE
/* Define to 1 on systems derived from System V Release 4 */ /* Define to 1 on systems derived from System V Release 4 */
#undef SVR4 #undef SVR4

View File

@ -155,9 +155,7 @@ WaitForSomething(int *pClientsReady)
int nready; int nready;
fd_set devicesReadable; fd_set devicesReadable;
CARD32 now = 0; CARD32 now = 0;
#ifdef SMART_SCHEDULE
Bool someReady = FALSE; Bool someReady = FALSE;
#endif
FD_ZERO(&clientsReadable); FD_ZERO(&clientsReadable);
@ -170,7 +168,6 @@ WaitForSomething(int *pClientsReady)
ProcessWorkQueue(); ProcessWorkQueue();
if (XFD_ANYSET (&ClientsWithInput)) if (XFD_ANYSET (&ClientsWithInput))
{ {
#ifdef SMART_SCHEDULE
if (!SmartScheduleDisable) if (!SmartScheduleDisable)
{ {
someReady = TRUE; someReady = TRUE;
@ -179,13 +176,11 @@ WaitForSomething(int *pClientsReady)
wt = &waittime; wt = &waittime;
} }
else else
#endif
{ {
XFD_COPYSET (&ClientsWithInput, &clientsReadable); XFD_COPYSET (&ClientsWithInput, &clientsReadable);
break; break;
} }
} }
#ifdef SMART_SCHEDULE
if (someReady) if (someReady)
{ {
XFD_COPYSET(&AllSockets, &LastSelectMask); XFD_COPYSET(&AllSockets, &LastSelectMask);
@ -193,7 +188,6 @@ WaitForSomething(int *pClientsReady)
} }
else else
{ {
#endif
wt = NULL; wt = NULL;
if (timers) if (timers)
{ {
@ -215,11 +209,9 @@ WaitForSomething(int *pClientsReady)
} }
} }
XFD_COPYSET(&AllSockets, &LastSelectMask); XFD_COPYSET(&AllSockets, &LastSelectMask);
#ifdef SMART_SCHEDULE
} }
SmartScheduleStopTimer (); SmartScheduleStopTimer ();
#endif
BlockHandler((pointer)&wt, (pointer)&LastSelectMask); BlockHandler((pointer)&wt, (pointer)&LastSelectMask);
if (NewOutputPending) if (NewOutputPending)
FlushAllOutput(); FlushAllOutput();
@ -237,9 +229,7 @@ WaitForSomething(int *pClientsReady)
} }
selecterr = GetErrno(); selecterr = GetErrno();
WakeupHandler(i, (pointer)&LastSelectMask); WakeupHandler(i, (pointer)&LastSelectMask);
#ifdef SMART_SCHEDULE
SmartScheduleStartTimer (); SmartScheduleStartTimer ();
#endif
if (i <= 0) /* An error or timeout occurred */ if (i <= 0) /* An error or timeout occurred */
{ {
if (dispatchException) if (dispatchException)
@ -263,7 +253,6 @@ WaitForSomething(int *pClientsReady)
strerror(selecterr)); strerror(selecterr));
} }
} }
#ifdef SMART_SCHEDULE
else if (someReady) else if (someReady)
{ {
/* /*
@ -273,7 +262,6 @@ WaitForSomething(int *pClientsReady)
XFD_COPYSET(&ClientsWithInput, &clientsReadable); XFD_COPYSET(&ClientsWithInput, &clientsReadable);
break; break;
} }
#endif
if (*checkForInput[0] != *checkForInput[1]) if (*checkForInput[0] != *checkForInput[1])
return 0; return 0;
@ -310,10 +298,8 @@ WaitForSomething(int *pClientsReady)
return 0; return 0;
} }
} }
#ifdef SMART_SCHEDULE
if (someReady) if (someReady)
XFD_ORSET(&LastSelectMask, &ClientsWithInput, &LastSelectMask); XFD_ORSET(&LastSelectMask, &ClientsWithInput, &LastSelectMask);
#endif
if (AnyClientsWriteBlocked && XFD_ANYSET (&clientsWritable)) if (AnyClientsWriteBlocked && XFD_ANYSET (&clientsWritable))
{ {
NewOutputPending = TRUE; NewOutputPending = TRUE;

View File

@ -411,11 +411,9 @@ ReadRequestFromClient(ClientPtr client)
FD_SET(fd, &ClientsWithInput); FD_SET(fd, &ClientsWithInput);
else else
{ {
#ifdef SMART_SCHEDULE
if (!SmartScheduleDisable) if (!SmartScheduleDisable)
FD_CLR(fd, &ClientsWithInput); FD_CLR(fd, &ClientsWithInput);
else else
#endif
YieldControlNoInput(); YieldControlNoInput();
} }
} }
@ -423,16 +421,12 @@ ReadRequestFromClient(ClientPtr client)
{ {
if (!gotnow) if (!gotnow)
AvailableInput = oc; AvailableInput = oc;
#ifdef SMART_SCHEDULE
if (!SmartScheduleDisable) if (!SmartScheduleDisable)
FD_CLR(fd, &ClientsWithInput); FD_CLR(fd, &ClientsWithInput);
else else
#endif
YieldControlNoInput(); YieldControlNoInput();
} }
#ifdef SMART_SCHEDULE
if (SmartScheduleDisable) if (SmartScheduleDisable)
#endif
if (++timesThisConnection >= MAX_TIMES_PER) if (++timesThisConnection >= MAX_TIMES_PER)
YieldControl(); YieldControl();
if (move_header) if (move_header)

View File

@ -55,9 +55,7 @@ SOFTWARE.
#include "osdep.h" #include "osdep.h"
#include <X11/Xos.h> #include <X11/Xos.h>
#ifdef SMART_SCHEDULE
#include "dixstruct.h" #include "dixstruct.h"
#endif
#ifndef PATH_MAX #ifndef PATH_MAX
#ifdef MAXPATHLEN #ifdef MAXPATHLEN
@ -199,11 +197,9 @@ OsInit(void)
* log file name if logging to a file is desired. * log file name if logging to a file is desired.
*/ */
LogInit(NULL, NULL); LogInit(NULL, NULL);
#ifdef SMART_SCHEDULE
if (!SmartScheduleDisable) if (!SmartScheduleDisable)
if (!SmartScheduleInit ()) if (!SmartScheduleInit ())
SmartScheduleDisable = TRUE; SmartScheduleDisable = TRUE;
#endif
} }
void void

View File

@ -111,9 +111,7 @@ OR PERFORMANCE OF THIS SOFTWARE.
#include "opaque.h" #include "opaque.h"
#ifdef SMART_SCHEDULE
#include "dixstruct.h" #include "dixstruct.h"
#endif
#ifdef XKB #ifdef XKB
#include <xkbsrv.h> #include <xkbsrv.h>
@ -552,10 +550,8 @@ void UseMsg(void)
ErrorF("+xinerama Enable XINERAMA extension\n"); ErrorF("+xinerama Enable XINERAMA extension\n");
ErrorF("-xinerama Disable XINERAMA extension\n"); ErrorF("-xinerama Disable XINERAMA extension\n");
#endif #endif
#ifdef SMART_SCHEDULE
ErrorF("-dumbSched Disable smart scheduling, enable old behavior\n"); ErrorF("-dumbSched Disable smart scheduling, enable old behavior\n");
ErrorF("-schedInterval int Set scheduler interval in msec\n"); ErrorF("-schedInterval int Set scheduler interval in msec\n");
#endif
ErrorF("+extension name Enable extension\n"); ErrorF("+extension name Enable extension\n");
ErrorF("-extension name Disable extension\n"); ErrorF("-extension name Disable extension\n");
#ifdef XDMCP #ifdef XDMCP
@ -926,7 +922,6 @@ ProcessCommandLine(int argc, char *argv[])
i = skip - 1; i = skip - 1;
} }
#endif #endif
#ifdef SMART_SCHEDULE
else if ( strcmp( argv[i], "-dumbSched") == 0) else if ( strcmp( argv[i], "-dumbSched") == 0)
{ {
SmartScheduleDisable = TRUE; SmartScheduleDisable = TRUE;
@ -950,7 +945,6 @@ ProcessCommandLine(int argc, char *argv[])
else else
UseMsg(); UseMsg();
} }
#endif
#ifdef RENDER #ifdef RENDER
else if ( strcmp( argv[i], "-render" ) == 0) else if ( strcmp( argv[i], "-render" ) == 0)
{ {
@ -1234,7 +1228,6 @@ XNFstrdup(const char *s)
return sd; return sd;
} }
#ifdef SMART_SCHEDULE
#ifdef SIGVTALRM #ifdef SIGVTALRM
#define SMART_SCHEDULE_POSSIBLE #define SMART_SCHEDULE_POSSIBLE
@ -1310,7 +1303,6 @@ SmartScheduleInit (void)
return FALSE; return FALSE;
#endif #endif
} }
#endif
#ifdef SIG_BLOCK #ifdef SIG_BLOCK
static sigset_t PreviousSignalMask; static sigset_t PreviousSignalMask;