From: Peter Zijlstra <peterz@infradead.org>
To: Ian Rogers <irogers@google.com>
Cc: Ingo Molnar <mingo@redhat.com>,
Arnaldo Carvalho de Melo <acme@kernel.org>,
Alexander Shishkin <alexander.shishkin@linux.intel.com>,
Jiri Olsa <jolsa@redhat.com>, Namhyung Kim <namhyung@kernel.org>,
linux-kernel@vger.kernel.org,
Kan Liang <kan.liang@linux.intel.com>,
ak@linux.intel.com, eranian@google.com
Subject: Re: [PATCH] perf cgroups: Don't rotate events for cgroups unnecessarily
Date: Fri, 21 Jun 2019 10:24:22 +0200 [thread overview]
Message-ID: <20190621082422.GH3436@hirez.programming.kicks-ass.net> (raw)
In-Reply-To: <20190601082722.44543-1-irogers@google.com>
On Sat, Jun 01, 2019 at 01:27:22AM -0700, Ian Rogers wrote:
> @@ -3325,6 +3331,15 @@ static int flexible_sched_in(struct perf_event *event, void *data)
> sid->can_add_hw = 0;
> }
>
> + /*
> + * If the group wasn't scheduled then set that multiplexing is necessary
> + * for the context. Note, this won't be set if the event wasn't
> + * scheduled due to event_filter_match failing due to the earlier
> + * return.
> + */
> + if (event->state == PERF_EVENT_STATE_INACTIVE)
> + sid->ctx->rotate_necessary = 1;
> +
> return 0;
> }
That looked odd; which had me look harder at this function which
resulted in the below. Should we not terminate the context interation
the moment one flexible thingy fails to schedule?
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -2314,12 +2314,8 @@ group_sched_in(struct perf_event *group_
return 0;
pmu->start_txn(pmu, PERF_PMU_TXN_ADD);
-
- if (event_sched_in(group_event, cpuctx, ctx)) {
- pmu->cancel_txn(pmu);
- perf_mux_hrtimer_restart(cpuctx);
- return -EAGAIN;
- }
+ if (event_sched_in(group_event, cpuctx, ctx))
+ goto cancel;
/*
* Schedule in siblings as one group (if any):
@@ -2348,10 +2344,9 @@ group_sched_in(struct perf_event *group_
}
event_sched_out(group_event, cpuctx, ctx);
+cancel:
pmu->cancel_txn(pmu);
-
perf_mux_hrtimer_restart(cpuctx);
-
return -EAGAIN;
}
@@ -3317,6 +3312,7 @@ static int pinned_sched_in(struct perf_e
static int flexible_sched_in(struct perf_event *event, void *data)
{
struct sched_in_data *sid = data;
+ int ret;
if (event->state <= PERF_EVENT_STATE_OFF)
return 0;
@@ -3325,21 +3321,15 @@ static int flexible_sched_in(struct perf
return 0;
if (group_can_go_on(event, sid->cpuctx, sid->can_add_hw)) {
- if (!group_sched_in(event, sid->cpuctx, sid->ctx))
- list_add_tail(&event->active_list, &sid->ctx->flexible_active);
- else
+ ret = group_sched_in(event, sid->cpuctx, sid->ctx);
+ if (ret) {
sid->can_add_hw = 0;
+ sid->ctx->rotate_necessary = 1;
+ return ret;
+ }
+ list_add_tail(&event->active_list, &sid->ctx->flexible_active);
}
- /*
- * If the group wasn't scheduled then set that multiplexing is necessary
- * for the context. Note, this won't be set if the event wasn't
- * scheduled due to event_filter_match failing due to the earlier
- * return.
- */
- if (event->state == PERF_EVENT_STATE_INACTIVE)
- sid->ctx->rotate_necessary = 1;
-
return 0;
}
next prev parent reply other threads:[~2019-06-21 8:24 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-01 8:27 Ian Rogers
2019-06-13 16:12 ` Liang, Kan
2019-06-14 19:10 ` Stephane Eranian
2019-06-14 21:43 ` Liang, Kan
2019-06-20 23:08 ` Ian Rogers
2019-06-21 8:24 ` Peter Zijlstra [this message]
2019-06-21 18:01 ` Ian Rogers
2019-06-24 7:55 ` Peter Zijlstra
2019-06-27 21:47 ` Ian Rogers
2019-08-23 10:43 ` Ganapatrao Kulkarni
2019-08-23 11:59 ` Peter Zijlstra
2019-08-23 12:56 ` Ganapatrao Kulkarni
2019-08-23 13:03 ` Peter Zijlstra
2019-09-18 7:21 ` Ganapatrao Kulkarni
2019-10-15 4:43 ` Ganapatrao Kulkarni
2019-06-25 8:43 ` [tip:perf/core] perf/cgroups: " tip-bot for Ian Rogers
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=20190621082422.GH3436@hirez.programming.kicks-ass.net \
--to=peterz@infradead.org \
--cc=acme@kernel.org \
--cc=ak@linux.intel.com \
--cc=alexander.shishkin@linux.intel.com \
--cc=eranian@google.com \
--cc=irogers@google.com \
--cc=jolsa@redhat.com \
--cc=kan.liang@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=namhyung@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
Powered by JetHome