[PATCH 3/3] os: Reduce smart scheduler setup calls
Adam Jackson
ajax at redhat.com
Mon Dec 14 12:19:49 PST 2009
We can return from WaitForSomething with no clients ready for any number
of reasons. There's no reason to set up the scheduler timer when this
happens.
Signed-off-by: Adam Jackson <ajax at redhat.com>
---
os/WaitFor.c | 12 +++++++++---
1 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/os/WaitFor.c b/os/WaitFor.c
index 1d16c74..73e7916 100644
--- a/os/WaitFor.c
+++ b/os/WaitFor.c
@@ -153,13 +153,17 @@ WaitForSomething(int *pClientsReady)
fd_set clientsWritable;
int curclient;
int selecterr;
- int nready;
+ static int nready;
fd_set devicesReadable;
CARD32 now = 0;
Bool someReady = FALSE;
FD_ZERO(&clientsReadable);
+ if (nready)
+ SmartScheduleStopTimer();
+ nready = 0;
+
/* We need a while loop here to handle
crashed connections and the screen saver timeout */
while (1)
@@ -211,7 +215,6 @@ WaitForSomething(int *pClientsReady)
}
XFD_COPYSET(&AllSockets, &LastSelectMask);
}
- SmartScheduleStopTimer ();
BlockHandler((pointer)&wt, (pointer)&LastSelectMask);
if (NewOutputPending)
@@ -230,7 +233,6 @@ WaitForSomething(int *pClientsReady)
}
selecterr = GetErrno();
WakeupHandler(i, (pointer)&LastSelectMask);
- SmartScheduleStartTimer ();
if (i <= 0) /* An error or timeout occurred */
{
if (dispatchException)
@@ -387,6 +389,10 @@ WaitForSomething(int *pClientsReady)
#endif
}
}
+
+ if (nready)
+ SmartScheduleStartTimer();
+
return nready;
}
--
1.6.5.2
More information about the xorg-devel
mailing list