Messages in this thread | | | Date | Tue, 21 Apr 2009 22:07:27 -0500 | From | Jon Hunter <> | Subject | Re: [RFC][PATCH] Dynamic Tick: Allow 32-bit machines to sleep for more than 2.15 seconds |
| |
john stultz wrote: > One other minor comment nit, if we're really meaning that max_delta_ns > is a 64bit value, should we not just be using s64 and be explicit > instead of converting longs to long longs?
Thanks for the feedback. I am in two minds about this. I agree and I would prefer to use s64/u64 as this is explicit with regard to the size of the data type. However, for right or wrong I ended up with long long because...
a). The function clockevent_delta2ns() uses LONG_MAX (or in my suggestion LLONG_MAX) as the upper limit. LONG_MAX and LLONG_MAX are defined as a long and long long respectively.
#define LONG_MAX ((long)(~0UL>>1)) #define LLONG_MAX ((long long)(~0ULL>>1))
b). There are a couple prints in the kernel for display max_delta_ns and min_delta_ns. The prints use %lu and %llu to indicate long and long long types respectively.
So to avoid using casts or possibly a type mismatch for some architecture that I may have overlooked I kept it as long long. So this assumes that long long will be a 64-bit type which I don't like. However, this would not cause any compilation issues even if long long turned out to be 32-bits or 128-bits (if this is even possible). We could use u64 and cast where necessary to be safe/correct if this is preferred.
Cheers Jon
| |