lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Wed, 7 Dec 2016 11:12:32 +0900
From:   Namhyung Kim <namhyung@...nel.org>
To:     David Ahern <dsahern@...il.com>
CC:     Arnaldo Carvalho de Melo <acme@...nel.org>,
        Ingo Molnar <mingo@...nel.org>,
        Peter Zijlstra <peterz@...radead.org>,
        Jiri Olsa <jolsa@...nel.org>,
        LKML <linux-kernel@...r.kernel.org>,
        Andi Kleen <andi@...stfloor.org>,
        Minchan Kim <minchan@...nel.org>
Subject: Re: [PATCH 06/10] perf sched timehist: Introduce struct
 idle_time_data

On Mon, Dec 05, 2016 at 08:07:09PM -0800, David Ahern wrote:
> On 12/5/16 7:40 PM, Namhyung Kim wrote:
> > The struct idle_time_data is to keep idle stats with callchains entering
> > to the idle task.  The normal thread_runtime calculation is done
> > transparently since it extends the struct thread_runtime.
> > 
> > Signed-off-by: Namhyung Kim <namhyung@...nel.org>
> > ---
> >  tools/perf/builtin-sched.c | 31 +++++++++++++++++++++++++++++++
> >  1 file changed, 31 insertions(+)
> > 
> > diff --git a/tools/perf/builtin-sched.c b/tools/perf/builtin-sched.c
> > index 26efa99567b8..d3ee814ce77f 100644
> > --- a/tools/perf/builtin-sched.c
> > +++ b/tools/perf/builtin-sched.c
> > @@ -230,6 +230,15 @@ struct evsel_runtime {
> >  	u32 ncpu;       /* highest cpu slot allocated */
> >  };
> >  
> > +/* per cpu idle time data */
> > +struct idle_thread_runtime {
> > +	struct thread_runtime tr;
> > +	struct thread *last_thread;
> > +	struct rb_root sorted_root;
> > +	struct callchain_root callchain;
> > +	struct callchain_cursor cursor;
> > +};
> > +
> >  /* track idle times per cpu */
> >  static struct thread **idle_threads;
> >  static int idle_max_cpu;
> > @@ -2009,11 +2018,22 @@ static int init_idle_threads(int ncpu)
> >  
> >  	/* allocate the actual thread struct if needed */
> >  	for (i = 0; i < ncpu; ++i) {
> > +		struct idle_thread_runtime *itr;
> > +
> >  		idle_threads[i] = thread__new(0, 0);
> >  		if (idle_threads[i] == NULL)
> >  			return -ENOMEM;
> >  
> >  		thread__set_comm(idle_threads[i], idle_comm, 0);
> > +
> > +		itr = zalloc(sizeof(*itr));
> > +		if (itr == NULL)
> > +			return -ENOMEM;
> > +
> > +		init_stats(&itr->tr.run_stats);
> > +		callchain_init(&itr->callchain);
> > +		callchain_cursor_reset(&itr->cursor);
> > +		thread__set_priv(idle_threads[i], itr);
> 
> perhaps the common lines above should be put into init_idle_thread()
> and called in both places to init a single idle thread instance.

Will change.

Thanks,
Namhyung

> 
> 
> >  	}
> >  
> >  	return 0;
> > @@ -2060,8 +2080,19 @@ static struct thread *get_idle_thread(int cpu)
> >  		idle_threads[cpu] = thread__new(0, 0);
> >  
> >  		if (idle_threads[cpu]) {
> > +			struct idle_thread_runtime *itr;
> > +
> >  			idle_threads[cpu]->tid = 0;
> >  			thread__set_comm(idle_threads[cpu], idle_comm, 0);
> > +
> > +			itr = zalloc(sizeof(*itr));
> > +			if (itr == NULL)
> > +				return NULL;
> > +
> > +			init_stats(&itr->tr.run_stats);
> > +			callchain_init(&itr->callchain);
> > +			callchain_cursor_reset(&itr->cursor);
> > +			thread__set_priv(idle_threads[cpu], itr);
> >  		}
> >  	}
> >  
> > 
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ