lkml.org 
[lkml]   [2022]   [Apr]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [RFC][PATCH] timers: Add del_time_free() to be called before freeing timers
    On Fri, 08 Apr 2022 12:37:40 +0200
    Thomas Gleixner <tglx@linutronix.de> wrote:

    > +++ b/include/linux/timer.h
    > @@ -183,12 +183,17 @@ extern int timer_reduce(struct timer_lis
    > extern void add_timer(struct timer_list *timer);
    >
    > extern int try_to_del_timer_sync(struct timer_list *timer);
    > +extern int __del_timer_sync(struct timer_list *timer, bool free);

    Do we really want to expose this to all the kernel?

    That is, we do not need to make the static inlines in the header, but
    instead do the split in the timer.c file. Not to mention, why have the
    "free" parameter be created by the callers? It duplicates the work of
    updating the second parameter around the kernel, instead of just in one
    place.

    One concern I have is that I wanted to keep the "free" version right next
    to the del_timer() prototype. That way it becomes more visible to users and
    they will be more likely to see it. I'm wondering if some of the issue
    with not using del_timer_sync() is because it is not next to the other
    prototypes, and people may have missed it.

    >
    > -#if defined(CONFIG_SMP) || defined(CONFIG_PREEMPT_RT)

    Is the above not important for del_timer_sync() anymore?

    Can we just have a del_timer_sync() prototype and not have this macro logic
    anymore?

    Anyway, I'll take this code and make my updates and send out a v2.

    Thanks,

    -- Steve

    > - extern int del_timer_sync(struct timer_list *timer);
    > -#else
    > -# define del_timer_sync(t) del_timer(t)
    > -#endif
    > +static inline int del_timer_sync(struct timer_list *timer)
    > +{
    > + return __del_timer_sync(timer, false);
    > +}
    > +
    > +static inline int del_timer_sync_free(struct timer_list *timer)
    > +{
    > + return __del_timer_sync(timer, true);
    > +}
    >
    > #define del_singleshot_timer_sync(t) del_timer_sync(t)

    \
     
     \ /
      Last update: 2022-04-08 17:56    [W:3.220 / U:0.660 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site