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


Groups > linux.kernel > #1205953 > unrolled thread

Re: [RFCv5 PATCH 20/46] sched: Relocated get_cpu_usage() and change return type

Started byPeter Zijlstra <peterz@infradead.org>
First post2015-08-12 13:00 +0200
Last post2015-08-12 16:40 +0200
Articles 2 — 2 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: [RFCv5 PATCH 20/46] sched: Relocated get_cpu_usage() and change  return type Peter Zijlstra <peterz@infradead.org> - 2015-08-12 13:00 +0200
    Re: [RFCv5 PATCH 20/46] sched: Relocated get_cpu_usage() and change  return type Morten Rasmussen <morten.rasmussen@arm.com> - 2015-08-12 16:40 +0200

#1205953 — Re: [RFCv5 PATCH 20/46] sched: Relocated get_cpu_usage() and change return type

FromPeter Zijlstra <peterz@infradead.org>
Date2015-08-12 13:00 +0200
SubjectRe: [RFCv5 PATCH 20/46] sched: Relocated get_cpu_usage() and change return type
Message-ID<pWBVf-28z-3@gated-at.bofh.it>
On Tue, Jul 07, 2015 at 07:24:03PM +0100, Morten Rasmussen wrote:
> +static unsigned long get_cpu_usage(int cpu)
> +{
> +	int sum;
> +	unsigned long usage = cpu_rq(cpu)->cfs.utilization_load_avg;
> +	unsigned long blocked = cpu_rq(cpu)->cfs.utilization_blocked_avg;
> +	unsigned long capacity_orig = capacity_orig_of(cpu);
> +
> +	sum = usage + blocked;
> +
> +	if (sum >= capacity_orig)
> +		return capacity_orig;
> +
> +	return sum;
> +}

Should sum then not also be unsigned long?
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [next] | [standalone]


#1206167

FromMorten Rasmussen <morten.rasmussen@arm.com>
Date2015-08-12 16:40 +0200
Message-ID<pWFm9-7bv-9@gated-at.bofh.it>
In reply to#1205953
On Wed, Aug 12, 2015 at 12:59:23PM +0200, Peter Zijlstra wrote:
> On Tue, Jul 07, 2015 at 07:24:03PM +0100, Morten Rasmussen wrote:
> > +static unsigned long get_cpu_usage(int cpu)
> > +{
> > +	int sum;
> > +	unsigned long usage = cpu_rq(cpu)->cfs.utilization_load_avg;
> > +	unsigned long blocked = cpu_rq(cpu)->cfs.utilization_blocked_avg;
> > +	unsigned long capacity_orig = capacity_orig_of(cpu);
> > +
> > +	sum = usage + blocked;
> > +
> > +	if (sum >= capacity_orig)
> > +		return capacity_orig;
> > +
> > +	return sum;
> > +}
> 
> Should sum then not also be unsigned long?

Yes it should. So much for my attempt at fixing the types :(
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web