Re: [RFC v3 1/6] Track the active utilisation

From: luca abeni
Date: Tue Dec 06 2016 - 03:57:33 EST


On Tue, 6 Dec 2016 09:35:01 +0100
Peter Zijlstra <peterz@xxxxxxxxxxxxx> wrote:

> On Mon, Dec 05, 2016 at 11:30:05PM +0100, luca abeni wrote:
> > Hi Peter,
> >
> > On Fri, 18 Nov 2016 15:23:59 +0100
> > Peter Zijlstra <peterz@xxxxxxxxxxxxx> 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()").
>
> There's a SCHED_WARN? Did you mean to say WARN_ON()?

Sorry, I managed to confuse myself... I was thinking about WARN_ON()
(the one I used in the previous version of my patches).

> And yes, mostly by accident I think, I'm not a big user of that
> pattern and neglected it when I did SCHED_WARN_ON().

You mean the "if(WARN(...))" pattern? I think it was suggested in a
previous round of reviews.


> > This is because of the definition used when CONFIG_SCHED_DEBUG is
> > not defined (I noticed the issue when testing with random kernel
> > configurations).
>
> I'm fine changing the definition, just find something that works. The
> current ((void)(x)) thing was to avoid unused complaints -- although
> I'm not sure there were any.

Ok; I'll see if I manage to find a working definition.


Thanks,
Luca