lkml.org 
[lkml]   [2014]   [Dec]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 05/18] perf evlist: Do not use hard coded value for a mmap_pages default
Em Wed, Dec 17, 2014 at 02:23:30PM +0100, Jiri Olsa escreveu:
> On Tue, Dec 16, 2014 at 01:57:07PM -0300, Arnaldo Carvalho de Melo wrote:
> > + if (pages == UINT_MAX) {
> > + int max;
> > +
> > + if (sysctl__read_int("kernel/perf_event_mlock_kb", &max) < 0) {
> > + /*
> > + * Pick a once upon a time good value, i.e. things look
> > + * strange since we can't read a sysctl value, but lets not
> > + * die yet...
> > + */
> > + max = 512;
> > + } else {
> > + max -= (page_size / 1024);
> > + }

> so this way you depend on value in perf_event_mlock_kb being power 2,
> otherwise:

> # echo 1000 > /proc/sys/kernel/perf_event_mlock_kb
> $ perf record ls
> failed to mmap with 22 (Invalid argument)

Right, I thought that perf_event_mlock_kb input was validated, realized
that it is not, see the following patchkit that makes it validate that
after reading, using rounddown_pow_of_two if not.

- Arnaldo

> maybe you could use the logic/code from parse_pages_arg function
>
> jirka


\
 
 \ /
  Last update: 2014-12-17 15:41    [W:0.045 / U:0.088 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site