From: Tejun Heo <tj@kernel.org>
To: David Vernet <void@manifault.com>
Cc: linux-kernel@vger.kernel.org, kernel-team@meta.com,
schatzberg.dan@gmail.com, mingo@redhat.com, peterz@infradead.org,
changwoo@igalia.com, righi.andrea@gmail.com
Subject: Re: [PATCH 5/6] sched_ext: Allow SCX_DSQ_LOCAL_ON for direct dispatches
Date: Wed, 10 Jul 2024 13:43:14 -1000 [thread overview]
Message-ID: <Zo8ckk3MFygpEZbL@slm.duckdns.org> (raw)
In-Reply-To: <20240710185135.GB317151@maniforge>
Hello,
On Wed, Jul 10, 2024 at 01:51:35PM -0500, David Vernet wrote:
...
> > + /*
> > + * If in balance, the balance callbacks will be called before rq lock is
> > + * released. Schedule one.
> > + */
> > + if (rq->scx.flags & SCX_RQ_IN_BALANCE)
> > + queue_balance_callback(rq, &rq->scx.deferred_bal_cb,
> > + deferred_bal_cb_workfn);
>
> Should we be returning above if we're able to use a balance cb?
Oh yeah, it definitely should.
> Also, should we maybe add a WARN_ON_ONCE(rq->balance_callback ==
> &balance_push_callback)? I could see that being unnecessary given that we
> should never be hitting this path when the CPU is deactivated anyways, but the
> push callback thing is a kindn extraneous implementation detail so might be
> worth guarding against it just in case.
I'm not sure about that. It feels like a sched core detail which is better
left within sched core code rather than pushing to queue_balance_callback()
users. The deferred execution mechanism itself doesn't really care about how
the callback is run or the state of the CPU.
...
> > +static void process_ddsp_deferred_locals(struct rq *rq)
> > +{
> > + struct task_struct *p, *tmp;
> > +
> > + lockdep_assert_rq_held(rq);
> > +
> > + /*
> > + * Now that @rq can be unlocked, execute the deferred enqueueing of
> > + * tasks directly dispatched to the local DSQs of other CPUs. See
> > + * direct_dispatch().
> > + */
> > + list_for_each_entry_safe(p, tmp, &rq->scx.ddsp_deferred_locals,
> > + scx.dsq_list.node) {
> > + s32 ret;
> > +
> > + list_del_init(&p->scx.dsq_list.node);
> > +
> > + ret = dispatch_to_local_dsq(rq, NULL, p->scx.ddsp_dsq_id, p,
> > + p->scx.ddsp_enq_flags);
> > + WARN_ON_ONCE(ret == DTL_NOT_LOCAL);
> > + }
>
> As mentioned in the other thread, it might be simplest to just pin and unpin
> around this loop here to keep the logic simpler in the callee.
Yeah, I'm moving unpinning/repinning to outer balance function.
> > @@ -3589,6 +3714,7 @@ DEFINE_SCHED_CLASS(ext) = {
> > #ifdef CONFIG_SMP
> > .balance = balance_scx,
> > .select_task_rq = select_task_rq_scx,
> > + .task_woken = task_woken_scx,
>
> Should we update the comment in the caller in core.c given that rq is no longer
> only used for statistics tracking?
task_woken_rt() is already doing push_rt_task() which is kinda similar to
what scx is doing, so the comment was already stale. Yeah, please go ahead
and send a patch.
Thanks.
--
tejun
next prev parent reply other threads:[~2024-07-10 23:43 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-09 21:21 [PATCHSET sched_ext/for-6.11] " Tejun Heo
2024-07-09 21:21 ` [PATCH 1/6] sched: Move struct balance_callback definition upward Tejun Heo
2024-07-10 18:53 ` David Vernet
2024-07-09 21:21 ` [PATCH 2/6] sched_ext: Open-code task_linked_on_dsq() Tejun Heo
2024-07-10 8:56 ` Andrea Righi
2024-07-10 18:53 ` David Vernet
2024-07-09 21:21 ` [PATCH 3/6] sched_ext: Make @rf optional for dispatch_to_local_dsq() Tejun Heo
2024-07-10 8:59 ` Andrea Righi
2024-07-10 11:41 ` Peter Zijlstra
2024-07-10 16:39 ` Tejun Heo
2024-07-10 16:10 ` David Vernet
2024-07-10 16:46 ` Tejun Heo
2024-07-09 21:21 ` [PATCH 4/6] sched_ext: s/SCX_RQ_BALANCING/SCX_RQ_IN_BALANCE/ and add SCX_RQ_IN_WAKEUP Tejun Heo
2024-07-10 18:54 ` David Vernet
2024-07-09 21:21 ` [PATCH 5/6] sched_ext: Allow SCX_DSQ_LOCAL_ON for direct dispatches Tejun Heo
2024-07-10 18:51 ` David Vernet
2024-07-10 23:43 ` Tejun Heo [this message]
2024-07-09 21:21 ` [PATCH 6/6] sched_ext/scx_qmap: Pick idle CPU for direct dispatch on !wakeup enqueues Tejun Heo
2024-07-10 19:25 ` David Vernet
2024-07-11 0:05 ` Tejun Heo
2024-07-10 9:01 ` [PATCHSET sched_ext/for-6.11] sched_ext: Allow SCX_DSQ_LOCAL_ON for direct dispatches Andrea Righi
2024-07-11 1:13 [PATCHSET v2 " Tejun Heo
2024-07-11 1:14 ` [PATCH 5/6] " Tejun Heo
2024-07-11 2:05 ` David Vernet
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Zo8ckk3MFygpEZbL@slm.duckdns.org \
--to=tj@kernel.org \
--cc=changwoo@igalia.com \
--cc=kernel-team@meta.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=righi.andrea@gmail.com \
--cc=schatzberg.dan@gmail.com \
--cc=void@manifault.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®