[powertop] Added unlimit-fds patch

Jaroslav Škarvada jskarvad at fedoraproject.org
Fri Sep 20 09:06:42 UTC 2013


commit 895093e85e5b88aae428315a5633c89ee8e4474a
Author: Jaroslav Škarvada <jskarvad at redhat.com>
Date:   Fri Sep 20 11:06:17 2013 +0200

    Added unlimit-fds patch

 powertop-2.4-unlimit-fds.patch |   58 ++++++++++++++++++++++++++++++++++++++++
 1 files changed, 58 insertions(+), 0 deletions(-)
---
diff --git a/powertop-2.4-unlimit-fds.patch b/powertop-2.4-unlimit-fds.patch
new file mode 100644
index 0000000..9cb7ab9
--- /dev/null
+++ b/powertop-2.4-unlimit-fds.patch
@@ -0,0 +1,58 @@
+From 4cbb957605818dc7e4b7932dafac0aad5ed0b87a Mon Sep 17 00:00:00 2001
+From: Youquan Song <youquan.song at linux.intel.com>
+Date: Tue, 4 Jun 2013 17:31:23 -0400
+Subject: [PATCH] Fix running failure when > 69 CPUs for open file limitation
+
+Powertop 2.3 fails to run on machine with > 69 CPUs because system open files
+limitation of one process is 1024 default,  While powertop will open one file
+for every monitored perf_event (at least 15) each CPU.
+
+Like on 80 CPUs Westmere-EX machine, powertop will fail to run with below:
+
+PowerTOP v2.3 needs the kernel to support the 'perf' subsystem
+as well as support for trace points in the kernel:
+CONFIG_PERF_EVENTS=y
+CONFIG_PERF_COUNTERS=y
+CONFIG_TRACEPOINTS=y
+CONFIG_TRACING=y
+
+This patch is to change RLIMIT_NOFILE from default (1024) to max limition.
+
+Signed-off-by: Youquan Song <youquan.song at intel.com>
+---
+ src/main.cpp | 7 +++++++
+ 1 file changed, 7 insertions(+)
+
+diff --git a/src/main.cpp b/src/main.cpp
+index 46466b0..e74890f 100644
+--- a/src/main.cpp
++++ b/src/main.cpp
+@@ -36,6 +36,7 @@
+ #include <getopt.h>
+ #include <unistd.h>
+ #include <locale.h>
++#include <sys/resource.h>
+ 
+ #include "cpu/cpu.h"
+ #include "process/process.h"
+@@ -283,11 +284,17 @@ static void powertop_init(void)
+ 	static char initialized = 0;
+ 	int ret;
+ 	struct statfs st_fs;
++	struct rlimit rlmt;
+ 
+ 	if (initialized)
+ 		return;
+ 
+ 	checkroot();
++
++	getrlimit (RLIMIT_NOFILE, &rlmt);
++	rlmt.rlim_cur = rlmt.rlim_max;
++	setrlimit (RLIMIT_NOFILE, &rlmt);
++
+ 	ret = system("/sbin/modprobe cpufreq_stats > /dev/null 2>&1");
+ 	ret = system("/sbin/modprobe msr > /dev/null 2>&1");
+ 	statfs("/sys/kernel/debug", &st_fs);
+-- 
+1.8.4
+


More information about the scm-commits mailing list