[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240807190921.GE31338@noisy.programming.kicks-ass.net>
Date: Wed, 7 Aug 2024 21:09:21 +0200
From: Peter Zijlstra <peterz@...radead.org>
To: "Liang, Kan" <kan.liang@...ux.intel.com>
Cc: mingo@...nel.org, acme@...nel.org, namhyung@...nel.org,
mark.rutland@....com, alexander.shishkin@...ux.intel.com,
jolsa@...nel.org, irogers@...gle.com, adrian.hunter@...el.com,
linux-perf-users@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 4/5] perf: Add context time freeze
On Wed, Aug 07, 2024 at 11:17:18AM -0400, Liang, Kan wrote:
> > +static inline void __perf_ctx_unlock(struct perf_event_context *ctx)
> > +{
> > + /*
> > + * If ctx_sched_in() didn't again set any ALL flags, clean up
> > + * after ctx_sched_out() by clearing is_active.
> > + */
> > + if (ctx->is_active & EVENT_FROZEN) {
> > + if (!(ctx->is_active & EVENT_ALL))
>
> Nit:
> It may be better to add a macro/inline function to replace all the
> (ctx->is_active & EVENT_ALL) check? For example,
>
> +static inline bool perf_ctx_has_active_events(struct perf_event_context
> *ctx)
> +{
> + return ctx->is_active & EVENT_ALL;
> +}
> ...
> + if (ctx->is_active & EVENT_FROZEN) {
> + if (!perf_ctx_has_active_events(ctx))
> + ctx->is_active = 0;
> + else
> + ctx->is_active &= ~EVENT_FROZEN;
>
> It can tell very straightforwardly that we want to clear all flags if
> there is no active event.
> The EVENT_ALL may bring confusion. It actually means all events, not all
> event types. The developer may have to go to the define and figure out
> what exactly the EVENT_ALL includes.
I'll push this on the todo list. I'm running short of time before I'm
taking a holiday and need to also spend time looking at the sched_ext
thing.
Powered by blists - more mailing lists