Re: TTY task group scheduling

From: Ivan Voras <ivoras_at_freebsd.org>
Date: Sat, 20 Nov 2010 02:16:24 +0100
On 11/19/10 16:49, Taku YAMAMOTO wrote:

> I have a dumb local hack to grant ts_slice proportional to the duration
> the waking thread slept rather than unconditionally reset to sched_slice.
>
>
> --- sys/kern/sched_ule.c.orig
> +++ sys/kern/sched_ule.c
> _at__at_ -1928,12 +1928,16 _at__at_ sched_wakeup(struct thread *td)
>   		u_int hzticks;
>
>   		hzticks = (ticks - slptick)<<  SCHED_TICK_SHIFT;
> +		if (hzticks>  SCHED_SLP_RUN_MAX)
> +			hzticks = SCHED_SLP_RUN_MAX;
>   		ts->ts_slptime += hzticks;
> +		/* Grant additional slices after we sleep. */
> +		ts->ts_slice += hzticks / tickincr;
> +		if (ts->ts_slice > sched_slice)
> +			ts->ts_slice = sched_slice;

If I read it correctly, now instead of the slice given to the thread 
being always sched_slice, now it is reduced to a value smaller than 
sched_slice based on how long did the thread sleep?

How does that help?

>   		sched_interact_update(td);
>   		sched_pctcpu_update(ts);
>   	}
> -	/* Reset the slice value after we sleep. */
> -	ts->ts_slice = sched_slice;
>   	sched_add(td, SRQ_BORING);
>   }
>
>
>
Received on Sat Nov 20 2010 - 00:16:41 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:40:09 UTC