Fix large startup times of processes linking to -lrbd.

Backport upstream commit 1c2831a2, fixes RHBZ#1319483.
This commit is contained in:
Richard W.M. Jones 2016-03-21 14:31:09 +00:00
parent 5e7cff58f4
commit 6d2e42e155
2 changed files with 102 additions and 2 deletions

View File

@ -0,0 +1,93 @@
From 1c2831a2c1277c69f9649200d74a75c04a4b0296 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Mon, 21 Mar 2016 14:24:35 +0000
Subject: [PATCH] common/Cycles: Do not initialize Cycles globally.
Move initialization to the few tests that actually use it.
Fixes: http://tracker.ceph.com/issues/15225
Signed-off-by: Richard W.M. Jones <rjones@redhat.com>
---
src/common/Cycles.cc | 11 ++++++-----
src/test/msgr/perf_msgr_client.cc | 1 +
src/test/msgr/perf_msgr_server.cc | 1 -
src/test/objectstore/ObjectStoreTransactionBenchmark.cc | 1 +
src/test/perf_local.cc | 1 +
5 files changed, 9 insertions(+), 6 deletions(-)
diff --git a/src/common/Cycles.cc b/src/common/Cycles.cc
index b0b687e..656f08b 100644
--- a/src/common/Cycles.cc
+++ b/src/common/Cycles.cc
@@ -38,14 +38,15 @@
#include "Cycles.h"
double Cycles::cycles_per_sec = 0;
-static Initialize _(Cycles::init);
/**
* Perform once-only overall initialization for the Cycles class, such
- * as calibrating the clock frequency. This method is invoked automatically
- * during initialization, but it may be invoked explicitly by other modules
- * to ensure that initialization occurs before those modules initialize
- * themselves.
+ * as calibrating the clock frequency. This method must be called
+ * before using the Cycles module.
+ *
+ * It is not initialized by default because the timing loops cause
+ * general process startup times to balloon
+ * (http://tracker.ceph.com/issues/15225).
*/
void Cycles::init()
{
diff --git a/src/test/msgr/perf_msgr_client.cc b/src/test/msgr/perf_msgr_client.cc
index fa21b49..1cb3db2 100644
--- a/src/test/msgr/perf_msgr_client.cc
+++ b/src/test/msgr/perf_msgr_client.cc
@@ -196,6 +196,7 @@ int main(int argc, char **argv)
cerr << " message data bytes " << len << std::endl;
MessengerClient client(g_ceph_context->_conf->ms_type, args[0], think_time);
client.ready(concurrent, numjobs, ios, len);
+ Cycles::init();
uint64_t start = Cycles::rdtsc();
client.start();
uint64_t stop = Cycles::rdtsc();
diff --git a/src/test/msgr/perf_msgr_server.cc b/src/test/msgr/perf_msgr_server.cc
index 3eae9a5..dde679c 100644
--- a/src/test/msgr/perf_msgr_server.cc
+++ b/src/test/msgr/perf_msgr_server.cc
@@ -25,7 +25,6 @@ using namespace std;
#include "include/atomic.h"
#include "common/ceph_argparse.h"
#include "common/debug.h"
-#include "common/Cycles.h"
#include "global/global_init.h"
#include "msg/Messenger.h"
#include "messages/MOSDOp.h"
diff --git a/src/test/objectstore/ObjectStoreTransactionBenchmark.cc b/src/test/objectstore/ObjectStoreTransactionBenchmark.cc
index 7c0dc09..46fd25d 100644
--- a/src/test/objectstore/ObjectStoreTransactionBenchmark.cc
+++ b/src/test/objectstore/ObjectStoreTransactionBenchmark.cc
@@ -249,6 +249,7 @@ int main(int argc, char **argv)
global_init(NULL, args, CEPH_ENTITY_TYPE_CLIENT, CODE_ENVIRONMENT_UTILITY, 0);
common_init_finish(g_ceph_context);
g_ceph_context->_conf->apply_changes(NULL);
+ Cycles::init();
cerr << "args: " << args << std::endl;
if (args.size() < 1) {
diff --git a/src/test/perf_local.cc b/src/test/perf_local.cc
index 49440c2..7c33dc5 100644
--- a/src/test/perf_local.cc
+++ b/src/test/perf_local.cc
@@ -1020,6 +1020,7 @@ int main(int argc, char *argv[])
global_init(NULL, args, CEPH_ENTITY_TYPE_CLIENT, CODE_ENVIRONMENT_UTILITY, 0);
common_init_finish(g_ceph_context);
+ Cycles::init();
bind_thread_to_cpu(3);
if (argc == 1) {
--
2.7.4

View File

@ -6,7 +6,7 @@
%bcond_without libs_compat
%bcond_with lowmem_builder
%if 0%{?fedora} || 0%{?rhel}
%bcond_without selinux
%bcond_with selinux
%endif
%if 0%{?suse_version}
%bcond_with selinux
@ -55,7 +55,7 @@ restorecon -R /var/log/ceph > /dev/null 2>&1;
#################################################################################
Name: ceph
Version: 9.2.0
Release: 4%{?dist}
Release: 5%{?dist}
Epoch: 1
Summary: User space components of the Ceph file system
License: LGPL-2.1 and CC-BY-SA-1.0 and GPL-2.0 and BSL-1.0 and GPL-2.0-with-autoconf-exception and BSD-3-Clause and MIT
@ -68,6 +68,8 @@ Source0: http://ceph.com/download/%{name}-%{version}.tar.bz2
Patch0: init-ceph.in-fedora.patch
%endif
Patch1: 0001-Disable-erasure_codelib-neon-build.patch
# Upstream commit 1c2831a2, fixes RHBZ#1319483
Patch2: 0001-common-Cycles-Do-not-initialize-Cycles-globally.patch
#################################################################################
# dependencies that apply across all distro families
#################################################################################
@ -542,6 +544,7 @@ python-cephfs instead.
%patch0 -p1 -b .init
%endif
%patch1 -p1 -b .neon
%patch2 -p1 -b .cycles
%build
%if 0%{with cephfs_java}
@ -1328,6 +1331,10 @@ exit 0
# actually build this meta package.
%changelog
* Mon Apr 11 2016 Richard W.M. Jones <rjones@redhat.com> - 1:9.2.0-5
- Fix large startup times of processes linking to -lrbd.
Backport upstream commit 1c2831a2, fixes RHBZ#1319483.
* Wed Feb 03 2016 Fedora Release Engineering <releng@fedoraproject.org> - 1:9.2.0-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild