> I don't think the module-unloading case is so special.

It is, because there is nothing else you can do about that case yourself.
For managing your own data structures, your callbacks can use e.g.:

        rcu_read_lock();
        ptr = rcu_dereference(engine->data);
        if (!ptr) punt;
        ... use ptr, or do your own locking/refcount here ...
        rcu_read_unlock();

It's not very hard to write the callbacks and your tear-down code so that a
stray callback during tear-down bails out harmlessly.  In a permanently
loaded module, you can do things this way and have purely nonblocking
detach/tear-down of sessions.  If you want to take this care in your data
structure handling, then you don't have to pay any synchronization cost in
the event hot paths and shouldn't be made to.


Thanks,
Roland

Reply via email to