From: "Henry Huang" <henry.hj@antgroup.com>
To: tj@kernel.org
Cc: "Henry Huang" <henry.hj@antgroup.com>,
谈鉴锋 <henry.tjf@antgroup.com>,
linux-kernel@vger.kernel.org, void@manifault.com,
"Yan Yan(cailing)" <yanyan.yan@antgroup.com>
Subject: Re: [PATCH v1] sched_ext: keep running prev when prev->scx.slice != 0
Date: Wed, 08 Jan 2025 12:09:04 +0800 [thread overview]
Message-ID: <20250108040904.22613-1-henry.hj@antgroup.com> (raw)
In-Reply-To: <Z32aulPE-e9hhjKr@slm.duckdns.org>
Tue, 7 Jan 2025 11:20:58 -1000, Tejun Heo wrote:
> Update current->scx.slice from ops.dispatch() is the recommended way of
> extending the current execution and the current behavior is just buggy
> especially when scx_ops_enq_last is set.
>
> While the above change fixes the case where ops.dispatch() updates
> current->scx.slice without dispatching any task, it's still theoretically
> wrong in that if ops.dispatch() updates current->scx.slice and dispatches
> tasks, we should keep running current before moving onto other tasks.
>
> To fix this properly, I think what should be done is adding something like
> the following. (untested and we probably should cache SCX_TASK_QUEUED
> testing result). Can you test whether the following fixes the issues you're
> seeing and if so update the patch accordingly?
>
> diff --git a/kernel/sched/ext.c b/kernel/sched/ext.c
> index 19d2699cf638..48deb5d5510e 100644
> --- a/kernel/sched/ext.c
> +++ b/kernel/sched/ext.c
> @@ -2813,6 +2813,10 @@ static int balance_one(struct rq *rq, struct task_struct *prev)
>
> flush_dispatch_buf(rq);
>
> + if ((prev->scx.flags & SCX_TASK_QUEUED) && prev->scx.slice) {
> + rq->scx.flags |= SCX_RQ_BAL_KEEP;
> + goto has_tasks;
> + }
> if (rq->scx.local_dsq.nr)
> goto has_tasks;
> if (consume_global_dsq(rq))
Thanks, I'll try this. If it works fine, I'll update this patch soon.
--
Henry
prev parent reply other threads:[~2025-01-08 4:14 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-07 4:25 Henry Huang
2025-01-07 4:25 ` Henry Huang
2025-01-07 21:20 ` Tejun Heo
2025-01-08 4:09 ` Henry Huang [this message]
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=20250108040904.22613-1-henry.hj@antgroup.com \
--to=henry.hj@antgroup.com \
--cc=henry.tjf@antgroup.com \
--cc=linux-kernel@vger.kernel.org \
--cc=tj@kernel.org \
--cc=void@manifault.com \
--cc=yanyan.yan@antgroup.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®