From: Marek VavruĊĦa Date: Wed, 8 Jul 2015 01:36:02 +0000 (+0200) Subject: daemon/worker: compile-time support for recvmmsg in worker buffers X-Git-Tag: v1.0.0-beta1~83^2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b3f528f7d0e21f22c6ff38db0c72d3662974e646;p=thirdparty%2Fknot-resolver.git daemon/worker: compile-time support for recvmmsg in worker buffers --- diff --git a/daemon/engine.h b/daemon/engine.h index e82474cd9..13dc097b1 100644 --- a/daemon/engine.h +++ b/daemon/engine.h @@ -26,6 +26,9 @@ #ifndef MP_FREELIST_SIZE #define MP_FREELIST_SIZE 32 /**< Maximum length of the worker mempool freelist */ #endif +#ifndef RECVMMSG_BATCH +#define RECVMMSG_BATCH 8 +#endif /* * @internal These are forward decls to allow building modules with engine but without Lua. diff --git a/daemon/worker.c b/daemon/worker.c index 63f4dad13..d5dc65ee1 100644 --- a/daemon/worker.c +++ b/daemon/worker.c @@ -75,7 +75,7 @@ static struct qr_task *qr_task_create(struct worker_ctx *worker, uv_handle_t *ha pool.ctx = array_tail(worker->pools); array_pop(worker->pools); } else { /* No mempool on the freelist, create new one */ - pool.ctx = mp_new (16 * CPU_PAGE_SIZE); + pool.ctx = mp_new (20 * CPU_PAGE_SIZE); } /* Create worker task */ diff --git a/daemon/worker.h b/daemon/worker.h index ca627d5f4..233c865b7 100644 --- a/daemon/worker.h +++ b/daemon/worker.h @@ -32,13 +32,18 @@ struct worker_ctx { struct engine *engine; uv_loop_t *loop; mm_ctx_t *mm; - uint8_t wire_buf[4 * KNOT_WIRE_MAX_PKTSIZE]; +#if __linux__ + uint8_t wire_buf[RECVMMSG_BATCH * KNOT_WIRE_MAX_PKTSIZE]; +#else + uint8_t wire_buf[KNOT_WIRE_MAX_PKTSIZE]; +#endif struct { size_t concurrent; size_t udp; size_t tcp; } stats; mp_freelist_t pools; + mp_freelist_t ioreqs; }; /**