Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1525393 > unrolled thread

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

Started byPeter Zijlstra <peterz@infradead.org>
First post2016-11-18 15:30 +0100
Last post2016-11-18 17:50 +0100
Articles 4 — 3 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [RFC v3 1/6] Track the active utilisation Peter Zijlstra <peterz@infradead.org> - 2016-11-18 15:30 +0100
    Re: [RFC v3 1/6] Track the active utilisation luca abeni <luca.abeni@unitn.it> - 2016-11-18 16:20 +0100
      Re: [RFC v3 1/6] Track the active utilisation Peter Zijlstra <peterz@infradead.org> - 2016-11-18 16:30 +0100
    Re: [RFC v3 1/6] Track the active utilisation Steven Rostedt <rostedt@goodmis.org> - 2016-11-18 17:50 +0100

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

FromPeter Zijlstra <peterz@infradead.org>
Date2016-11-18 15:30 +0100
SubjectRe: [RFC v3 1/6] Track the active utilisation
Message-ID<sESkX-8jW-53@gated-at.bofh.it>
On Tue, Oct 25, 2016 at 09:58:11AM -0400, Steven Rostedt wrote:

> I agree with Daniel, especially since I don't usually trust the
> compiler. And the added variable is more of a distraction as it doesn't
> seem to have any real purpose.

I don't think there's anything here to trust the compiler on. Either
it inlines or it doesn't, it should generate 'correct' code either way.

If it doesn't inline, its a dumb compiler and it will make these dumb
decisions throughout the tree and your kernel will be slow, not my
problem really ;-)

That said, I agree that the single line thing is actually easier to
read.

That said; there's something to be said for:

	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 */
}

[toc] | [next] | [standalone]


#1525456

Fromluca abeni <luca.abeni@unitn.it>
Date2016-11-18 16:20 +0100
Message-ID<sET7j-oi-13@gated-at.bofh.it>
In reply to#1525393
On Fri, 18 Nov 2016 15:23:59 +0100
Peter Zijlstra <peterz@infradead.org> wrote:

> On Tue, Oct 25, 2016 at 09:58:11AM -0400, Steven Rostedt wrote:
> 
> > I agree with Daniel, especially since I don't usually trust the
> > compiler. And the added variable is more of a distraction as it
> > doesn't seem to have any real purpose.  
> 
> I don't think there's anything here to trust the compiler on. Either
> it inlines or it doesn't, it should generate 'correct' code either
> way.
> 
> If it doesn't inline, its a dumb compiler and it will make these dumb
> decisions throughout the tree and your kernel will be slow, not my
> problem really ;-)
> 
> That said, I agree that the single line thing is actually easier to
> read.

Ok; I already made that change locally.


> 
> That said; there's something to be said for:
> 
> 	u64 running_bw;

Ok; I originally made it signed because I wanted the "running_bw < 0"
check, but I can change it to "dl_rq->running_bw > old" (I did not
think about it).

I'll make these changes locally ASAP.


			Thanks,
				Luca

> 
> 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 */
> }
> 
> 

[toc] | [prev] | [next] | [standalone]


#1525462

FromPeter Zijlstra <peterz@infradead.org>
Date2016-11-18 16:30 +0100
Message-ID<sETh0-rm-9@gated-at.bofh.it>
In reply to#1525456
On Fri, Nov 18, 2016 at 04:10:17PM +0100, luca abeni wrote:

> Ok; I originally made it signed because I wanted the "running_bw < 0"
> check, but I can change it to "dl_rq->running_bw > old" (I did not
> think about it).

Happy accident of me staring at unsigned over/under-flow for the past
several days :-)

[toc] | [prev] | [next] | [standalone]


#1525511

FromSteven Rostedt <rostedt@goodmis.org>
Date2016-11-18 17:50 +0100
Message-ID<sEUwq-1by-35@gated-at.bofh.it>
In reply to#1525393
On Fri, 18 Nov 2016 15:23:59 +0100
Peter Zijlstra <peterz@infradead.org> wrote:

 
> That said; there's something to be said for:
> 
> 	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 */
> }
> 

Acked-by: me

-- Steve

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web