accel_perf: Fix the memory leak issue of task free

When the task is allocated from _get_task function,
the task is removed from the tasks_pool in non batched mode.

So in _accel_done function, when the is_draining flag is true
and it is not a batched mode, we should add task back to the pool.
If not, the the memory related resource allocated by the task will
not be freed.

PS: In _check_draining function, the related resource of task
in the tasks_pool will be freed. However, if the task is not
added back, the resource free will not work as expected.

PS: The issue is reported by ASAN.

Signed-off-by: Ziye Yang <ziye.yang@intel.com>
Change-Id: I981117037fba8e111987c771cae65bc06a734a6f
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6097
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Community-CI: Mellanox Build Bot
This commit is contained in:
Ziye Yang 2021-01-27 04:06:25 +08:00 committed by Tomasz Zawadzki
parent 82240049d6
commit b34883e07b

View File

@ -570,8 +570,9 @@ _accel_done(void *arg1)
}
} else if (g_ops_per_batch > 0) {
_drain_batch(worker);
} else {
TAILQ_INSERT_TAIL(&worker->tasks_pool, task, link);
}
}
static int