From: Nick P. <nic...@ya...> - 2006-02-28 00:25:21
|
Chandra Seetharaman wrote: >On Mon, 2006-02-27 at 20:17 +1100, Nick Piggin wrote: > >>> #ifdef CONFIG_SCHEDSTATS >>>+ >>>+int schedstats_sysctl = 0; /* schedstats turned off by default */ >>> >>Should be read mostly. >> >> >>>+static DEFINE_PER_CPU(int, schedstats) = 0; >>>+ >>> >>When the above is in the read mostly section, you won't need this at all. >> >>You don't intend to switch the sysctl with great frequency, do you? >> > >No, it is not expected to switch often. > >We originally coded it as __read_mostly, but thought the variable >bouncing between CPUs would be costly. Is it cheaper with >__read_mostly ? or it doesn't matter ? > > Well it will only "bounce" when the cacheline it is in is written to by a different CPU. Considering this happens with your per-cpu implementation _anyway_, they don't buy you anything much. Putting it in __read_mostly means that you won't happen to share a cacheline with a variable that is being written to frequently. Nick -- Send instant messages to your online friends http://au.messenger.yahoo.com |