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>,
	Thomas Gleixner <tglx@linutronix.de>,
	Steven Rostedt <rostedt@goodmis.org>,
	Clark Williams <williams@redhat.com>
Subject: Re: -rt scheduling: wakeup bug?
Date: Wed, 3 Oct 2007 10:37:05 -0700	[thread overview]
Message-ID: <20071003173705.GB4817@monkey.ibm.com> (raw)
In-Reply-To: <20071002050632.GB28345@elte.hu>

On Tue, Oct 02, 2007 at 07:06:32AM +0200, Ingo Molnar wrote:
> Index: linux-rt-rebase.q/kernel/sched.c
> ===================================================================
> --- linux-rt-rebase.q.orig/kernel/sched.c
> +++ linux-rt-rebase.q/kernel/sched.c
> @@ -1819,6 +1819,13 @@ out_set_cpu:
>  		cpu = task_cpu(p);
>  	}
> 
> +out_activate:
> +#endif /* CONFIG_SMP */
> +
> +	activate_task(rq, p, 1);
> +
> +	trace_start_sched_wakeup(p, rq);
> +
>  	/*
>  	 * If a newly woken up RT task cannot preempt the
>  	 * current (RT) task (on a target runqueue) then try
> @@ -1849,28 +1856,21 @@ out_set_cpu:
>  			smp_send_reschedule_allbutself_cpumask(p->cpus_allowed);
> 
>  		schedstat_inc(this_rq, rto_wakeup);
> -	}
> -
> -out_activate:
> -#endif /* CONFIG_SMP */
> -
> -	activate_task(rq, p, 1);
> -
> -	trace_start_sched_wakeup(p, rq);
> -
> -	/*
> -	 * Sync wakeups (i.e. those types of wakeups where the waker
> -	 * has indicated that it will leave the CPU in short order)
> -	 * don't trigger a preemption, if the woken up task will run on
> -	 * this cpu. (in this case the 'I will reschedule' promise of
> -	 * the waker guarantees that the freshly woken up task is going
> -	 * to be considered on this CPU.)
> -	 */
> -	if (!sync || cpu != this_cpu)
> -		check_preempt_curr(rq, p);
> -	else {
> -		if (TASK_PREEMPTS_CURR(p, rq))
> -			set_tsk_need_resched_delayed(rq->curr);
> +	} else {
> +		/*
> +		 * Sync wakeups (i.e. those types of wakeups where the waker
> +		 * has indicated that it will leave the CPU in short order)
> +		 * don't trigger a preemption, if the woken up task will run on
> +		 * this cpu. (in this case the 'I will reschedule' promise of
> +		 * the waker guarantees that the freshly woken up task is going
> +		 * to be considered on this CPU.)
> +		 */
> +		if (!sync || cpu != this_cpu)
> +			check_preempt_curr(rq, p);
> +		else {
> +			if (TASK_PREEMPTS_CURR(p, rq))
> +				set_tsk_need_resched_delayed(rq->curr);
> +		}
>  	}
>  	if (rq->curr && p && rq && _need_resched())
>  		trace_special_pid(p->pid, PRIO(p), PRIO(rq->curr));

Not an issue with the patch, just that last bit of code pulled in for
context.  I don't think it is a bug, but the checking of 'rq' after
checking 'rq->curr' just doesn't look right (or necessary).  Could it
just be an artifact from earlier versions of the code?

-- 
Mike

  parent reply	other threads:[~2007-10-03 17:37 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-01 22:15 RT scheduling: wakeup bug? Mike Kravetz
2007-10-02  5:06 ` -rt " Ingo Molnar
2007-10-02 19:30   ` Mike Kravetz
2007-10-02 19:37     ` Steven Rostedt
2007-10-03 17:37   ` Mike Kravetz [this message]
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=20071003173705.GB4817@monkey.ibm.com \
    --to=kravetz@us.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=rostedt@goodmis.org \
    --cc=tglx@linutronix.de \
    --cc=williams@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