6a533d52ba
Resolves: bz2088798 Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2088798 Signed-off-by: Pingfan Liu <piliu@redhat.com>
59 lines
1.6 KiB
Diff
59 lines
1.6 KiB
Diff
From b4543efe798bbc255519fdcec73484cbd43472d1 Mon Sep 17 00:00:00 2001
|
|
From: Sandipan Das <sandipan.das@amd.com>
|
|
Date: Mon, 18 Apr 2022 10:59:26 +0530
|
|
Subject: [PATCH 13/15] common: Fix perf init for large systems
|
|
|
|
Large systems with hundreds of CPUs can run into issues
|
|
during perf event initialization because of the default
|
|
resource limits for file descriptors. Set RLIMIT_NOFILE
|
|
explicitly to a fairly large value to avoid them.
|
|
|
|
Signed-off-by: Sandipan Das <sandipan.das@amd.com>
|
|
---
|
|
common/os/os_perf.c | 16 ++++++++++++++++
|
|
1 file changed, 16 insertions(+)
|
|
|
|
diff --git a/common/os/os_perf.c b/common/os/os_perf.c
|
|
index 44ca43d..49fdaaa 100644
|
|
--- a/common/os/os_perf.c
|
|
+++ b/common/os/os_perf.c
|
|
@@ -28,6 +28,7 @@
|
|
|
|
#include <inttypes.h>
|
|
#include <stdlib.h>
|
|
+#include <sys/resource.h>
|
|
#include <sys/types.h>
|
|
#include <unistd.h>
|
|
#include <string.h>
|
|
@@ -850,12 +851,27 @@ ll_init(pf_conf_t *conf)
|
|
int
|
|
os_perf_init(void)
|
|
{
|
|
+ struct rlimit limit;
|
|
int ringsize, size;
|
|
|
|
s_profiling_recbuf = NULL;
|
|
s_ll_recbuf = NULL;
|
|
s_partpause_enabled = B_FALSE;
|
|
|
|
+ /*
|
|
+ * Depending on the number of available CPUs in the system, the
|
|
+ * default fd limit may be exceeded. Set it to a large value to
|
|
+ * avoid running into problems.
|
|
+ */
|
|
+ limit.rlim_cur = 32768;
|
|
+ limit.rlim_max = 32768;
|
|
+
|
|
+ if (setrlimit(RLIMIT_NOFILE, &limit) < 0) {
|
|
+ exit_msg_put("Failed to setup perf!\n");
|
|
+ debug_print(NULL, 2, "os_perf_init failed\n");
|
|
+ return (-1);
|
|
+ }
|
|
+
|
|
ringsize = pf_ringsize_init();
|
|
size = ((ringsize / sizeof (pf_profiling_rbrec_t)) + 1) *
|
|
sizeof (pf_profiling_rec_t);
|
|
--
|
|
2.31.1
|
|
|