On Mon, Nov 21 2022 at 15:43, Steven Rostedt wrote: > On Tue, 15 Nov 2022 21:28:43 +0100 (CET) > Thomas Gleixner <tglx@xxxxxxxxxxxxx> wrote: >> EXPORT_SYMBOL(mod_timer_pending); >> >> /** >> - * mod_timer - modify a timer's timeout >> - * @timer: the timer to be modified >> - * @expires: new timeout in jiffies >> + * mod_timer - Modify a timer's timeout >> + * @timer: The timer to be modified >> + * @expires: New timeout in jiffies >> * >> * mod_timer() is a more efficient way to update the expire field of an > > BTW, one can ask, "more efficient" than what? > > If you are updating this, perhaps swap it around a little. > > * mod_timer(timer, expires) is equivalent to: > * > * del_timer(timer); timer->expires = expires; add_timer(timer); > * > * mod_timer() is a more efficient way to update the expire field of an > * active timer (if the timer is inactive it will be activated) > * > > As seeing the equivalent first and then seeing "more efficient" makes a bit > more sense. Point taken. >> * >> - * The timer's ->expires, ->function fields must be set prior calling this >> - * function. >> + * The @timer->expires and @timer->function fields must be set prior >> + * calling this function. > > "set prior to calling this function" Fixed. >> * >> - * The function returns whether it has deactivated a pending timer or not. >> - * (ie. del_timer() of an inactive timer returns 0, del_timer() of an >> - * active timer returns 1.) >> + * Contrary to del_timer_sync() this function does not wait for an >> + * eventually running timer callback on a different CPU and it neither > > I'm a little confused with the "eventually running timer". Does that simply > mean one that is about to run next (that is, it doesn't handle race > conditions and the timer is in the process of starting), but will still > deactivate one that has not been started and the timer code for that CPU > hasn't triggered yet? Let me try again. The function only deactivates a pending timer, but contrary to del_timer_sync() it does not take into account whether the timers callback function is concurrently executed on a different CPU or not. Does that make more sense? >> + * prevents rearming of the timer. If @timer can be rearmed concurrently >> + * then the return value of this function is meaningless. >> + * >> + * Return: >> + * * %0 - The timer was not pending >> + * * %1 - The timer was pending and deactivated >> */ >> int del_timer(struct timer_list *timer) >> { >> @@ -1270,10 +1284,16 @@ EXPORT_SYMBOL(del_timer); >> >> /** >> * try_to_del_timer_sync - Try to deactivate a timer >> - * @timer: timer to delete >> + * @timer: Timer to deactivate >> * >> - * This function tries to deactivate a timer. Upon successful (ret >= 0) >> - * exit the timer is not queued and the handler is not running on any CPU. >> + * This function cannot guarantee that the timer cannot be rearmed right >> + * after dropping the base lock. That needs to be prevented by the calling >> + * code if necessary. > > > Hmm, you seemed to have deleted the description of what the function does > and replaced it with only what it cannot do. Ooops.