public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Mike Kravetz <kravetz@us.ibm.com>
To: Ingo Molnar <mingo@elte.hu>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: RT scheduling: wakeup bug?
Date: Mon, 1 Oct 2007 15:15:19 -0700	[thread overview]
Message-ID: <20071001221519.GA20671@monkey.ibm.com> (raw)

I've been trying to track down some unexpected realtime latencies and
believe one source is a bug in the wakeup code.  Specifically, this is
within the try_to_wake_up() routine.  Within this routine there is the
following code segment:

	/*
	 * If a newly woken up RT task cannot preempt the
	 * current (RT) task (on a target runqueue) then try
	 * to find another CPU it can preempt:
	 */
	if (rt_task(p) && !TASK_PREEMPTS_CURR(p, rq)) {
		struct rq *this_rq = cpu_rq(this_cpu);
		/*
		 * Special-case: the task on this CPU can be
		 * preempted. In that case there's no need to
		 * trigger reschedules on other CPUs, we can
		 * mark the current task for reschedule.
		 *
		 * (Note that it's safe to access this_rq without
		 * extra locking in this particular case, because
		 * we are on the current CPU.)
		 */
		if (TASK_PREEMPTS_CURR(p, this_rq))
			set_tsk_need_resched(this_rq->curr);
		else
			/*
			 * Neither the intended target runqueue
			 * nor the current CPU can take this task.
			 * Trigger a reschedule on all other CPUs
			 * nevertheless, maybe one of them can take
			 * this task:
			 */
			smp_send_reschedule_allbutself_cpumask(p->cpus_allowed);

		schedstat_inc(this_rq, rto_wakeup);
	}

This logic seems appropriate.  But, the task 'p' is most likely not on
the runqueue when sending the IPI.  It gets added to the runqueue a
little later in the routine.  As a result, the 'rt_overload' global may
not be set (based on the count of RT tasks on the runqueue) and other
CPUs may 'pass over' the runqueue when doing RT load balancing.

My observations/debugging/conclusions are based on an earlier version
of the code.  It appears the same code/issue still exists in the most
version.  But, I have not not done any work with the latest version.

-- 
Mike

             reply	other threads:[~2007-10-01 22:14 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-01 22:15 Mike Kravetz [this message]
2007-10-02  5:06 ` -rt scheduling: wakeup bug? Ingo Molnar
2007-10-02 19:30   ` Mike Kravetz
2007-10-02 19:37     ` Steven Rostedt
2007-10-03 17:37   ` Mike Kravetz
2007-10-04  8:02     ` Ingo Molnar

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=20071001221519.GA20671@monkey.ibm.com \
    --to=kravetz@us.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    /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