[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20161205233005.54275bd6@sweethome>
Date: Mon, 5 Dec 2016 23:30:05 +0100
From: luca abeni <luca.abeni@...tn.it>
To: Peter Zijlstra <peterz@...radead.org>
Cc: Steven Rostedt <rostedt@...dmis.org>,
Daniel Bristot de Oliveira <bristot@...hat.com>,
linux-kernel@...r.kernel.org, Ingo Molnar <mingo@...hat.com>,
Juri Lelli <juri.lelli@....com>,
Claudio Scordino <claudio@...dence.eu.com>
Subject: Re: [RFC v3 1/6] Track the active utilisation
Hi Peter,
On Fri, 18 Nov 2016 15:23:59 +0100
Peter Zijlstra <peterz@...radead.org> wrote:
[...]
> u64 running_bw;
>
> static void add_running_bw(struct sched_dl_entity *dl_se, struct
> dl_rq *dl_rq) {
> u64 old = dl_rq->running_bw;
>
> dl_rq->running_bw += dl_se->dl_bw;
> SCHED_WARN_ON(dl_rq->running_bw < old); /* overflow */
> }
>
> static void sub_running_bw(struct sched_dl_entity *dl_se, struct
> dl_rq *dl_rq) {
> u64 old = dl_rq->running_bw;
>
> dl_rq->running_bw -= dl_se->dl_bw;
> SCHED_WARN_ON(dl_rq->running_bw > old); /* underflow */
> }
I wanted to change "SCHED_WARN_ON(dl_rq->running_bw > old); /*
underflow */" into "if (SCHED_WARN_ON(...)) dl_rq->running_bw = 0" (to
avoid using nonsensical "running_bw" values), but I see that
"SCHED_WARN_ON()" cannot be used inside an if (this seems to be a
difference respect to "SCHED_WARN()").
This is because of the definition used when CONFIG_SCHED_DEBUG is not
defined (I noticed the issue when testing with random kernel
configurations).
Is this expected? If yes, what should I do in this case? Something like
SCHED_WARN_ON(dl_rq->running_bw > old); /* underflow */
if (dl_rq->running_bw > old)
dl_rq->running_bw = 0;
?
Or something else?
Thanks,
Luca
Powered by blists - more mailing lists