lkml.org 
[lkml]   [2014]   [Mar]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 3/5] perf tools: Allocate thread map_groups dynamicaly
On Mon, Mar 17, 2014 at 04:13:53PM +0900, Namhyung Kim wrote:
> On Fri, 14 Mar 2014 15:00:04 +0100, Jiri Olsa wrote:
> > Moving towards sharing map groups within a process threads.
> >
> > Because of this we need the map groups to be dynamically
> > allocated. No other functional change is intended in here.
> > @@ -664,7 +664,7 @@ void thread__find_addr_map(struct thread *thread,
> > al->cpumode = cpumode;
> > al->filtered = false;
> >
> > - if (machine == NULL) {
> > + if ((machine == NULL) || (mg == NULL)) {
> > al->map = NULL;
> > return;
> > }
>
> What about the kernel threads? I guess they're not using thread->mg but
> machine->kmaps instead?

The machine->kmaps is used to store kernel maps - core + modules.

All threads (including kernel ones) are using thread->mg,
kernel threads have empty /proc/x/maps file.

In case the sample address is detected within kernel space,
the machine->kmaps is used instead of thread->mg:

---
void thread__find_addr_map(struct thread *thread, ...
{
struct map_groups *mg = thread__map_groups_get(thread);

...

if (cpumode == PERF_RECORD_MISC_KERNEL && perf_host) {
al->level = 'k';
mg = &machine->kmaps;

...
al->map = map_groups__find(mg, type, al->addr);
---

jirka


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