tech-kern archive

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

Re: callout handler re-entrancy

Edgar Fuß <> wrote:
> If I install the same function on two different callouts, i.e.
>       callout_reset(&c1, n1, f, &x1);
> and
>       callout_reset(&c2, n2, f, &x2);
> does anything prevent f being called twice concurrently?

If you pass CALLOUT_MPSAFE flag, then you should assume that the function
can be called concurrently.  If not, calls are serialised under kernel lock
and it may not necessary have to be reetrant (terms and conditions apply).

> I.e., am I correct that f has to be re-entrant in this case?

Keep in mind that multi-thread safety and reentrancy are not the same.
If it has to be multi-thread safe, then it has to be reentrant (but not
necessary other way round).  In the world of mostly MP-safe kernel (which
also supports kernel preemption), the answer is "yes" to both questions.


Home | Main Index | Thread Index | Old Index