All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sergey Senozhatsky <sergey.senozhatsky at gmail.com>
To: powertop@lists.01.org
Subject: Re: [Powertop] [PATCH] Fix running failure when > 69 CPUs for open file limitation
Date: Tue, 04 Jun 2013 13:26:33 +0300	[thread overview]
Message-ID: <20130604102633.GB2323@swordfish> (raw)
In-Reply-To: 20130604213123.GB14821@linux-youquan.bj.intel.com

[-- Attachment #1: Type: text/plain, Size: 1766 bytes --]

On (06/04/13 17:31), Youquan Song wrote:
> > 
> > how about, say, 2048? unlimited resource steals possibility to detect 
> > error/bug/leak/etc.
> 
> I do not like it. If there are more CPUs on larger machine and if we
> want to monitor more performance event for each CPU, the 2048 settting will
>  be another issue.
> 

we may get the number of CPUs, multiply it by events number + probably add some 
extra fds, and set it as a limit. this is not a really big issue, though. my point 
is that limited resource gives us better chances to detect resource leak in 
powertop, however I agree that we just may fireup valgrind for that purpose.


	-ss

> We just set it to the rlim_cur to rlim_max for the powertop application
> and to cater to powertop requirement as large as possible.
> 
> > and let's make rlimit change after checkroot() call.
> > 
> 
> Good point. Agree. Here is the modified patch.
> 
> 
> diff --git a/src/main.cpp b/src/main.cpp
> index 0883424..d24a3db 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);
> 
>  
> 

             reply	other threads:[~2013-06-04 10:26 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-04 10:26 Sergey Senozhatsky [this message]
  -- strict thread matches above, loose matches on Subject: below --
2013-06-04 10:19 [Powertop] [PATCH] Fix running failure when > 69 CPUs for open file limitation Sergey Senozhatsky
2013-05-29 21:20 Sergey Senozhatsky
2013-05-29 21:00 Sergey Senozhatsky
2013-05-29 15:44 Youquan Song

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130604102633.GB2323@swordfish \
    --to=powertop@lists.01.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.