From: "Liang, Kan" <kan.liang@intel.com>
To: Mark Rutland <mark.rutland@arm.com>,
David Carrillo-Cisneros <davidcc@google.com>,
Peter Zijlstra <peterz@infradead.org>
Cc: "linux-kernel@vger.kernel.org" <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: Wed, 11 Jan 2017 20:31:11 +0000 [thread overview]
Message-ID: <37D7C6CF3E00A74B8858931C1DB2F07753698272@SHSMSX103.ccr.corp.intel.com> (raw)
In-Reply-To: <20170110163850.GA24036@leverpostej>
.
>
> Kan, in your per-cpu event list patch you mentioned that you saw a large
> overhead in perf_iterate_ctx() when skipping events for other CPUs.
> Which callers of perf_iterate_ctx() specifically was that problematic for? Do
> those callers only care about the *active* events, for example?
>
Based on my test, the large overhead was observed in perf_iterate_sb.
Yes, it only cares about the *active* events.
> Maybe the overhead of skipping !current_cpu events is ok at sched_in time
> in most cases. If the overhead of skipping those only matters for a subset of
> perf_iterate_ctx() callers, then maybe we can optimise them in another
> fashion (e.g. use the active events lists, or a new list specific to that iterate
> user, depending on what they actually need).
> That way we can drop cpu from the sort.
>
> > The rb-tree allows us to find events with minimum and maximum
> > timestamp for a given CPU/cgroup + flexible type. The list
> > ctx->inactive_groups is sorted by timestamp.
> >
> > We could find a list position for the first event of each CPU/cgroup
> > that is to be scheduled and iterate over all of them, selecting events
> > from the list's head with the smallest timestampt, but it's too complicated.
> >
> > A simpler alternative is to find the smallest subinterval of
> > ctx->inactive_groups that contains all eligible events. Let's call
> > ctx->this
> > minimum subinterval S.
> >
> > S is formed of smaller subintervals, no necessarily exclusive, intervals.
> > Each one has all the events that are eligible for a given CPU or cgroup.
> > We find S by searching for the start/end of each one of these
> > CPU/cgroup subintervals and combining them. The drawback is that there
> > may be events in S that are not eligible (since ctx->inactive_group is
> > in stamp order).
>
> The other drawback is that this is not fair, since CPU comes before runtime
> in the sort order. You'll always try some events before others (e.g. cpu == -1
> before cpu == current), before considering runtime. I believe this means
> that events can be permanently starved.
>
> So either we need to fold those together somehow, or drop CPU from the
> sort order (assuming that we can, as above).
>
> Thanks,
> Mark.
next prev parent reply other threads:[~2017-01-11 20:32 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
2017-01-11 20:31 ` Liang, Kan [this message]
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=37D7C6CF3E00A74B8858931C1DB2F07753698272@SHSMSX103.ccr.corp.intel.com \
--to=kan.liang@intel.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=linux-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--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).