From: Radoslaw Zarzynski Date: Mon, 29 Jan 2018 16:27:09 +0000 (+0100) Subject: os/bluestore: mark derivatives of AioContext as final. X-Git-Tag: v13.0.2~296^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=aff36389e705735d5c0b89b27e015a00ce3444fd;p=ceph.git 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 --- diff --git a/src/os/bluestore/BlueStore.h b/src/os/bluestore/BlueStore.h index 32f4cde3d9cd..5ab31791d109 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