From f24c26495d0a03960453326068873d499e3de16b Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Thu, 19 Mar 2015 14:52:54 -0600 Subject: [PATCH] libaio: don't call io_destroy(), let exit_aio() take care of it From the exit_aio() path, we can parallellize the freeing, hence not taking an RCU grace period hit for each. Signed-off-by: Jens Axboe --- engines/libaio.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/engines/libaio.c b/engines/libaio.c index d4f48303..8ba21f89 100644 --- a/engines/libaio.c +++ b/engines/libaio.c @@ -316,7 +316,14 @@ static void fio_libaio_cleanup(struct thread_data *td) struct libaio_data *ld = td->io_ops->data; if (ld) { - io_destroy(ld->aio_ctx); + /* + * Work-around to avoid huge RCU stalls at exit time. If we + * don't do this here, then it'll be torn down by exit_aio(). + * But for that case we can parallellize the freeing, thus + * speeding it up a lot. + */ + if (!(td->flags & TD_F_CHILD)) + io_destroy(ld->aio_ctx); free(ld->aio_events); free(ld->iocbs); free(ld->io_us); -- 2.25.1