|
Ian Kent |
cc4062 |
autofs-5.0.5 - remove state machine timed wait
|
|
Ian Kent |
cc4062 |
|
|
Ian Kent |
cc4062 |
From: Ian Kent <raven@themaw.net>
|
|
Ian Kent |
cc4062 |
|
|
Ian Kent |
cc4062 |
We are seeing a problem using timed waits when running under KVM.
|
|
Ian Kent |
cc4062 |
|
|
Ian Kent |
cc4062 |
Using timed condition waits in the state machine (and in some other
|
|
Ian Kent |
cc4062 |
places) has been used because of observed task throughput problems
|
|
Ian Kent |
cc4062 |
in the past. Also, we've seen condition waits not reacting to signals
|
|
Ian Kent |
cc4062 |
occassionaly.
|
|
Ian Kent |
cc4062 |
|
|
Ian Kent |
cc4062 |
But now we are seeing problems with the setup of the wait time within
|
|
Ian Kent |
cc4062 |
KVM VMs causing the condition wait to go into a tight loop using
|
|
Ian Kent |
cc4062 |
excessive CPU.
|
|
Ian Kent |
cc4062 |
|
|
Ian Kent |
cc4062 |
Changing the state queue handler to not use timed waits appears to
|
|
Ian Kent |
cc4062 |
not have the previously observed throughput problems, hopefully we
|
|
Ian Kent |
cc4062 |
won't see lost signals either.
|
|
Ian Kent |
cc4062 |
---
|
|
Ian Kent |
cc4062 |
|
|
Ian Kent |
cc4062 |
CHANGELOG | 1 +
|
|
Ian Kent |
cc4062 |
daemon/state.c | 30 +++++++-----------------------
|
|
Ian Kent |
cc4062 |
2 files changed, 8 insertions(+), 23 deletions(-)
|
|
Ian Kent |
cc4062 |
|
|
Ian Kent |
cc4062 |
|
|
Ian Kent |
cc4062 |
--- autofs-5.0.5.orig/CHANGELOG
|
|
Ian Kent |
cc4062 |
+++ autofs-5.0.5/CHANGELOG
|
|
Ian Kent |
cc4062 |
@@ -42,6 +42,7 @@
|
|
Ian Kent |
cc4062 |
- fix mapent becomes negative during lookup.
|
|
Ian Kent |
cc4062 |
- check each dc server individually.
|
|
Ian Kent |
cc4062 |
- fix negative cache included map lookup.
|
|
Ian Kent |
cc4062 |
+- remove state machine timed wait.
|
|
Ian Kent |
cc4062 |
|
|
Ian Kent |
cc4062 |
03/09/2009 autofs-5.0.5
|
|
Ian Kent |
cc4062 |
-----------------------
|
|
Ian Kent |
cc4062 |
--- autofs-5.0.5.orig/daemon/state.c
|
|
Ian Kent |
cc4062 |
+++ autofs-5.0.5/daemon/state.c
|
|
Ian Kent |
cc4062 |
@@ -197,11 +197,11 @@ void expire_cleanup(void *arg)
|
|
Ian Kent |
cc4062 |
}
|
|
Ian Kent |
cc4062 |
}
|
|
Ian Kent |
cc4062 |
|
|
Ian Kent |
cc4062 |
+ st_set_done(ap);
|
|
Ian Kent |
cc4062 |
+
|
|
Ian Kent |
cc4062 |
if (next != ST_INVAL)
|
|
Ian Kent |
cc4062 |
__st_add_task(ap, next);
|
|
Ian Kent |
cc4062 |
|
|
Ian Kent |
cc4062 |
- st_set_done(ap);
|
|
Ian Kent |
cc4062 |
-
|
|
Ian Kent |
cc4062 |
st_mutex_unlock();
|
|
Ian Kent |
cc4062 |
|
|
Ian Kent |
cc4062 |
return;
|
|
Ian Kent |
cc4062 |
@@ -332,11 +332,10 @@ static void do_readmap_cleanup(void *arg
|
|
Ian Kent |
cc4062 |
st_mutex_lock();
|
|
Ian Kent |
cc4062 |
|
|
Ian Kent |
cc4062 |
ap->readmap_thread = 0;
|
|
Ian Kent |
cc4062 |
- st_ready(ap);
|
|
Ian Kent |
cc4062 |
st_set_done(ap);
|
|
Ian Kent |
cc4062 |
-
|
|
Ian Kent |
cc4062 |
if (!ap->submount)
|
|
Ian Kent |
cc4062 |
alarm_add(ap, ap->exp_runfreq);
|
|
Ian Kent |
cc4062 |
+ st_ready(ap);
|
|
Ian Kent |
cc4062 |
|
|
Ian Kent |
cc4062 |
st_mutex_unlock();
|
|
Ian Kent |
cc4062 |
|
|
Ian Kent |
cc4062 |
@@ -1060,8 +1059,6 @@ static void *st_queue_handler(void *arg)
|
|
Ian Kent |
cc4062 |
{
|
|
Ian Kent |
cc4062 |
struct list_head *head;
|
|
Ian Kent |
cc4062 |
struct list_head *p;
|
|
Ian Kent |
cc4062 |
- struct timespec wait;
|
|
Ian Kent |
cc4062 |
- struct timeval now;
|
|
Ian Kent |
cc4062 |
int status, ret;
|
|
Ian Kent |
cc4062 |
|
|
Ian Kent |
cc4062 |
st_mutex_lock();
|
|
Ian Kent |
cc4062 |
@@ -1072,17 +1069,11 @@ static void *st_queue_handler(void *arg)
|
|
Ian Kent |
cc4062 |
* entry is added.
|
|
Ian Kent |
cc4062 |
*/
|
|
Ian Kent |
cc4062 |
head = &state_queue;
|
|
Ian Kent |
cc4062 |
- gettimeofday(&now, NULL);
|
|
Ian Kent |
cc4062 |
- wait.tv_sec = now.tv_sec + 1;
|
|
Ian Kent |
cc4062 |
- wait.tv_nsec = now.tv_usec * 1000;
|
|
Ian Kent |
cc4062 |
|
|
Ian Kent |
cc4062 |
while (list_empty(head)) {
|
|
Ian Kent |
cc4062 |
- status = pthread_cond_timedwait(&cond, &mutex, &wait);
|
|
Ian Kent |
cc4062 |
- if (status) {
|
|
Ian Kent |
cc4062 |
- if (status == ETIMEDOUT)
|
|
Ian Kent |
cc4062 |
- break;
|
|
Ian Kent |
cc4062 |
+ status = pthread_cond_wait(&cond, &mutex);
|
|
Ian Kent |
cc4062 |
+ if (status)
|
|
Ian Kent |
cc4062 |
fatal(status);
|
|
Ian Kent |
cc4062 |
- }
|
|
Ian Kent |
cc4062 |
}
|
|
Ian Kent |
cc4062 |
|
|
Ian Kent |
cc4062 |
p = head->next;
|
|
Ian Kent |
cc4062 |
@@ -1108,18 +1099,11 @@ static void *st_queue_handler(void *arg)
|
|
Ian Kent |
cc4062 |
}
|
|
Ian Kent |
cc4062 |
|
|
Ian Kent |
cc4062 |
while (1) {
|
|
Ian Kent |
cc4062 |
- gettimeofday(&now, NULL);
|
|
Ian Kent |
cc4062 |
- wait.tv_sec = now.tv_sec + 1;
|
|
Ian Kent |
cc4062 |
- wait.tv_nsec = now.tv_usec * 1000;
|
|
Ian Kent |
cc4062 |
-
|
|
Ian Kent |
cc4062 |
signaled = 0;
|
|
Ian Kent |
cc4062 |
while (!signaled) {
|
|
Ian Kent |
cc4062 |
- status = pthread_cond_timedwait(&cond, &mutex, &wait);
|
|
Ian Kent |
cc4062 |
- if (status) {
|
|
Ian Kent |
cc4062 |
- if (status == ETIMEDOUT)
|
|
Ian Kent |
cc4062 |
- break;
|
|
Ian Kent |
cc4062 |
+ status = pthread_cond_wait(&cond, &mutex);
|
|
Ian Kent |
cc4062 |
+ if (status)
|
|
Ian Kent |
cc4062 |
fatal(status);
|
|
Ian Kent |
cc4062 |
- }
|
|
Ian Kent |
cc4062 |
}
|
|
Ian Kent |
cc4062 |
|
|
Ian Kent |
cc4062 |
head = &state_queue;
|