From aff36389e705735d5c0b89b27e015a00ce3444fd Mon Sep 17 00:00:00 2001 From: Radoslaw Zarzynski Date: Mon, 29 Jan 2018 17:27:09 +0100 Subject: [PATCH] os/bluestore: mark derivatives of AioContext as final. Profiling `AioReadBatch`, a freshly introduced (at the moment in a wip branch; see PR #19380) descendant of `AioContext` showed that CPU cycles are burnt unnecessarily because of the dynamically polymorphic destructor call that can't be inlined: It's quite probable the same affects `TransContext` and `DeferredBatch`. Marking the classes as final allows compiler to inline the dtors calls in `::aio_finish` and, hopefully, optimize some of the extra overhead. Signed-off-by: Radoslaw Zarzynski --- src/os/bluestore/BlueStore.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/os/bluestore/BlueStore.h b/src/os/bluestore/BlueStore.h index 32f4cde3d9c..5ab31791d10 100644 --- a/src/os/bluestore/BlueStore.h +++ b/src/os/bluestore/BlueStore.h @@ -1480,7 +1480,7 @@ public: } }; - struct TransContext : public AioContext { + struct TransContext final : public AioContext { MEMPOOL_CLASS_HELPERS(); typedef enum { @@ -1619,7 +1619,7 @@ public: boost::intrusive::list_member_hook<>, &TransContext::deferred_queue_item> > deferred_queue_t; - struct DeferredBatch : public AioContext { + struct DeferredBatch final : public AioContext { OpSequencer *osr; struct deferred_io { bufferlist bl; ///< data -- 2.39.5