mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Mike Galbraith <efault@gmx.de>
To: seth bollinger <seth.boll@gmail.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: Possible scheduler bug
Date: Wed, 24 Aug 2011 05:43:30 +0200	[thread overview]
Message-ID: <1314157410.6220.24.camel@marge.simson.net> (raw)
In-Reply-To: <CA+JN8xP1FsjhNzgV5-0MNLewuJdbW1SxQXVxAeEOXcGwOLyKHg@mail.gmail.com>

On Tue, 2011-08-23 at 20:58 -0500, seth bollinger wrote:
> Hello All,
> 
> We recently ran into an interesting scheduler problem when testing one
> of our products. It manifested itself as a user space lockup.  When I
> enabled/printed scheduler stats I noticed that the scheduler was
> always picking the same task to run, and no task stats were being
> updated(clock, sum_exec, sum_sleep, etc.). The scheduler would become
> stuck in this state permanently. This problem was ultimately resolved
> by the following patch to sched.c
> 
> @@ -564,7 +569,7 @@ void check_preempt_curr(struct rq *rq, struct
> task_struct *p, int flags)
>          * A queue event has occurred, and we're going to schedule.  In
>          * this case, we can save a useless back to back clock update.
>          */
> -       if (test_tsk_need_resched(p))
> +       if (rq->curr->se.on_rq && test_tsk_need_resched(rq->curr))
>                 rq->skip_clock_update = 1;
>  }

Yeah, that's correct, but see f26f9aff6aaf67e9a430d16c266f91b13a5bff64.
You'll also want the other bits as well.  (but not the WARN_ON()) 

> I have two questions regarding this patch.
> 
> 1. How was it possible to get the scheduler locked up like that (prior
> to patch application)?

If the clock isn't updated, vruntimes don't advance, so you could end up
selecting the same task repeatedly.

> 2. After patch, is it possible that the scheduler could spin in this
> loop until a sched_clock() tick (our clock resolution is unfortunately
> 10ms)?

If you take the rest of the fix, that shouldn't happen.

	-Mike


      reply	other threads:[~2011-08-24  3:43 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-24  1:58 seth bollinger
2011-08-24  3:43 ` Mike Galbraith [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=1314157410.6220.24.camel@marge.simson.net \
    --to=efault@gmx.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=seth.boll@gmail.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®