To schedule an action to happen later in a linux kernel driver I have 2 options:
add_timerqueue_delayed_work
One difference I know about: for timers you need to specify expires which is the jiffies value when the timer will expire, for delayed work you need to specify the delay of jiffies.
I’ve been reading other questions about timers and work_queue’s, and it mentions timers run outside process context. Is this different from delayed work?
Also I know there is an issue with timers, when calculating the expires, it might happen the value overflows, so the calculated value is smaller than the current jiffies and the timer expired immediately (correct me if I’m wrong here). Does delayed work suffer from the same issue? If it does, how do
To me it seems easier to use delayed work (because the work is not periodically). But what disadvantages over using timers?
EDIT
I did some further research. It seems queue_delayed_work just uses add_timer internally.
So my new question is, how do I take properly care of the jiffies overflow for timers? For example how can I set a timer/delayed_work to a 10min delay?
As I stated in my question,
queue_delayed_workjust usesadd_timerinternally. So the use is equally.