* perfmon2 context: thread_struct vs. task_struct?
@ 2006-03-22 23:32 Stephane Eranian
2006-03-23 2:37 ` Andrew Morton
0 siblings, 1 reply; 3+ messages in thread
From: Stephane Eranian @ 2006-03-22 23:32 UTC (permalink / raw)
To: linux-kernel; +Cc: perfmon, linux-ia64
Hello,
The perfmon2 subsystem maintains a structure per-thread
that contains the save-area for the performance counters
and related software state. The save area is used on
context-switch. There can only be one context per thread.
The context is dynamically allocated as such it does not
consume memory in each thread. It is dyanmically attached
to the thread to monitor.
In the current implementation, the context (pfm_context)
pointer is implemented in the thread_struct on the basis
that this is somewhat related to machine state.
Historically, the perfmon subsystem only existed on IA-64
which made the thread_struct (an arch-specific structure)
the obvious place to put this.
Nowadays, perfmon2 supports most major architectures. It
may make sense to move the void *pfm_context pointer from
the thread_struct into the task_struct. This would save
some indirections, make it readily available to other
archiectures when it is ported.
I admit I am not quite clear as to what goes where between
thread_struct and task_struct.
Would it make sense to move the pointer to the perfmon2
context into the task_struct?
Thanks.
--
-Stephane
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: perfmon2 context: thread_struct vs. task_struct?
2006-03-22 23:32 perfmon2 context: thread_struct vs. task_struct? Stephane Eranian
@ 2006-03-23 2:37 ` Andrew Morton
2006-03-23 5:41 ` Stephane Eranian
0 siblings, 1 reply; 3+ messages in thread
From: Andrew Morton @ 2006-03-23 2:37 UTC (permalink / raw)
To: eranian; +Cc: linux-kernel, perfmon, linux-ia64
Stephane Eranian <eranian@hpl.hp.com> wrote:
>
> Hello,
>
> The perfmon2 subsystem maintains a structure per-thread
> that contains the save-area for the performance counters
> and related software state. The save area is used on
> context-switch. There can only be one context per thread.
> The context is dynamically allocated as such it does not
> consume memory in each thread. It is dyanmically attached
> to the thread to monitor.
>
> In the current implementation, the context (pfm_context)
> pointer is implemented in the thread_struct on the basis
> that this is somewhat related to machine state.
>
> Historically, the perfmon subsystem only existed on IA-64
> which made the thread_struct (an arch-specific structure)
> the obvious place to put this.
>
> Nowadays, perfmon2 supports most major architectures. It
> may make sense to move the void *pfm_context pointer from
> the thread_struct into the task_struct. This would save
> some indirections, make it readily available to other
> archiectures when it is ported.
>
> I admit I am not quite clear as to what goes where between
> thread_struct and task_struct.
>
> Would it make sense to move the pointer to the perfmon2
> context into the task_struct?
I'd say so, yes. Especialy if the struct is the same on all architectures,
is referred to from non-arch-specific code and is absent if
CONFIG_PERFMON=n.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: perfmon2 context: thread_struct vs. task_struct?
2006-03-23 2:37 ` Andrew Morton
@ 2006-03-23 5:41 ` Stephane Eranian
0 siblings, 0 replies; 3+ messages in thread
From: Stephane Eranian @ 2006-03-23 5:41 UTC (permalink / raw)
To: Andrew Morton; +Cc: linux-kernel, perfmon, linux-ia64
Andrew,
On Wed, Mar 22, 2006 at 06:37:36PM -0800, Andrew Morton wrote:
> > Would it make sense to move the pointer to the perfmon2
> > context into the task_struct?
>
> I'd say so, yes. Especialy if the struct is the same on all architectures,
> is referred to from non-arch-specific code and is absent if
> CONFIG_PERFMON=n.
>
Yes the structure is the same for all architectures. It looks like
task_struct already has #ifdefs in it. So I could do:
struct task_struct {
....
#ifdef CONFIG_PERFMON
struct pfm_context *pfm_context;
#endif
...
};
--
-Stephane
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2006-03-23 5:41 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-03-22 23:32 perfmon2 context: thread_struct vs. task_struct? Stephane Eranian
2006-03-23 2:37 ` Andrew Morton
2006-03-23 5:41 ` Stephane Eranian
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox