[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAK8P3a1YWvZ-mN06eH=p0N01CWkw9=_u8PFH0xyMzyOxLm7pDA@mail.gmail.com>
Date: Mon, 22 May 2017 13:26:33 +0200
From: Arnd Bergmann <arnd@...db.de>
To: Thomas Gleixner <tglx@...utronix.de>
Cc: Christoph Hellwig <hch@....de>, Tejun Heo <tj@...nel.org>,
linuxppc-dev <linuxppc-dev@...ts.ozlabs.org>,
Mark Gross <mark.gross@...el.com>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
linux-s390 <linux-s390@...r.kernel.org>
Subject: Re: RFC: better timer interface
On Sun, May 21, 2017 at 8:14 PM, Thomas Gleixner <tglx@...utronix.de> wrote:
> On Sun, 21 May 2017, Thomas Gleixner wrote:
>> On Tue, 16 May 2017, Arnd Bergmann wrote:
>> > On Tue, May 16, 2017 at 5:51 PM, Christoph Hellwig <hch@....de> wrote:
>> > > Yes, that sounds useful to me as well. As you said it's an independent
>> > > but somewhat related change. I can add it to my series, but I'll
>> > > need a suggestions for a good and short name. That already was the
>> > > hardest part for the setup side :)
>> >
>> > If we keep the unusual *_timer() naming (rather than timer_*() as hrtimer
>> > has), we could use one of
>> >
>> > a) start_timer(struct timer_list *timer, unsigned long ms);
>> > b) restart_timer(struct timer_list *timer, unsigned long ms);
>> > c) mod_timer_ms(struct timer_list *timer, unsigned long ms);
>> > mod_timer_sec(struct timer_list *timer, unsigned long sec);
>>
>> Please make new functions prefixed with timer_ and get rid of that old
>> interface completely. It's horrible.
>>
>> timer_init()
>> timer_start(timer, ms, abs)
>
> I'm not even sure, whether we need absolute timer wheel timers at
> all, because most use cases are relative to now.
>
> But it's easy enough to provide them. All we need for that is something
> like
>
> unsigned long time_msec;
>
> which gets incremented every tick by the appropriate amount of
> milliseconds.
>
> Having that would also allow to replace all the
>
> end = jiffies + msec_to_jiffies(xxx);
>
> while (time_before(jiffies, end))
> ....
>
> constructs with a milliseconds based machinery. So we can remove all
> *_to_jiffies() interfaces over time.
A lot of those users could probably just ktime_get()/ktime_before() here,
as they would by definition not be performance critical.
I don't see a way to just tk->tkr_mono.base but with a ktime_get_coarse()
we could just return the ktime_t of the last tick and not even need a seqlock
on 64-bit architectures, or have to introduce a new API.
Arnd
Powered by blists - more mailing lists