On Tue, 2006-31-01 at 07:32 +1100, Herbert Xu wrote: > On Mon, Jan 30, 2006 at 07:58:17PM +0100, Patrick McHardy wrote: > > This is the patch for checking for netlink multicast listeners. > > > > Jamal, does this fit your needs? > [..] > > > > +int netlink_has_listeners(struct sock *sk, unsigned int group) [..] > Unfortunately this is a bit too heavy weight. He needs it on the packet > rx/tx path. Perhaps RCU would help?
yes, it is a little heavyweight for the fast path to check for netlink listeners on every packet[1]. RCU approach will be an improvement but not 100% cure for the fast path. A couple of extensions i can think of: a) dont bother checking for listeners until event generation time; this reduces the calls to check but may imply we end up doing unnecessary work because the fast path will always keeps updating. OR b) a new netlink_event() callback which reports events like "first_listener_joined" or "last_listener_left". In the case of the first user one could set the variable (curently sysctl) that is checked in the fast path and when the last user leaves one could unset it. This way the fast path stays as is. #b, for lacking locks in the fast path/synchronization, will result in occasional sending an event with no listeners (when the last listener leaves) or not sending an event or two (when the first listener joins) - but this is acceptable imo and is not worse than current sysctl. Thoughts? cheers, jamal [1] Note, however, the check itself for netlink listeners as in this patch is valuable regardless of my needs. - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html