summaryrefslogtreecommitdiffstats
path: root/lib/workqueue.c
diff options
context:
space:
mode:
authorPaul Jakma <paul@quagga.net>2010-01-11 14:55:01 +0100
committerPaul Jakma <paul@quagga.net>2010-12-08 17:53:09 +0100
commit3322055b392f20f4b97122a8034e479719e4b86d (patch)
treeeacb5bc1e5b5864241e0864b5f78e233e7b828c0 /lib/workqueue.c
parentlib: Add a command to clear the thread CPU history data (diff)
downloadfrr-3322055b392f20f4b97122a8034e479719e4b86d.tar.xz
frr-3322055b392f20f4b97122a8034e479719e4b86d.zip
lib: Make workqueue more conservative about ramping up
* workqueue.c: (work_queue_run) Err more on the side of keeping granularity down, by being more conservative about increasing it. Also, fix mispelling.
Diffstat (limited to 'lib/workqueue.c')
-rw-r--r--lib/workqueue.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/lib/workqueue.c b/lib/workqueue.c
index 7c811edd1..52b5f41c5 100644
--- a/lib/workqueue.c
+++ b/lib/workqueue.c
@@ -341,7 +341,7 @@ work_queue_run (struct thread *thread)
stats:
-#define WQ_HYSTERIS_FACTOR 2
+#define WQ_HYSTERESIS_FACTOR 4
/* we yielded, check whether granularity should be reduced */
if (yielded && (cycles < wq->cycles.granularity))
@@ -349,17 +349,18 @@ stats:
wq->cycles.granularity = ((cycles > 0) ? cycles
: WORK_QUEUE_MIN_GRANULARITY);
}
-
- if (cycles >= (wq->cycles.granularity))
+ /* otherwise, should granularity increase? */
+ else if (cycles >= (wq->cycles.granularity))
{
if (cycles > wq->cycles.best)
wq->cycles.best = cycles;
- /* along with yielded check, provides hysteris for granularity */
- if (cycles > (wq->cycles.granularity * WQ_HYSTERIS_FACTOR * 2))
- wq->cycles.granularity *= WQ_HYSTERIS_FACTOR; /* quick ramp-up */
- else if (cycles > (wq->cycles.granularity * WQ_HYSTERIS_FACTOR))
- wq->cycles.granularity += WQ_HYSTERIS_FACTOR;
+ /* along with yielded check, provides hysteresis for granularity */
+ if (cycles > (wq->cycles.granularity * WQ_HYSTERESIS_FACTOR
+ * WQ_HYSTERESIS_FACTOR))
+ wq->cycles.granularity *= WQ_HYSTERESIS_FACTOR; /* quick ramp-up */
+ else if (cycles > (wq->cycles.granularity * WQ_HYSTERESIS_FACTOR))
+ wq->cycles.granularity += WQ_HYSTERESIS_FACTOR;
}
#undef WQ_HYSTERIS_FACTOR