From: Peter Zijlstra <peterz@infradead.org>
To: Yafang Shao <laoar.shao@gmail.com>
Cc: mingo@redhat.com, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] sched: fix NULL pointer issue in pick_next_entity()
Date: Tue, 1 Aug 2017 12:23:55 +0200 [thread overview]
Message-ID: <20170801102355.n2daefbynx6wnl22@hirez.programming.kicks-ass.net> (raw)
In-Reply-To: <CALOAHbCJXhG0DyCRpSEU=t5uTV1JhxOW+vNDCm-UjS8CHazkHA@mail.gmail.com>
On Tue, Aug 01, 2017 at 05:20:11PM +0800, Yafang Shao wrote:
> Hi Peter,
>
> 2017-08-01 17:12 GMT+08:00 Peter Zijlstra <peterz@infradead.org>:
> > On Tue, Aug 01, 2017 at 04:57:43PM +0800, Yafang Shao wrote:
> >> > And how would that happen? We only call pick_next_entity(.curr=NULL)
> >> > when we _know_ cfs_rq->nr_running.
> >>
> >> It crashed my machine when I did hadoop test, and after I made this change
> >> it works now.
> >> On SMP system, cfs_rq->nr_running isn't protected well, although we _know_
> >> cfs_rq->nr_running,
> >> but it is modified by other thread running on other CPU and the
> >> sched_entity is set NULL as well.
> >> Then this thread broken here as accessed the NULL pointer here.
> >
> > cfs_rq->nr_running should be protected by the rq->lock. If it is not,
> > something else is buggered.
>
> Yes, I admit that something else is buggered, but unfortunately I
> haven't understood the
> scheduler deeply so can't find the root cause.
>
> But from my understanding, it is obviously a bug here as we can find
> that it may occurs that both 'se'
> and 'curr' are NULL. That's why I submit this patch to fix it.
Thing is, it doesn't fix a bug, it hides one. The real bug is nr_running
changing while you own the rq->lock. That should _never_ happen.
prev parent reply other threads:[~2017-08-01 10:24 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-01 10:01 Yafang Shao
2017-08-01 8:38 ` Peter Zijlstra
2017-08-01 8:58 ` Yafang Shao
[not found] ` <CALOAHbCop71efobq4y2FD_=f4cXd-a5G9hwKgC8occkN0YTVBw@mail.gmail.com>
2017-08-01 9:12 ` Peter Zijlstra
2017-08-01 9:20 ` Yafang Shao
2017-08-01 10:23 ` Peter Zijlstra [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=20170801102355.n2daefbynx6wnl22@hirez.programming.kicks-ass.net \
--to=peterz@infradead.org \
--cc=laoar.shao@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.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®