lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20170228113515.GM19665@e106622-lin>
Date:   Tue, 28 Feb 2017 11:35:15 +0000
From:   Juri Lelli <juri.lelli@....com>
To:     Byungchul Park <byungchul.park@....com>
Cc:     peterz@...radead.org, mingo@...nel.org,
        linux-kernel@...r.kernel.org, juri.lelli@...il.com,
        rostedt@...dmis.org, kernel-team@....com
Subject: Re: [PATCH v3] sched/deadline: Change the time to replenish runtime
 for sleep tasks

Hi,

On 23/02/17 15:14, Byungchul Park wrote:
> Let's consider the following example.
> 
> timeline : o...................o.........o.......o..o
>            ^                   ^         ^       ^  ^
>            |                   |         |       |  |
>        start                   |         |       |  |
>                 original runtime         |       |  |
>                      sleep with (-)runtime       |  |
>                                  original deadline  |
>                                               wake up
> 
> When this task is woken up, a negative runtime should be considered,
> which means that the task should get penalized when assigning runtime,
> becasue it already spent more than expected. Current code handles this
> by replenishing a runtime in hrtimer callback for deadline. But this
> approach has room for improvement:
> 
>    It will be replenished twice unnecessarily if the task sleeps for
>    long time so that the deadline, assigned in the hrtimer callback,
>    also passed. In other words, one happens in the callback and the
>    other happens in update_dl_entiry() when waking it up.
> 
> So force to replenish it for sleep tasks when waking it up.
> 
> Signed-off-by: Byungchul Park <byungchul.park@....com>
> ---
>  kernel/sched/deadline.c | 13 ++++++-------
>  1 file changed, 6 insertions(+), 7 deletions(-)
> 
> diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c
> index 27737f3..cb43ce9 100644
> --- a/kernel/sched/deadline.c
> +++ b/kernel/sched/deadline.c
> @@ -498,8 +498,9 @@ static void update_dl_entity(struct sched_dl_entity *dl_se,
>  	struct dl_rq *dl_rq = dl_rq_of_se(dl_se);
>  	struct rq *rq = rq_of_dl_rq(dl_rq);
>  
> -	if (dl_time_before(dl_se->deadline, rq_clock(rq)) ||
> -	    dl_entity_overflow(dl_se, pi_se, rq_clock(rq))) {
> +	if (dl_time_before(dl_se->deadline, rq_clock(rq)))
> +		replenish_dl_entity(dl_se, pi_se);
> +	else if (dl_entity_overflow(dl_se, pi_se, rq_clock(rq))) {
>  		dl_se->deadline = rq_clock(rq) + pi_se->dl_deadline;
>  		dl_se->runtime = pi_se->dl_runtime;
>  	}
> @@ -621,13 +622,11 @@ static enum hrtimer_restart dl_task_timer(struct hrtimer *timer)
>  	 *         __dequeue_task_dl()
>  	 *     prev->on_rq = 0;
>  	 *
> -	 * We can be both throttled and !queued. Replenish the counter
> -	 * but do not enqueue -- wait for our wakeup to do that.
> +	 * We can be both throttled and !queued. Wait for our wakeup to
> +	 * replenish runtime and enqueue p.
>  	 */
> -	if (!task_on_rq_queued(p)) {
> -		replenish_dl_entity(dl_se, dl_se);

Hasn't this patch the same problem we discussed a couple of weeks ago?

https://marc.info/?l=linux-kernel&m=148699950802995

Thanks,

- Juri

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ