History

perf/core: Fix endless multiplex timer

Kan and Andi reported that we fail to kill rotation when the flexible events go empty, but the context does not. XXX moar

Peter Zijlstra committed 6 years ago

Commit 90c91df1 parent d8a73861 file · +14 −6Browse files

Unified · Split

kernel/events/core.c+14−6
@@ -2291,6 +2291,7 @@ __perf_remove_from_context(struct perf_event *event, · 2290 unmodified lines
22912291
22922292 if (!ctx->nr_events && ctx->is_active) {
22932293 ctx->is_active = 0;
2294+ ctx->rotate_necessary = 0;
22942295 if (ctx->task) {
22952296 WARN_ON_ONCE(cpuctx->task_ctx != ctx);
22962297 cpuctx->task_ctx = NULL;
@@ -3188,12 +3189,6 @@ static void ctx_sched_out(struct perf_event_context *ctx, · 891 unmodified lines
31883189 if (!ctx->nr_active || !(is_active & EVENT_ALL))
31893190 return;
31903191
3191− /*
3192− * If we had been multiplexing, no rotations are necessary, now no events
3193− * are active.
3194− */
3195− ctx->rotate_necessary = 0;
3196−
31973192 perf_pmu_disable(ctx->pmu);
31983193 if (is_active & EVENT_PINNED) {
31993194 list_for_each_entry_safe(event, tmp, &ctx->pinned_active, active_list)
@@ -3203,6 +3198,13 @@ static void ctx_sched_out(struct perf_event_context *ctx, · 3 unmodified lines
32033198 if (is_active & EVENT_FLEXIBLE) {
32043199 list_for_each_entry_safe(event, tmp, &ctx->flexible_active, active_list)
32053200 group_sched_out(event, cpuctx, ctx);
3201+
3202+ /*
3203+ * Since we cleared EVENT_FLEXIBLE, also clear
3204+ * rotate_necessary, is will be reset by
3205+ * ctx_flexible_sched_in() when needed.
3206+ */
3207+ ctx->rotate_necessary = 0;
32063208 }
32073209 perf_pmu_enable(ctx->pmu);
32083210 }
@@ -3985,6 +3987,12 @@ ctx_event_to_rotate(struct perf_event_context *ctx) · 776 unmodified lines
39853987 typeof(*event), group_node);
39863988 }
39873989
3990+ /*
3991+ * Unconditionally clear rotate_necessary; if ctx_flexible_sched_in()
3992+ * finds there are unschedulable events, it will set it again.
3993+ */
3994+ ctx->rotate_necessary = 0;
3995+
39883996 return event;
39893997 }
39903998

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t