Re: [RFC][PATCH] Dynamic Tick: Allow 32-bit machines to sleep formore than 2.15 seconds

From: Jon Hunter
Date: Tue Apr 21 2009 - 23:08:25 EST


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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/