From: Ingo Molnar <mingo@elte.hu>
To: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>,
linux-kernel@vger.kernel.org,
Corey Ashford <cjashfor@linux.vnet.ibm.com>,
Thomas Gleixner <tglx@linutronix.de>
Subject: Re: [RFC PATCH] perf_counter: dynamically allocate tasks' perf_counter_context struct
Date: Fri, 22 May 2009 21:18:13 +0200 [thread overview]
Message-ID: <20090522191813.GA18651@elte.hu> (raw)
In-Reply-To: <18964.36622.94267.309523@cargo.ozlabs.ibm.com>
* Paul Mackerras <paulus@samba.org> wrote:
> Ingo Molnar writes:
>
> > * Paul Mackerras <paulus@samba.org> wrote:
> >
> > > This replaces the struct perf_counter_context in the task_struct
> > > with a pointer to a dynamically allocated perf_counter_context
> > > struct. The main reason for doing is this is to allow us to
> > > transfer a perf_counter_context from one task to another when we
> > > do lazy PMU switching in a later patch.
> >
> > Hm, i'm not sure how far this gets us towards lazy PMU switching.
> >
> > In fact i'd say that the term "lazy PMU switching" is probably
> > misleading, we should use: "equivalent PMU context switching" or
> > instead.
>
> Yes, that's what I mean.
>
> As you say, we need to be able to detect when two tasks have
> equivalent contexts - that is, when their counters are all
> inherited from a common ancestor. My idea is that in that
> situation we simply swap the contexts: move the context of the
> outgoing task onto the incoming task, and give the incoming task's
> context to the outgoing task. With my patch, that involves simply
> swapping the pointers over and adjusting the task pointers in the
> two contexts.
>
> That means that all the counters get transferred over to the
> incoming task, so there is nothing in the PMU or the arch code
> that needs to changed or adjusted. The outgoing task still has a
> perfectly valid context, so it doesn't matter if it migrates to
> another CPU. The nice thing is that there is nothing special or
> unusual about the state after we have swapped the contexts -
> nothing that needs to be remembered or undone later.
Yeah, agreed - your scheme is simpler than the scheme i thought of!
Ingo
prev parent reply other threads:[~2009-05-22 19:18 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-05-20 12:28 [RFC PATCH] perf_counter: dynamically allocate tasks' perf_counter_context struct Paul Mackerras
2009-05-20 15:03 ` Peter Zijlstra
2009-05-20 23:50 ` Paul Mackerras
2009-05-20 17:12 ` Ingo Molnar
2009-05-20 23:15 ` Paul Mackerras
2009-05-22 19:18 ` Ingo Molnar [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20090522191813.GA18651@elte.hu \
--to=mingo@elte.hu \
--cc=a.p.zijlstra@chello.nl \
--cc=cjashfor@linux.vnet.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=paulus@samba.org \
--cc=tglx@linutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox