[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <aAc2vdLzhR2BgL_q@gpd3>
Date: Tue, 22 Apr 2025 08:27:09 +0200
From: Andrea Righi <arighi@...dia.com>
To: Tejun Heo <tj@...nel.org>
Cc: David Vernet <void@...ifault.com>, Changwoo Min <changwoo@...lia.com>,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/2] sched_ext: Track currently locked rq
On Mon, Apr 21, 2025 at 09:03:08AM -1000, Tejun Heo wrote:
> Hello,
>
> On Sun, Apr 20, 2025 at 09:30:21PM +0200, Andrea Righi wrote:
> ...
> > +static inline struct rq *scx_locked_rq(void)
> > +{
> > + return __this_cpu_read(locked_rq);
> > +}
> > +
> > +#define SCX_CALL_OP(mask, rq, op, args...) \
> > do { \
> > + update_locked_rq(rq); \
>
> Minor but why not
>
> if (rq)
> update_locked_rq(rq);
>
> here too to be symmetric?
>
> > if (mask) { \
> > scx_kf_allow(mask); \
> > scx_ops.op(args); \
> > @@ -1125,11 +1155,15 @@ do { \
> > } else { \
> > scx_ops.op(args); \
> > } \
> > + if (rq) \
> > + update_locked_rq(NULL); \
>
> Or alternatively, drop `if (rq)` from both places. That's simpler and given
> that all the hot paths are called with rq locked, that may be *minutely*
> faster.
Ack, let's not complicate the code unnecessarily, that's a negligible
optimization (I tried to remove that `if (rq)` and I don't see any
measurable difference, as expected).
>
> > @@ -2174,7 +2210,7 @@ static void do_enqueue_task(struct rq *rq, struct task_struct *p, u64 enq_flags,
> > WARN_ON_ONCE(*ddsp_taskp);
> > *ddsp_taskp = p;
> >
> > - SCX_CALL_OP_TASK(SCX_KF_ENQUEUE, enqueue, p, enq_flags);
> > + SCX_CALL_OP_TASK(SCX_KF_ENQUEUE, rq, enqueue, p, enq_flags);
>
> Let's do SCX_CALL_OP_TASK(SCX_FK_ENQUEUE, enqueue, rq, p, enq_flags) so that
> the static parts of the invocation are grouped together and we usually have
> @rq and @p next to each other when they're used as parameters.
Ack. Will change this as well and send a v3.
Thanks,
-Andrea
Powered by blists - more mailing lists