From: Mark Rutland <mark.rutland@arm.com>
To: David Carrillo-Cisneros <davidcc@google.com>
Cc: Peter Zijlstra <peterz@infradead.org>,
Kan Liang <kan.liang@intel.com>,
linux-kernel <linux-kernel@vger.kernel.org>,
"x86@kernel.org" <x86@kernel.org>, Ingo Molnar <mingo@redhat.com>,
Thomas Gleixner <tglx@linutronix.de>,
Andi Kleen <ak@linux.intel.com>, Borislav Petkov <bp@suse.de>,
Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>,
Dave Hansen <dave.hansen@linux.intel.com>,
Vikas Shivappa <vikas.shivappa@linux.intel.com>,
Arnaldo Carvalho de Melo <acme@kernel.org>,
Vince Weaver <vince@deater.net>, Paul Turner <pjt@google.com>,
Stephane Eranian <eranian@google.com>
Subject: Re: [RFC 3/6] perf/core: use rb-tree to sched in event groups
Date: Fri, 13 Jan 2017 10:24:59 +0000 [thread overview]
Message-ID: <20170113102458.GA26120@leverpostej> (raw)
In-Reply-To: <CALcN6mhxer9SiaQvoLDtraW1Mb5kgRtxz3RTgGM2+BJS+o7=rA@mail.gmail.com>
On Fri, Jan 13, 2017 at 12:01:03AM -0800, David Carrillo-Cisneros wrote:
> On Thu, Jan 12, 2017 at 4:14 AM, Mark Rutland <mark.rutland@arm.com> wrote:
> > On Tue, Jan 10, 2017 at 12:51:58PM -0800, David Carrillo-Cisneros wrote:
> >> On Tue, Jan 10, 2017 at 8:38 AM, Mark Rutland <mark.rutland@arm.com> wrote:
> >> > That's a fair point. Sorting by CPU before runtime we'll get subtrees we
> >> > won't get fairness unless we sort the events solely by runtime at
> >> > sched_in time. If we sort by with runtime before CPU we'll have to skip
> >> > events not targeting the current CPU when scheduling task events in. I
> >> > note the latter is true today anyhow.
> >>
> >> That's were ctx->inactive_groups comes in. That list is sorted by runtime
> >> and the rb-tree is used to skip to the part of the list that has the events
> >> that matter.
> >
> > Is the list only sorted by runtime and not {cpu,runtime}? If it's the
> > latter, I'm not sure I follow. If it's the former, sorry for the noise!
>
> The former. List only sorted by runtime.
Ah, sorry. I had missed that.
> > The case I'm worried about is a set of task-bound events that have CPU
> > filters. For example, if the user opens a set of task-bound events for
> > any CPU:
> >
> > perf_event_open(attr1, pid, -1, -1, 0);
> > perf_event_open(attr2, pid, -1, -1, 0);
> >
> > ... and also some for the same task, but limited to a specific CPU:
> >
> > perf_event_open(attr3, pid, 1, -1, 0);
> > perf_event_open(attr4, pid, 1, -1, 0);
> >
> > ... if CPU is before runtime in the sort, one of these groups will
> > always be considered first when scheduling, and may starve the other
> > group.
>
> Yes, that case is the reason to have the sorted inactive_list and
> the tree. I tried to explain this in the change log of this patch. Please
> see new attempt below.
That's mostly a reading comprehension failure on my behalf, the commit
log does accurately describe this. It might be a little clearer if we
say the inactive list is sorted *solely* by timestamp, but nothing more
than that should be necessary.
> >> > In Peter's original suggestion we didn't sort by cgroup. IIRC there was
> >> > some email thread where the cgroup was considered for the sort (maybe
> >> > that was *only* for cpu contexts? I'm not too familiar with cgroups),
> >> > though I can't find the relevant mail, if it existed. :/
> >>
> >> FWIW, in this approach, we only sort by cgroup in CPU contexts, since cgroup
> >> events are only installed in CPU contexts.
> >
> > Sure. However, I think a similar issue to the above applies when
> > scheduling events where some are bound to a specific cgroup, and others
> > are not.
>
> Yes, it's addressed in the same way.
I see that now. Many thanks for the explanation, and apologies for the
noise.
Thanks,
Mark.
next prev parent reply other threads:[~2017-01-13 10:26 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-10 10:24 [RFC 0/6] optimize ctx switch with rb-tree David Carrillo-Cisneros
2017-01-10 10:24 ` [RFC 1/6] perf/core: create active and inactive event groups David Carrillo-Cisneros
2017-01-10 13:49 ` Mark Rutland
2017-01-10 20:45 ` David Carrillo-Cisneros
2017-01-12 11:05 ` Mark Rutland
[not found] ` <CALcN6mhPmpSqKhE3Ua+j-xROLzeAyrgdCk4AGGtfF9kExXRTJg@mail.gmail.com>
2017-01-13 11:01 ` Mark Rutland
2017-01-10 10:24 ` [RFC 2/6] perf/core: add a rb-tree index to inactive_groups David Carrillo-Cisneros
2017-01-10 14:14 ` Mark Rutland
2017-01-10 20:20 ` David Carrillo-Cisneros
2017-01-12 11:47 ` Mark Rutland
2017-01-13 7:34 ` David Carrillo-Cisneros
2017-01-16 2:03 ` [lkp-developer] [perf/core] 33da94bd89: BUG:unable_to_handle_kernel kernel test robot
2017-01-10 10:24 ` [RFC 3/6] perf/core: use rb-tree to sched in event groups David Carrillo-Cisneros
2017-01-10 16:38 ` Mark Rutland
2017-01-10 20:51 ` David Carrillo-Cisneros
2017-01-12 12:14 ` Mark Rutland
2017-01-13 8:01 ` David Carrillo-Cisneros
2017-01-13 10:24 ` Mark Rutland [this message]
2017-01-11 20:31 ` Liang, Kan
2017-01-12 10:11 ` Mark Rutland
2017-01-12 13:28 ` Liang, Kan
2017-01-13 8:05 ` David Carrillo-Cisneros
2017-01-10 10:25 ` [RFC 4/6] perf/core: avoid rb-tree traversal when no inactive events David Carrillo-Cisneros
2017-01-10 10:25 ` [RFC 5/6] perf/core: rotation no longer necessary. Behavior has changed. Beware David Carrillo-Cisneros
2017-01-10 10:25 ` [RFC 6/6] perf/core: use rb-tree index to optimize filtered perf_iterate_ctx David Carrillo-Cisneros
2017-01-16 2:05 ` [lkp-developer] [perf/core] 49c04ee1a7: WARNING:at_kernel/events/core.c:#perf_iterate_ctx_matching kernel test robot
2017-04-25 17:27 ` [RFC 0/6] optimize ctx switch with rb-tree Liang, Kan
2017-04-25 17:49 ` David Carrillo-Cisneros
2017-04-25 18:11 ` Budankov, Alexey
2017-04-25 18:54 ` David Carrillo-Cisneros
2017-04-26 10:34 ` Budankov, Alexey
2017-04-26 19:40 ` David Carrillo-Cisneros
2017-04-26 10:52 ` Mark Rutland
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=20170113102458.GA26120@leverpostej \
--to=mark.rutland@arm.com \
--cc=acme@kernel.org \
--cc=ak@linux.intel.com \
--cc=bp@suse.de \
--cc=dave.hansen@linux.intel.com \
--cc=davidcc@google.com \
--cc=eranian@google.com \
--cc=kan.liang@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=pjt@google.com \
--cc=srinivas.pandruvada@linux.intel.com \
--cc=tglx@linutronix.de \
--cc=vikas.shivappa@linux.intel.com \
--cc=vince@deater.net \
--cc=x86@kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).