tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Let callout_reset return if it reschedules a pending callout



On Thu, Mar 01, 2018 at 01:58:29AM +0900, Ryota Ozaki wrote:
> On Wed, Feb 28, 2018 at 10:11 PM, Joerg Sonnenberger <joerg%bec.de@localhost> wrote:
> > On Wed, Feb 28, 2018 at 05:47:13PM +0900, Ryota Ozaki wrote:
> >> The feature is useful when you have a reference to an object that is
> >> passed to a callout. In this case you need to take care of a
> >> reference leak on callout_reset (and other APIs); it silently
> >> reschedules (IOW cancels) a pending callout and leaks a reference.
> >> Unfortunately callout_reset doesn't tell us the reschedule.
> >
> > Can we look at this part first before discussing any API changes?
> > Why can't you store the reference next to callout instance itself?
> 
> Oh, my explanation was quite confusing... I meant that the object
> has a reference counter and the counter is incremented to indicate
> that it is referred by a callout. obj_ref and obj_unref can be
> thought as obj->refcnt++ and obj->refcnt-- respectively.

Just consider the object reference owned by the callout struct. You
change the reference count when the callout is destroyed or if the
callout is reassigned, not because it is executed.

Joerg


Home | Main Index | Thread Index | Old Index