From: Abel Wu <wuyun.abel@bytedance.com>
To: Xuewen Yan <xuewen.yan@unisoc.com>,
mingo@redhat.com, peterz@infradead.org, juri.lelli@redhat.com,
vincent.guittot@linaro.org, dietmar.eggemann@arm.com,
rostedt@goodmis.org, bsegall@google.com, mgorman@suse.de,
bristot@redhat.com, vschneid@redhat.com
Cc: linux-kernel@vger.kernel.org, ke.wang@unisoc.com, xuewen.yan94@gmail.com
Subject: Re: [PATCH] sched/eevdf: Avoid NULL in pick_eevdf
Date: Mon, 20 Nov 2023 16:49:23 +0800 [thread overview]
Message-ID: <7c223b0c-d39a-4d53-8f00-7fbec6b49b6e@bytedance.com> (raw)
In-Reply-To: <20231120073821.1304-1-xuewen.yan@unisoc.com>
Hi Xuewen, the pick part has been re-worked, would you please re-test
with the newest branch?
Thanks,
Abel
https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git/?h=sched%2Fcore
On 11/20/23 3:38 PM, Xuewen Yan Wrote:
> Now in pick_eevdf function, add the pick_first_entity to prevent
> picking null when using eevdf, however, the leftmost may be null.
> As a result, it would cause oops because the se is NULL.
>
> Fix this by compare the curr and left, if the left is null, set
> the se be curr.
>
> Fixes: 147f3efaa241 ("sched/fair: Implement an EEVDF-like scheduling policy")
> Signed-off-by: Xuewen Yan <xuewen.yan@unisoc.com>
> ---
> kernel/sched/fair.c | 18 +++++++++++++++++-
> 1 file changed, 17 insertions(+), 1 deletion(-)
>
> diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
> index d7a3c63a2171..10916f6778ac 100644
> --- a/kernel/sched/fair.c
> +++ b/kernel/sched/fair.c
> @@ -951,12 +951,28 @@ static struct sched_entity *__pick_eevdf(struct cfs_rq *cfs_rq)
> return NULL;
> }
>
> +/* Just simply choose the se with the smallest vruntime */
> +static struct sched_entity *__pick_cfs(struct cfs_rq *cfs_rq)
> +{
> + struct sched_entity *curr = cfs_rq->curr;
> + struct sched_entity *left = __pick_first_entity(cfs_rq);
> +
> + /*
> + * If curr is set we have to see if its left of the leftmost entity
> + * still in the tree, provided there was anything in the tree at all.
> + */
> + if (!left || (curr && entity_before(curr, left)))
> + left = curr;
> +
> + return left;
> +}
> +
> static struct sched_entity *pick_eevdf(struct cfs_rq *cfs_rq)
> {
> struct sched_entity *se = __pick_eevdf(cfs_rq);
>
> if (!se) {
> - struct sched_entity *left = __pick_first_entity(cfs_rq);
> + struct sched_entity *left = __pick_cfs(cfs_rq);
> if (left) {
> pr_err("EEVDF scheduling fail, picking leftmost\n");
> return left;
next prev parent reply other threads:[~2023-11-20 8:49 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-20 7:38 Xuewen Yan
2023-11-20 8:49 ` Abel Wu [this message]
2023-11-21 5:08 ` Xuewen Yan
2023-12-12 2:51 ` Xuewen Yan
2023-12-12 3:17 ` Abel Wu
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=7c223b0c-d39a-4d53-8f00-7fbec6b49b6e@bytedance.com \
--to=wuyun.abel@bytedance.com \
--cc=bristot@redhat.com \
--cc=bsegall@google.com \
--cc=dietmar.eggemann@arm.com \
--cc=juri.lelli@redhat.com \
--cc=ke.wang@unisoc.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mgorman@suse.de \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
--cc=vincent.guittot@linaro.org \
--cc=vschneid@redhat.com \
--cc=xuewen.yan94@gmail.com \
--cc=xuewen.yan@unisoc.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®