Re: [Patch][RFC] Disabling per-tgid stats on task exit in taskstats
From: jamal <hidden>
Date: 2006-07-04 19:24:43
Also in:
lkml
Shailabh, On Tue, 2006-04-07 at 12:37 -0400, Shailabh Nagar wrote: [..]
Here's a strawman for the problem we're trying to solve: get notification of the close of a NETLINK_GENERIC socket that had been used to register interest for some cpus within taskstats. From looking at the netlink code, the way to go seems to be - it maintains a pidhash of nl_pids that are currently registered to listen to atleast one cpu. It also stores the cpumask used. - taskstats registers a notifier block within netlink_chain and receives a callback on the NETLINK_URELEASE event, similar to drivers/scsci/scsi_transport_iscsi.c: iscsi_rcv_nl_event() - the callback checks to see that the protocol is NETLINK_GENERIC and that the nl_pid for the socket is in taskstat's pidhash. If so, it does a cleanup using the stored cpumask and releases the nl_pid from the pidhash.
Sound quiet reasonable. I am beginning to wonder whether we should do do the NETLINK_URELEASE in general for NETLINK_GENERIC
We can even do away with the deregister command altogether and simply rely on this autocleanup.
I think if you may still need the register if you are going to allow multiple sockets per listener process, no? The other question is how do you correlate pid -> fd? cheers, jamal