[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CANN689FBczsBm=bYPfs1saUEeUq+oxLWnr8xfwtOstQkvJmwOA@mail.gmail.com>
Date: Thu, 30 Apr 2020 00:51:02 -0700
From: Michel Lespinasse <walken@...gle.com>
To: Juri Lelli <juri.lelli@...hat.com>
Cc: Peter Zijlstra <peterz@...radead.org>,
LKML <linux-kernel@...r.kernel.org>,
Davidlohr Bueso <dave@...olabs.net>,
Ingo Molnar <mingo@...nel.org>,
Thomas Gleixner <tglx@...utronix.de>,
Oleg Nesterov <oleg@...hat.com>, irogers@...gle.com,
Vincent Guittot <vincent.guittot@...aro.org>
Subject: Re: [RFC][PATCH 1/7] rbtree: Add generic add and find helpers
On Thu, Apr 30, 2020 at 12:28 AM Juri Lelli <juri.lelli@...hat.com> wrote:
> > --- a/include/linux/rbtree.h
> > +++ b/include/linux/rbtree.h
> > @@ -141,12 +141,18 @@ static inline void rb_insert_color_cache
> > rb_insert_color(node, &root->rb_root);
> > }
> >
> > -static inline void rb_erase_cached(struct rb_node *node,
> > +static inline bool rb_erase_cached(struct rb_node *node,
> > struct rb_root_cached *root)
> > {
> > - if (root->rb_leftmost == node)
> > + bool leftmost = false;
> > +
> > + if (root->rb_leftmost == node) {
> > root->rb_leftmost = rb_next(node);
>
> Think we need
>
> if (root->rb_leftmost)
>
> > + leftmost = true;
>
> DEADLINE crashes w/o that.
I think Peter's code is correct; after removing the only node in an
rbtree rb_leftmost should be NULL.
The issue appears to be in dequeue_pushable_dl_task unconditionally
dereferencing the pointer returned by rb_first_cached(), which may be
NULL. I'm not sure what the correct behavior is though, i.e. what
dl_rq->earliest_dl.next should be set to if the rbtree ends up empty.
Current code (before Peter's changes) preserves the existing
dl_rq->earliest_dl.next value in that case, which seems very weird to
me (and worthy of a comment if it's correct).
Powered by blists - more mailing lists