Re: -rt scheduling: wakeup bug?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux