Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1562917

[PATCH 1/2] perf: Don't re-schedule cpu flexible events needlessly

From Alexander Shishkin <alexander.shishkin@linux.intel.com>
Newsgroups linux.kernel
Subject [PATCH 1/2] perf: Don't re-schedule cpu flexible events needlessly
Date 2017-01-19 18:00 +0100
Message-ID <t1oe5-40V-5@gated-at.bofh.it> (permalink)
References <t1o4r-3Xc-57@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


In the sched-in path, we first remove cpu's flexible events in order to
give priority to task's pinned events. However, this step can be safely
skipped if the task doesn't have its own pinned events.

This patch implements this skipping.

Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Reported-by: Adrian Hunter <adrian.hunter@intel.com>
---
 kernel/events/core.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/kernel/events/core.c b/kernel/events/core.c
index dedfd3078c..c196b9537f 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -3137,8 +3137,12 @@ static void perf_event_context_sched_in(struct perf_event_context *ctx,
 	 * We want to keep the following priority order:
 	 * cpu pinned (that don't need to move), task pinned,
 	 * cpu flexible, task flexible.
+	 *
+	 * However, if task's ctx is not carrying any pinned
+	 * events, no need to flip the cpuctx's events around.
 	 */
-	cpu_ctx_sched_out(cpuctx, EVENT_FLEXIBLE);
+	if (!list_empty(&ctx->pinned_groups))
+		cpu_ctx_sched_out(cpuctx, EVENT_FLEXIBLE);
 	perf_event_sched_in(cpuctx, ctx, task);
 	perf_pmu_enable(ctx->pmu);
 	perf_ctx_unlock(cpuctx, ctx);
-- 
2.11.0

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 0/2] perf: Scheduling optimizations Alexander Shishkin <alexander.shishkin@linux.intel.com> - 2017-01-19 17:50 +0100
  [PATCH 1/2] perf: Don't re-schedule cpu flexible events needlessly Alexander Shishkin <alexander.shishkin@linux.intel.com> - 2017-01-19 18:00 +0100
    [tip:perf/core] perf/core: Don't re-schedule CPU flexible events  needlessly tip-bot for Alexander Shishkin <tipbot@zytor.com> - 2017-01-30 13:00 +0100
  [PATCH 2/2] perf: Optimize event rescheduling on active contexts Alexander Shishkin <alexander.shishkin@linux.intel.com> - 2017-01-19 18:00 +0100
    [tip:perf/core] perf/core: Optimize event rescheduling on active  contexts tip-bot for Alexander Shishkin <tipbot@zytor.com> - 2017-01-30 13:10 +0100

csiph-web