On 19 Aug 2013, at 14:21, Paolo Bonzini wrote: > I like Stefan's patches to make the timer list thread-safe, especially > if we can optimize it (with RCU?) to make the read side lockless.
We will have to be careful on the write side. I'm trying to work out just how slow this would with Paolo's RCU patches. If call_rcu is used (or synchronize_rcu after the entire list has been traversed, all timers updated etc), how bad is it? There is a particular concern for for repeating timers where two writes are done (firstly to remove the timer from the list, then next inside the timer routine to add it back to the list). As timers are only called by a single thread, it might be worth having some form of timer API which specifies a timer should be called every X nano/micro/milli/seconds, or just once in X nano/micro/milli/seconds time, which would save the inevitable call to read the clock value first, and would speed things up if write locking was slow. -- Alex Bligh