lkml.org 
[lkml]   [2019]   [Jul]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 5/5] sched/deadline: Use return value of SCHED_WARN_ON() in bw accounting
Hi Dietmar,

On Fri, 26 Jul 2019 09:27:56 +0100
Dietmar Eggemann <dietmar.eggemann@arm.com> wrote:

> To make the decision whether to set rq or running bw to 0 in underflow
> case use the return value of SCHED_WARN_ON() rather than an extra if
> condition.

I think I tried this at some point, but if I remember well this
solution does not work correctly when SCHED_DEBUG is not enabled.



Luca


>
> Signed-off-by: Dietmar Eggemann <dietmar.eggemann@arm.com>
> ---
> kernel/sched/deadline.c | 6 ++----
> 1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c
> index a9cb52ceb761..66c594b5507e 100644
> --- a/kernel/sched/deadline.c
> +++ b/kernel/sched/deadline.c
> @@ -95,8 +95,7 @@ void __sub_running_bw(u64 dl_bw, struct dl_rq
> *dl_rq)
> lockdep_assert_held(&(rq_of_dl_rq(dl_rq))->lock);
> dl_rq->running_bw -= dl_bw;
> - SCHED_WARN_ON(dl_rq->running_bw > old); /* underflow */
> - if (dl_rq->running_bw > old)
> + if (SCHED_WARN_ON(dl_rq->running_bw > old)) /* underflow */
> dl_rq->running_bw = 0;
> /* kick cpufreq (see the comment in kernel/sched/sched.h). */
> cpufreq_update_util(rq_of_dl_rq(dl_rq), 0);
> @@ -119,8 +118,7 @@ void __sub_rq_bw(u64 dl_bw, struct dl_rq *dl_rq)
>
> lockdep_assert_held(&(rq_of_dl_rq(dl_rq))->lock);
> dl_rq->this_bw -= dl_bw;
> - SCHED_WARN_ON(dl_rq->this_bw > old); /* underflow */
> - if (dl_rq->this_bw > old)
> + if (SCHED_WARN_ON(dl_rq->this_bw > old)) /* underflow */
> dl_rq->this_bw = 0;
> SCHED_WARN_ON(dl_rq->running_bw > dl_rq->this_bw);
> }

\
 
 \ /
  Last update: 2019-07-26 12:18    [W:0.120 / U:10.848 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site