The patch titled per-task delay accounting: avoid send without listeners has been added to the -mm tree. Its filename is per-task-delay-accounting-avoid-send-without-listeners.patch See http://www.zip.com.au/~akpm/linux/patches/stuff/added-to-mm.txt to find out what to do about this ------------------------------------------------------ Subject: per-task delay accounting: avoid send without listeners From: Shailabh Nagar <nagar@xxxxxxxxxxxxxx> Don't send taskstats (per-pid or per-tgid) on thread exit when no one is listening for such data. Currently the taskstats interface allocates a structure, fills it in and calls netlink to send out per-pid and per-tgid stats regardless of whether a userspace listener for the data exists (netlink layer would check for that and avoid the multicast). As a result of this patch, the check for the no-listener case is performed early, avoiding the redundant allocation and filling up of the taskstats structures. Signed-off-by: Balbir Singh <balbir@xxxxxxxxxx> Signed-off-by: Shailabh Nagar <nagar@xxxxxxxxxxxxxx> Cc: Jay Lan <jlan@xxxxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxx> --- include/linux/taskstats_kern.h | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff -puN include/linux/taskstats_kern.h~per-task-delay-accounting-avoid-send-without-listeners include/linux/taskstats_kern.h --- a/include/linux/taskstats_kern.h~per-task-delay-accounting-avoid-send-without-listeners +++ a/include/linux/taskstats_kern.h @@ -9,6 +9,7 @@ #include <linux/taskstats.h> #include <linux/sched.h> +#include <net/genetlink.h> enum { TASKSTATS_MSG_UNICAST, /* send data only to requester */ @@ -19,9 +20,19 @@ enum { extern kmem_cache_t *taskstats_cache; extern struct mutex taskstats_exit_mutex; +static inline int taskstats_has_listeners(void) +{ + if (!genl_sock) + return 0; + return netlink_has_listeners(genl_sock, TASKSTATS_LISTEN_GROUP); +} + + static inline void taskstats_exit_alloc(struct taskstats **ptidstats) { - *ptidstats = kmem_cache_zalloc(taskstats_cache, SLAB_KERNEL); + *ptidstats = NULL; + if (taskstats_has_listeners()) + *ptidstats = kmem_cache_zalloc(taskstats_cache, SLAB_KERNEL); } static inline void taskstats_exit_free(struct taskstats *tidstats) _ Patches currently in -mm which might be from nagar@xxxxxxxxxxxxxx are per-task-delay-accounting-setup.patch per-task-delay-accounting-setup-fix-1.patch per-task-delay-accounting-setup-fix-2.patch per-task-delay-accounting-sync-block-i-o-and-swapin-delay-collection.patch per-task-delay-accounting-sync-block-i-o-and-swapin-delay-collection-fix-1.patch per-task-delay-accounting-cpu-delay-collection-via-schedstats.patch per-task-delay-accounting-cpu-delay-collection-via-schedstats-fix-1.patch per-task-delay-accounting-utilities-for-genetlink-usage.patch per-task-delay-accounting-taskstats-interface-fix-1.patch per-task-delay-accounting-documentation.patch per-task-delay-accounting-proc-export-of-aggregated-block-i-o-delays.patch per-task-delay-accounting-proc-export-of-aggregated-block-i-o-delays-warning-fix.patch delay-accounting-taskstats-interface-send-tgid-once.patch delay-accounting-taskstats-interface-send-tgid-once-fixes.patch per-task-delay-accounting-avoid-send-without-listeners.patch task-watchers-register-per-task-delay-accounting.patch - To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html