From 414d508e04d26ebef0e3e1ba4ed518b11d3af1a0 Mon Sep 17 00:00:00 2001 From: Max Romanov Date: Wed, 4 Oct 2017 14:58:13 +0300 Subject: Using engine memiory pool for port write allocations. To allow use port from different threads, the first step is to avoid using port's memory pool for temporary allocations required to send data through the port. Including but not limited by: - buffers for data; - send message structures; - new mmap fd notifications; It is still safe to use port memory pool for incoming buffers allocations because recieve operation bound to single thread. --- src/nxt_router.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) (limited to 'src/nxt_router.c') diff --git a/src/nxt_router.c b/src/nxt_router.c index f923d72c..df3caf82 100644 --- a/src/nxt_router.c +++ b/src/nxt_router.c @@ -2498,7 +2498,7 @@ nxt_router_send_sw_request(nxt_task_t *task, void *obj, void *data) size = app->name.length + 1 + app->conf.length; - b = nxt_buf_mem_alloc(main_port->mem_pool, size, 0); + b = nxt_buf_mem_ts_alloc(task, task->thread->engine->mem_pool, size); nxt_buf_cpystr(b, &app->name); *b->mem.free++ = '\0'; @@ -2964,7 +2964,6 @@ static void nxt_router_process_http_request(nxt_task_t *task, nxt_conn_t *c, nxt_app_parse_ctx_t *ap) { - nxt_mp_t *port_mp; nxt_int_t res; nxt_port_t *port; nxt_event_engine_t *engine; @@ -3012,13 +3011,8 @@ nxt_router_process_http_request(nxt_task_t *task, nxt_conn_t *c, nxt_port_rpc_ex_set_peer(task, engine->port, rc, port->pid); - port_mp = port->mem_pool; - port->mem_pool = c->mem_pool; - nxt_router_process_http_request_mp(task, ra, port); - port->mem_pool = port_mp; - nxt_router_ra_release(task, ra, ra->work.data); } -- cgit