Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1642808
| From | Arnd Bergmann <arnd@arndb.de> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: RFC: better timer interface |
| Date | 2017-05-16 22:30 +0200 |
| Message-ID | <tHRgu-1Pj-13@gated-at.bofh.it> (permalink) |
| References | <tHJ9f-56f-3@gated-at.bofh.it> <tHMTw-7r2-11@gated-at.bofh.it> <tHN3c-7uo-21@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Tue, May 16, 2017 at 5:51 PM, Christoph Hellwig <hch@lst.de> wrote:
> On Tue, May 16, 2017 at 05:45:07PM +0200, Arnd Bergmann wrote:
>> This looks really nice, but what is the long-term plan for the interface?
>> Do you expect that we will eventually change all 700+ users of timer_list
>> to the new type, or do we keep both variants around indefinitely to avoid
>> having to do mass-conversions?
>
> I think we should eventually move everyone over, but it might take
> some time.
Ok.
>> If we are going to touch them all in the end, we might want to think
>> about other changes that could be useful here. The main one I have
>> in mind would be moving away from 'jiffies + timeout' as the interface,
>> and instead passing a relative number of milliseconds (or seconds)
>> into a mod_timer() variant. This is what most drivers want anyway,
>> and if we have both changes (callback argument and expiration
>> time) in place, we modernize the API one driver at a time with both
>> changes at once.
>
> 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);
The first is slightly shorter but conflicts with three files that use
the same name for a local function name. The third one fits
well with the existing interfaces and provides both millisecond
and second versions, I'd probably go with that.
We could consider even passing a default interval as another
argument to prepare_timer(), and using that in add_timer(),
but that would in those cases that have a constant interval
(maybe about half of the users from) and would be a bit surprising
to readers that are only familiar with the existing interfaces.
One final option would be a larger-scale replacement of
the API by mirroring the hrtimer style where possible while
staying compatible with the existing calls, e.g. timer_prepare(),
timer_add_expires(), timer_start(), ...
Arnd
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
RFC: better timer interface Christoph Hellwig <hch@lst.de> - 2017-05-16 13:50 +0200
[PATCH 3/9] kthread: remove unused macros Christoph Hellwig <hch@lst.de> - 2017-05-16 13:50 +0200
Re: [PATCH 3/9] kthread: remove unused macros Petr Mladek <pmladek@suse.com> - 2017-05-17 14:20 +0200
Re: [PATCH 3/9] kthread: remove unused macros Christoph Hellwig <hch@lst.de> - 2017-05-18 10:30 +0200
[PATCH 8/9] tlclk: switch switchover_timer to a modern timer Christoph Hellwig <hch@lst.de> - 2017-05-16 13:50 +0200
[PATCH 6/9] s390: switch topology_timer to a modern timer Christoph Hellwig <hch@lst.de> - 2017-05-16 13:50 +0200
[PATCH 4/9] workqueue: switch to modern timers Christoph Hellwig <hch@lst.de> - 2017-05-16 13:50 +0200
[PATCH 7/9] s390: switch lgr timer to a modern timer Christoph Hellwig <hch@lst.de> - 2017-05-16 13:50 +0200
[PATCH 9/9] timers: remove old timer initialization macros Christoph Hellwig <hch@lst.de> - 2017-05-16 13:50 +0200
Re: [PATCH 9/9] timers: remove old timer initialization macros Arnd Bergmann <arnd@arndb.de> - 2017-05-16 21:50 +0200
Re: [PATCH 9/9] timers: remove old timer initialization macros Christoph Hellwig <hch@lst.de> - 2017-05-18 10:30 +0200
[PATCH 2/9] timers: provide a "modern" variant of timers Christoph Hellwig <hch@lst.de> - 2017-05-16 14:00 +0200
Re: [PATCH 2/9] timers: provide a "modern" variant of timers Randy Dunlap <rdunlap@infradead.org> - 2017-05-16 21:30 +0200
Re: [PATCH 2/9] timers: provide a "modern" variant of timers Arnd Bergmann <arnd@arndb.de> - 2017-05-16 22:10 +0200
Re: [PATCH 2/9] timers: provide a "modern" variant of timers Christoph Hellwig <hch@lst.de> - 2017-05-18 10:30 +0200
Re: [PATCH 2/9] timers: provide a "modern" variant of timers Christoph Hellwig <hch@lst.de> - 2017-05-18 10:50 +0200
Re: [PATCH 2/9] timers: provide a "modern" variant of timers Arnd Bergmann <arnd@arndb.de> - 2017-05-18 11:00 +0200
Re: [PATCH 2/9] timers: provide a "modern" variant of timers Christoph Hellwig <hch@lst.de> - 2017-05-21 09:10 +0200
Re: [PATCH 2/9] timers: provide a "modern" variant of timers Arnd Bergmann <arnd@arndb.de> - 2017-05-21 14:30 +0200
Re: [PATCH 2/9] timers: provide a "modern" variant of timers Thomas Gleixner <tglx@linutronix.de> - 2017-05-21 20:00 +0200
Re: [PATCH 2/9] timers: provide a "modern" variant of timers Al Viro <viro@ZenIV.linux.org.uk> - 2017-05-21 20:30 +0200
RE: [PATCH 2/9] timers: provide a "modern" variant of timers David Laight <David.Laight@ACULAB.COM> - 2017-05-19 12:50 +0200
Re: [PATCH 2/9] timers: provide a "modern" variant of timers 'Christoph Hellwig' <hch@lst.de> - 2017-05-21 09:00 +0200
[PATCH 5/9] powerpc/numa: switch topology_timer to modern timer Christoph Hellwig <hch@lst.de> - 2017-05-16 14:00 +0200
Re: RFC: better timer interface Arnd Bergmann <arnd@arndb.de> - 2017-05-16 17:50 +0200
Re: RFC: better timer interface Christoph Hellwig <hch@lst.de> - 2017-05-16 18:00 +0200
Re: RFC: better timer interface Arnd Bergmann <arnd@arndb.de> - 2017-05-16 22:30 +0200
Re: RFC: better timer interface Christoph Hellwig <hch@lst.de> - 2017-05-18 10:30 +0200
Re: RFC: better timer interface Thomas Gleixner <tglx@linutronix.de> - 2017-05-21 19:20 +0200
Re: RFC: better timer interface Thomas Gleixner <tglx@linutronix.de> - 2017-05-21 20:20 +0200
Re: RFC: better timer interface Arnd Bergmann <arnd@arndb.de> - 2017-05-22 13:30 +0200
Re: RFC: better timer interface Thomas Gleixner <tglx@linutronix.de> - 2017-05-22 21:30 +0200
RE: RFC: better timer interface David Laight <David.Laight@ACULAB.COM> - 2017-05-23 13:40 +0200
RE: RFC: better timer interface Thomas Gleixner <tglx@linutronix.de> - 2017-05-23 14:00 +0200
RE: RFC: better timer interface David Laight <David.Laight@ACULAB.COM> - 2017-05-23 15:00 +0200
RE: RFC: better timer interface Thomas Gleixner <tglx@linutronix.de> - 2017-05-23 15:10 +0200
Re: RFC: better timer interface Arnd Bergmann <arnd@arndb.de> - 2017-05-22 15:40 +0200
Re: RFC: better timer interface Thomas Gleixner <tglx@linutronix.de> - 2017-05-22 21:20 +0200
csiph-web