Re: [PATCH 4/5] perf tools: Add machine pointer into thread struct
On Mon, Mar 17, 2014 at 04:17:43PM +0900, Namhyung Kim wrote: > Hi Arnaldo, > > On Fri, 14 Mar 2014 11:16:12 -0300, Arnaldo Carvalho de Melo wrote: > > Em Fri, Mar 14, 2014 at 03:00:05PM +0100, Jiri Olsa escreveu: > >> Need machine pointer in thread object, so we could > >> lookup the process thread in following patch. > > > > Can't we use the already existing thread->mg.machine for that? > > It needs to know the machine when ->mg is not allocated yet. right > > That means we can now get rid of the mg->machine? not really, it's heavilly used in kernel symbol handling, to get machine details.. and there's no kernel thread specific info, which we could use to get machine pointer we would need to factor this part to be able to get rid of mg->machine jirka -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 4/5] perf tools: Add machine pointer into thread struct
Hi Arnaldo, On Fri, 14 Mar 2014 11:16:12 -0300, Arnaldo Carvalho de Melo wrote: > Em Fri, Mar 14, 2014 at 03:00:05PM +0100, Jiri Olsa escreveu: >> Need machine pointer in thread object, so we could >> lookup the process thread in following patch. > > Can't we use the already existing thread->mg.machine for that? It needs to know the machine when ->mg is not allocated yet. That means we can now get rid of the mg->machine? Thanks, Namhyung -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 4/5] perf tools: Add machine pointer into thread struct
Hi Arnaldo, On Fri, 14 Mar 2014 11:16:12 -0300, Arnaldo Carvalho de Melo wrote: Em Fri, Mar 14, 2014 at 03:00:05PM +0100, Jiri Olsa escreveu: Need machine pointer in thread object, so we could lookup the process thread in following patch. Can't we use the already existing thread-mg.machine for that? It needs to know the machine when -mg is not allocated yet. That means we can now get rid of the mg-machine? Thanks, Namhyung -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 4/5] perf tools: Add machine pointer into thread struct
On Mon, Mar 17, 2014 at 04:17:43PM +0900, Namhyung Kim wrote: Hi Arnaldo, On Fri, 14 Mar 2014 11:16:12 -0300, Arnaldo Carvalho de Melo wrote: Em Fri, Mar 14, 2014 at 03:00:05PM +0100, Jiri Olsa escreveu: Need machine pointer in thread object, so we could lookup the process thread in following patch. Can't we use the already existing thread-mg.machine for that? It needs to know the machine when -mg is not allocated yet. right That means we can now get rid of the mg-machine? not really, it's heavilly used in kernel symbol handling, to get machine details.. and there's no kernel thread specific info, which we could use to get machine pointer we would need to factor this part to be able to get rid of mg-machine jirka -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 4/5] perf tools: Add machine pointer into thread struct
Em Fri, Mar 14, 2014 at 03:00:05PM +0100, Jiri Olsa escreveu: > Need machine pointer in thread object, so we could > lookup the process thread in following patch. Can't we use the already existing thread->mg.machine for that? - Arnaldo > Signed-off-by: Jiri Olsa > Cc: Don Zickus > Cc: Corey Ashford > Cc: David Ahern > Cc: Frederic Weisbecker > Cc: Ingo Molnar > Cc: Namhyung Kim > Cc: Paul Mackerras > Cc: Peter Zijlstra > Cc: Arnaldo Carvalho de Melo > --- > tools/perf/util/machine.c | 2 +- > tools/perf/util/thread.c | 4 +++- > tools/perf/util/thread.h | 5 - > 3 files changed, 8 insertions(+), 3 deletions(-) > > diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c > index 009dfb4..6196bb9 100644 > --- a/tools/perf/util/machine.c > +++ b/tools/perf/util/machine.c > @@ -311,7 +311,7 @@ static struct thread *__machine__findnew_thread(struct > machine *machine, > if (!create) > return NULL; > > - th = thread__new(pid, tid); > + th = thread__new(pid, tid, machine); > if (th != NULL) { > rb_link_node(>rb_node, parent, p); > rb_insert_color(>rb_node, >threads); > diff --git a/tools/perf/util/thread.c b/tools/perf/util/thread.c > index ac77b6c..7c1aad0 100644 > --- a/tools/perf/util/thread.c > +++ b/tools/perf/util/thread.c > @@ -8,13 +8,15 @@ > #include "debug.h" > #include "comm.h" > > -struct thread *thread__new(pid_t pid, pid_t tid) > +struct thread *thread__new(pid_t pid, pid_t tid, > +struct machine *machine) > { > char *comm_str; > struct comm *comm; > struct thread *thread = zalloc(sizeof(*thread)); > > if (thread != NULL) { > + thread->machine = machine; > thread->pid_ = pid; > thread->tid = tid; > thread->ppid = -1; > diff --git a/tools/perf/util/thread.h b/tools/perf/util/thread.h > index 77d0be2..2200557 100644 > --- a/tools/perf/util/thread.h > +++ b/tools/perf/util/thread.h > @@ -7,12 +7,14 @@ > #include > #include "symbol.h" > #include > +#include "machine.h" > > struct thread { > union { > struct rb_node rb_node; > struct list_head node; > }; > + struct machine *machine; > struct map_groups *mg; > pid_t pid_; /* Not all tools update this */ > pid_t tid; > @@ -29,7 +31,8 @@ struct thread { > struct machine; > struct comm; > > -struct thread *thread__new(pid_t pid, pid_t tid); > +struct thread *thread__new(pid_t pid, pid_t tid, > +struct machine *machine); > void thread__delete(struct thread *thread); > static inline void thread__exited(struct thread *thread) > { > -- > 1.8.3.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 4/5] perf tools: Add machine pointer into thread struct
Em Fri, Mar 14, 2014 at 03:00:05PM +0100, Jiri Olsa escreveu: Need machine pointer in thread object, so we could lookup the process thread in following patch. Can't we use the already existing thread-mg.machine for that? - Arnaldo Signed-off-by: Jiri Olsa jo...@redhat.com Cc: Don Zickus dzic...@redhat.com Cc: Corey Ashford cjash...@linux.vnet.ibm.com Cc: David Ahern dsah...@gmail.com Cc: Frederic Weisbecker fweis...@gmail.com Cc: Ingo Molnar mi...@kernel.org Cc: Namhyung Kim namhy...@kernel.org Cc: Paul Mackerras pau...@samba.org Cc: Peter Zijlstra a.p.zijls...@chello.nl Cc: Arnaldo Carvalho de Melo a...@ghostprotocols.net --- tools/perf/util/machine.c | 2 +- tools/perf/util/thread.c | 4 +++- tools/perf/util/thread.h | 5 - 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c index 009dfb4..6196bb9 100644 --- a/tools/perf/util/machine.c +++ b/tools/perf/util/machine.c @@ -311,7 +311,7 @@ static struct thread *__machine__findnew_thread(struct machine *machine, if (!create) return NULL; - th = thread__new(pid, tid); + th = thread__new(pid, tid, machine); if (th != NULL) { rb_link_node(th-rb_node, parent, p); rb_insert_color(th-rb_node, machine-threads); diff --git a/tools/perf/util/thread.c b/tools/perf/util/thread.c index ac77b6c..7c1aad0 100644 --- a/tools/perf/util/thread.c +++ b/tools/perf/util/thread.c @@ -8,13 +8,15 @@ #include debug.h #include comm.h -struct thread *thread__new(pid_t pid, pid_t tid) +struct thread *thread__new(pid_t pid, pid_t tid, +struct machine *machine) { char *comm_str; struct comm *comm; struct thread *thread = zalloc(sizeof(*thread)); if (thread != NULL) { + thread-machine = machine; thread-pid_ = pid; thread-tid = tid; thread-ppid = -1; diff --git a/tools/perf/util/thread.h b/tools/perf/util/thread.h index 77d0be2..2200557 100644 --- a/tools/perf/util/thread.h +++ b/tools/perf/util/thread.h @@ -7,12 +7,14 @@ #include sys/types.h #include symbol.h #include strlist.h +#include machine.h struct thread { union { struct rb_node rb_node; struct list_head node; }; + struct machine *machine; struct map_groups *mg; pid_t pid_; /* Not all tools update this */ pid_t tid; @@ -29,7 +31,8 @@ struct thread { struct machine; struct comm; -struct thread *thread__new(pid_t pid, pid_t tid); +struct thread *thread__new(pid_t pid, pid_t tid, +struct machine *machine); void thread__delete(struct thread *thread); static inline void thread__exited(struct thread *thread) { -- 1.8.3.1 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/