On 10-Oct-22 3:44 PM, Peter Zijlstra wrote: > On Wed, Sep 07, 2022 at 04:58:49PM +0530, Ravi Bangoria wrote: >>> -static void >>> -ctx_flexible_sched_in(struct perf_event_context *ctx, >>> - struct perf_cpu_context *cpuctx) >>> +/* XXX .busy thingy from Peter's patch */ >>> +static void ctx_flexible_sched_in(struct perf_event_context *ctx, struct pmu *pmu) >> >> This one turned out to be very easy. Given that, we iterate over each >> pmu, we can just return error if we fail to schedule any flexible event. >> (It wouldn't be straight forward like this if we needed to implement >> pmu=NULL optimization.) >> >> --- >> diff --git a/kernel/events/core.c b/kernel/events/core.c >> index e0232e0bb74e..923656af73fe 100644 >> --- a/kernel/events/core.c >> +++ b/kernel/events/core.c >> @@ -3751,6 +3751,7 @@ static int merge_sched_in(struct perf_event *event, void *data) >> cpc = this_cpu_ptr(event->pmu_ctx->pmu->cpu_pmu_context); >> perf_mux_hrtimer_restart(cpc); >> group_update_userpage(event); >> + return -EBUSY; >> } >> } >> > > I'm afraid this breaks things; consider: > > f79256532682 ("perf/core: fix userpage->time_enabled of inactive events") > > I totally hate this -- because it means we *HAVE* to iterate the > inactive events, but alas. Sure. Will drop this. Thanks, Ravi