lkml.org 
[lkml]   [2013]   [Aug]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 04/10] sched, fair: Shrink sg_lb_stats and play memset games
On Wed, Aug 21, 2013 at 11:08:29AM +0900, Joonsoo Kim wrote:
> On Mon, Aug 19, 2013 at 06:01:02PM +0200, Peter Zijlstra wrote:
> > +static inline void init_sd_lb_stats(struct sd_lb_stats *sds)
> > +{
> > + /*
> > + * struct sd_lb_stats {
> > + * struct sched_group * busiest; // 0 8
> > + * struct sched_group * this; // 8 8
> > + * long unsigned int total_load; // 16 8
> > + * long unsigned int total_pwr; // 24 8
> > + * long unsigned int avg_load; // 32 8
> > + * struct sg_lb_stats {
> > + * long unsigned int avg_load; // 40 8
> > + * long unsigned int group_load; // 48 8
> > + * ...
> > + * } busiest_stat; // 40 56
> > + * struct sg_lb_stats this_stat; // 96 56
> > + *
> > + * // size: 152, cachelines: 3, members: 7
> > + * // last cacheline: 24 bytes
> > + * };
> > + *
> > + * Skimp on the clearing to avoid duplicate work. We can avoid clearing
> > + * this_stat because update_sg_lb_stats() does a full clear/assignment.
> > + * We must however clear busiest_stat::avg_load because
> > + * update_sd_pick_busiest() reads this before assignment.
> > + */
> > + memset(sds, 0, offsetof(struct sd_lb_stats, busiest_stat.group_load));
>
> Hello, Peter.
>
> IMHO, this is so tricky.
> With below change, we can simply do 'offsetof(struct sd_lb_stats, busiest_stat)'.
>
> @@ -4546,7 +4546,7 @@ static bool update_sd_pick_busiest(struct lb_env *env,
> struct sched_group *sg,
> struct sg_lb_stats *sgs)
> {
> - if (sgs->avg_load <= sds->busiest_stat.avg_load)
> + if (!sds->busiest && sgs->avg_load <= sds->busiest_stat.avg_load)
> return false;
>
> if (sgs->sum_nr_running > sgs->group_capacity)
>

Sorry, instead of !sds->busiest, it should be sds->busiest. :)

Thanks.



\
 
 \ /
  Last update: 2013-08-21 04:41    [W:0.114 / U:0.312 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site