Thread (49 messages) 49 messages, 9 authors, 2016-01-14

Re: [PATCH v3 01/22] timer: Allow to check when the timer callback has not finished yet

From: Thomas Gleixner <hidden>
Date: 2015-11-18 22:33:35
Also in: linux-mm, lkml

On Wed, 18 Nov 2015, Petr Mladek wrote:
timer_pending() checks whether the list of callbacks is empty.
Each callback is removed from the list before it is called,
see call_timer_fn() in __run_timers().

Sometimes we need to make sure that the callback has finished.
For example, if we want to free some resources that are accessed
by the callback.

For this purpose, this patch adds timer_active(). It checks both
the list of callbacks and the running_timer. It takes the base_lock
to see a consistent state.

I plan to use it to implement delayed works in kthread worker.
But I guess that it will have wider use. In fact, I wonder if
timer_pending() is misused in some situations.
Well. That's nice and good. But how will that new function solve
anything? After you drop the lock the state is not longer valid.
 
Thanks,

	tglx

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help