On Fri, 2010-09-24 at 11:18 +1000, Dave Chinner wrote: > On Thu, Sep 23, 2010 at 01:53:55PM -0500, Alex Elder wrote: > > On Thu, 2010-09-23 at 12:27 +1000, Dave Chinner wrote: . . . > > I don't really care much about this, but I'll take this > > opportunity for a small rant. > > > > The difference in calculation cost/speed between "x >> 3" and > > "x / 8" is vanishingly small. > > That is architecture dependent, but in most cases these days the > compiler will optimise a divide-by-power-ofâ2-constant into a shift > operation anyway. I'm pretty sure that optimisation is done on even > on x86 as a shift is a single cycle operation while an integer > divide still takes several cycles and consumes more power. I know, it'll take about a nanosecond longer than necessary, and an extra 25 picowatt hours (IF the compiler doesn't optimize it away). This being done to determine whether to start a series of I/O operations... > > I think it is meaningful to use > > a shift in places where a power-of-two is mandated, but in places > > like this it suggests there is a constraint that simply doesn't > > exist. So for example, you could have chosen (log->logsize / 10) > > as the "try pushing" value, and (log->logsize / 4 - 1) as the > > "must push" value. > > It's more the fact that XFS uses power-of-2 logic (i.e shifts) > everywhere. I just tend to be consistent with what is already there. > In this case, the AIL push thresholds are calculated using shifts: > > free_threshold = MAX(free_threshold, (log->l_logBBsize >> 2)); > > and so when you compare that to the XLOG_CIL_SPACE_LIMIT() > definitions, it is immediately clear that the CIL limits are smaller > than the AIL push threshold... I get it. And as I said before, I truly don't care much about this--it's an observation more than even an annoyance, and it's already taken a lot more time and mental energy (not to mention electric power) than it ever really deserved. -Alex _______________________________________________ xfs mailing list xfs@xxxxxxxxxxx http://oss.sgi.com/mailman/listinfo/xfs