From: Chen Yu <yu.c.chen@intel.com>
To: Abel Wu <wuyun.abel@bytedance.com>
Cc: kernel test robot <oliver.sang@intel.com>,
<oe-lkp@lists.linux.dev>, <lkp@intel.com>,
<linux-kernel@vger.kernel.org>,
Peter Zijlstra <peterz@infradead.org>,
<aubrey.li@linux.intel.com>, Tiwei Bie <tiwei.btw@antgroup.com>,
Honglei Wang <wanghonglei@didichuxing.com>,
"Aaron Lu" <aaron.lu@intel.com>
Subject: Re: Re: [linus:master] [sched/eevdf] 2227a957e1: BUG:kernel_NULL_pointer_dereference,address
Date: Tue, 20 Feb 2024 17:17:45 +0800 [thread overview]
Message-ID: <ZdRuOQazh0KkK8CD@chenyu5-mobl2> (raw)
In-Reply-To: <9d8cf754-86ad-491f-9c3b-cca9efb2f5b2@bytedance.com>
On 2024-02-20 at 12:04:33 +0800, Abel Wu wrote:
> On 2/19/24 8:49 PM, Chen Yu Wrote:
> >
> > While looking at pick_eevdf(), I have a thought.
> > Currently the sched entity is sorted by their deadline. During task
> > pickup, the pick_eevdf() scans for an candidate sched entity with the
> > smallest deadline. Meanwhile this candidate sched entity must also be
> > eligible.
> >
> > The scan is O(lgn) on average, and O(1) at best case. How about making the
> > average scan even faster by sorting the sched entity not only by deadline,
> > but also the eligibility? The idea is that, the eligible sched entity with
> > smaller deadline is sorted at the front the tree. Otherwise, if the entity
> > is not eligible, even if it has a smaller deadline, it should be sorted
> > at the end of the tree.
>
> Eligibility is dynamic due to the nature of weighted average vruntime.
> IIUC if doing so like above, update_curr() should take the responsibility
> to re-sort the tree which seems to be O(logN).
>
> >
> > After the change, pick_eevdf() get the leftmost sched entity at O(1) on
> > average. Besides, it is guaranteed to return non-NULL sched entity in
> > pick_eevdf(), which prevents suspicious NULL pointer exception in pick_eevdf().
>
> It is guaranteed when doing pick that the rbtree is non-NULL, and given
> that rq lock is held, I don't think the bug is inside pick_eevdf().
>
That's true, my suspect is that although the tree is not NULL, the eligible
check might return false negative thus no candidate is chosen, and pick_eevdf()
is the victim of that. Previously commit 8dafa9d0eb1a ("sched/eevdf: Fix min_deadline
heap integrity") did similar thing to fix the min_deadline. Without this change,
the tree might be traversed incorrectly and found a NULL candidate. And this is
why I'm thinking of printing the whole tree when NULL entity is chosen in
pick_eevdf().
thanks,
Chenyu
next prev parent reply other threads:[~2024-02-20 9:18 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-30 7:24 [linus:master] [sched/eevdf] 2227a957e1: BUG:kernel_NULL_pointer_dereference,address kernel test robot
2024-01-30 10:13 ` Abel Wu
2024-01-30 14:09 ` Oliver Sang
2024-01-31 12:34 ` Abel Wu
2024-02-01 1:47 ` Oliver Sang
2024-02-01 1:29 ` Honglei Wang
2024-02-01 1:54 ` Oliver Sang
2024-02-01 2:52 ` Honglei Wang
2024-01-31 12:10 ` Tiwei Bie
2024-01-31 12:28 ` Abel Wu
2024-01-31 13:14 ` Tiwei Bie
2024-02-19 12:35 ` Chen Yu
2024-02-20 3:39 ` Abel Wu
2024-02-21 2:16 ` Oliver Sang
2024-02-19 12:49 ` Chen Yu
2024-02-20 4:04 ` Abel Wu
2024-02-20 9:17 ` Chen Yu [this message]
2024-02-21 2:32 ` Oliver Sang
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=ZdRuOQazh0KkK8CD@chenyu5-mobl2 \
--to=yu.c.chen@intel.com \
--cc=aaron.lu@intel.com \
--cc=aubrey.li@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lkp@intel.com \
--cc=oe-lkp@lists.linux.dev \
--cc=oliver.sang@intel.com \
--cc=peterz@infradead.org \
--cc=tiwei.btw@antgroup.com \
--cc=wanghonglei@didichuxing.com \
--cc=wuyun.abel@bytedance.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