On Sat, Aug 24, 2013 at 03:15:57AM -0700, Paul Turner 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. > > + */ > > Does gcc seriously not get this right if we just write: > sds->busiest = NULL; > sds->local = NULL; > .... > > etc.?
There's a thought ;-) How about something like this? sds = (struct sd_lb_stats){ .busiest = NULL, .local = NULL, .busiest_stat = { .avg_load = 0, }, }; C99 named initializers should ignore all unmentioned fields, and I think we don't actually touch any of the other fields unless something is set. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/