[PATCH 2/2] sched: Try tp catch cpu_power being set to 0

Henrik Rydberg rydberg at euromail.se
Wed Jan 19 14:50:47 UTC 2011


> > diff --git a/kernel/sched.c b/kernel/sched.c
> > index d4a4b14..7ef70c0 100644
> > --- a/kernel/sched.c
> > +++ b/kernel/sched.c
> > @@ -3713,6 +3713,7 @@ static void update_cpu_power(struct sched_domain *sd, int cpu)
> >  	unsigned long weight = sd->span_weight;
> >  	unsigned long power = SCHED_LOAD_SCALE;
> >  	struct sched_group *sdg = sd->groups;
> > +	unsigned long scale_rt;
> >  
> >  	if (sched_feat(ARCH_POWER))
> >  		power *= arch_scale_freq_power(sd, cpu);
> > @@ -3730,12 +3731,18 @@ static void update_cpu_power(struct sched_domain *sd, int cpu)
> >  		power >>= SCHED_LOAD_SHIFT;
> >  	}
> >  
> > -	power *= scale_rt_power(cpu);
> > +	scale_rt = scale_rt_power(cpu);
> > +	power *= scale_rt;
> > +
> >  	power >>= SCHED_LOAD_SHIFT;
> >  
> >  	if (!power)
> >  		power = 1;
> >  
> > +	if (WARN_ON((long) power <= 0))
> > +		printk(KERN_ERR "cpu_power = %ld; scale_rt = %ld\n",
> > +			power, scale_rt);
> > +
> 
> This is meant to catch when power == 0, but just above power is zapped
> to 1 if it is 0.  Did we want to catch the 0 ie should this be above the
> power zapping ?  I guess this is more checking >2^32 ?

Or should it perhaps be placed below the following assignment,
checking the actual register? Is the problem really on 64 bit? Since
power is unsigned long locally, but unsigned int in sched_group, on
32-bit machines...

> 
> >  	sdg->cpu_power = power;
> >  }
> >  

Henrik




More information about the kernel-team mailing list