From 0ae0b5aa4136fe6df7863c8a5b7d239d519b7393 Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Wed, 12 Jul 2017 12:17:51 -0400 Subject: Queue consensus diffs at LOW priority. Fixes bug 22883. --- src/or/consdiffmgr.c | 6 ++++-- src/or/cpuworker.c | 15 +++++++++------ src/or/cpuworker.h | 2 ++ 3 files changed, 15 insertions(+), 8 deletions(-) (limited to 'src/or') diff --git a/src/or/consdiffmgr.c b/src/or/consdiffmgr.c index 638fcd6794..8d0a0af3d5 100644 --- a/src/or/consdiffmgr.c +++ b/src/or/consdiffmgr.c @@ -1605,7 +1605,8 @@ consensus_diff_queue_diff_work(consensus_cache_entry_t *diff_from, goto err; workqueue_entry_t *work; - work = cpuworker_queue_work(consensus_diff_worker_threadfn, + work = cpuworker_queue_work(WQ_PRI_LOW, + consensus_diff_worker_threadfn, consensus_diff_worker_replyfn, job); if (!work) @@ -1768,7 +1769,8 @@ consensus_queue_compression_work(const char *consensus, if (background_compression) { workqueue_entry_t *work; - work = cpuworker_queue_work(consensus_compress_worker_threadfn, + work = cpuworker_queue_work(WQ_PRI_LOW, + consensus_compress_worker_threadfn, consensus_compress_worker_replyfn, job); if (!work) { diff --git a/src/or/cpuworker.c b/src/or/cpuworker.c index 1013fa555e..ad99af64c0 100644 --- a/src/or/cpuworker.c +++ b/src/or/cpuworker.c @@ -481,16 +481,18 @@ queue_pending_tasks(void) /** DOCDOC */ MOCK_IMPL(workqueue_entry_t *, -cpuworker_queue_work,(workqueue_reply_t (*fn)(void *, void *), +cpuworker_queue_work,(workqueue_priority_t priority, + workqueue_reply_t (*fn)(void *, void *), void (*reply_fn)(void *), void *arg)) { tor_assert(threadpool); - return threadpool_queue_work(threadpool, - fn, - reply_fn, - arg); + return threadpool_queue_work_priority(threadpool, + priority, + fn, + reply_fn, + arg); } /** Try to tell a cpuworker to perform the public key operations necessary to @@ -545,7 +547,8 @@ assign_onionskin_to_cpuworker(or_circuit_t *circ, memwipe(&req, 0, sizeof(req)); ++total_pending_tasks; - queue_entry = threadpool_queue_work(threadpool, + queue_entry = threadpool_queue_work_priority(threadpool, + WQ_PRI_HIGH, cpuworker_onion_handshake_threadfn, cpuworker_onion_handshake_replyfn, job); diff --git a/src/or/cpuworker.h b/src/or/cpuworker.h index aedf2fae32..320de9532f 100644 --- a/src/or/cpuworker.h +++ b/src/or/cpuworker.h @@ -16,7 +16,9 @@ void cpu_init(void); void cpuworkers_rotate_keyinfo(void); struct workqueue_entry_s; enum workqueue_reply_t; +enum workqueue_priority_t; MOCK_DECL(struct workqueue_entry_s *, cpuworker_queue_work, ( + enum workqueue_priority_t priority, enum workqueue_reply_t (*fn)(void *, void *), void (*reply_fn)(void *), void *arg)); -- cgit v1.2.3-54-g00ecf