Re: [PATCH] sched/rt: Avoid updating RT entry timeout twice within one tick period

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

 



On Tue, 2012-07-17 at 15:03 +0800, Ying Xue wrote:

> To solve the issue, we prevent the timeout value from increasing twice
> within one tick time by remembering the jiffies value of lastly updating
> the timeout. As long as the RT task's jiffies is different with the
> global jiffies value, we allow its timeout to be updated.

Peter, I'm fine with this change. Do you want to pick it up. It looks
like it can affect mainline as well.

Acked-by: Steven Rostedt <rostedt@xxxxxxxxxxx>

-- Steve

> 
> Signed-off-by: Ying Xue <ying.xue@xxxxxxxxxxxxx>
> Signed-off-by: Fan Du <fan.du@xxxxxxxxxxxxx>
> Reviewed-by: Yong Zhang <yong.zhang0@xxxxxxxxx>
> ---
>  include/linux/sched.h |    1 +
>  kernel/sched/rt.c     |    6 +++++-
>  2 files changed, 6 insertions(+), 1 deletions(-)
> 
> diff --git a/include/linux/sched.h b/include/linux/sched.h
> index 4a1f493..f0656a2 100644
> --- a/include/linux/sched.h
> +++ b/include/linux/sched.h
> @@ -1199,6 +1199,7 @@ struct sched_entity {
>  struct sched_rt_entity {
>  	struct list_head run_list;
>  	unsigned long timeout;
> +	unsigned long watchdog_stamp;
>  	unsigned int time_slice;
>  
>  	struct sched_rt_entity *back;
> diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c
> index 573e1ca..8240d4f 100644
> --- a/kernel/sched/rt.c
> +++ b/kernel/sched/rt.c
> @@ -1976,7 +1976,11 @@ static void watchdog(struct rq *rq, struct task_struct *p)
>  	if (soft != RLIM_INFINITY) {
>  		unsigned long next;
>  
> -		p->rt.timeout++;
> +		if (p->rt.watchdog_stamp != jiffies) {
> +			p->rt.timeout++;
> +			p->rt.watchdog_stamp = jiffies;
> +		}
> +
>  		next = DIV_ROUND_UP(min(soft, hard), USEC_PER_SEC/HZ);
>  		if (p->rt.timeout > next)
>  			p->cputime_expires.sched_exp = p->se.sum_exec_runtime;


--
To unsubscribe from this list: send the line "unsubscribe linux-rt-users" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [RT Stable]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux