Re: [patch 4 15/22] timer: Remove slack leftovers
From: Jason A. Donenfeld
Date: Fri Jul 22 2016 - 18:55:00 EST
On Fri, Jul 22, 2016 at 5:18 PM, Jason A. Donenfeld <Jason@xxxxxxxxx> wrote:
> Hi Thomas,
>
> On Fri, Jul 22, 2016 at 3:04 PM, Thomas Gleixner <tglx@xxxxxxxxxxxxx> wrote:
>>
>> Well, this really depends on the TIMEOUT value you have. The code now does
>> implicit batching for larger timeouts by queueing the timers into wheels with
>> coarse grained granularity. As long as your new TIMEOUT value ends up in the
>> same bucket then that's equivalent to the slack thing.
>>
>> Can you give me a ballpark of your TIMEOUT value?
>
> Generally either 5 seconds, 10 seconds, or 25 seconds.
>
> Are these okay? Is the 25 case substantially different from the 5 case?
I suppose, anyway, it's easy enough just to provide my own coalescing
function. Actually, I'd rather have it batch timers to fire earlier
rather than later, in my case. So, I can do something like this to
round down to the nearest ~ quarter of a second:
static inline unsigned long slack_time(unsigned long time)
{
return time & ~(BIT_MASK(ilog2(HZ / 4) + 1) - 1);
}
mod_timer(&timer, slack_time(jiffies + TIMEOUT));
This seems to do roughly what I want.
Jason