The patch titled Task watchers: register per-task delay accounting task watcher has been added to the -mm tree. Its filename is task-watchers-register-per-task-delay-accounting.patch See http://www.zip.com.au/~akpm/linux/patches/stuff/added-to-mm.txt to find out what to do about this ------------------------------------------------------ Subject: Task watchers: register per-task delay accounting task watcher From: Matt Helsley <matthltc@xxxxxxxxxx> Adapts delayacct to use Task Watchers. Does not adapt taskstats to use Task Watchers. Signed-off-by: Matt Helsley <matthltc@xxxxxxxxxx> Cc: Shailabh Nagar <nagar@xxxxxxxxxxxxxx> Cc: Balbir Singh <balbir@xxxxxxxxxx> Cc: Chandra S. Seetharaman <sekharan@xxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxx> --- include/linux/delayacct.h | 2 +- kernel/delayacct.c | 23 +++++++++++++++++++++++ kernel/exit.c | 2 -- kernel/fork.c | 2 -- 4 files changed, 24 insertions(+), 5 deletions(-) diff -puN include/linux/delayacct.h~task-watchers-register-per-task-delay-accounting include/linux/delayacct.h --- a/include/linux/delayacct.h~task-watchers-register-per-task-delay-accounting +++ a/include/linux/delayacct.h @@ -61,7 +61,7 @@ static inline void delayacct_tsk_init(st static inline void delayacct_tsk_exit(struct task_struct *tsk) { - if (tsk->delays) + if (unlikely(tsk->delays)) __delayacct_tsk_exit(tsk); } diff -puN kernel/delayacct.c~task-watchers-register-per-task-delay-accounting kernel/delayacct.c --- a/kernel/delayacct.c~task-watchers-register-per-task-delay-accounting +++ a/kernel/delayacct.c @@ -18,6 +18,7 @@ #include <linux/time.h> #include <linux/sysctl.h> #include <linux/delayacct.h> +#include <linux/notifier.h> int delayacct_on __read_mostly; /* Delay accounting turned on/off */ kmem_cache_t *delayacct_cache; @@ -29,6 +30,27 @@ static int __init delayacct_setup_enable } __setup("delayacct", delayacct_setup_enable); +static int delayacct_watch_task(struct notifier_block *nb, unsigned long val, + void *t) +{ + struct task_struct *tsk = t; + switch(get_watch_event(val)) { + case WATCH_TASK_CLONE: + delayacct_tsk_init(tsk); + break; + case WATCH_TASK_FREE: + delayacct_tsk_exit(tsk); + break; + default: + return NOTIFY_DONE; + } + return NOTIFY_OK; +} + +static struct notifier_block __read_mostly delayacct_nb = { + .notifier_call = delayacct_watch_task, +}; + void delayacct_init(void) { delayacct_cache = kmem_cache_create("delayacct_cache", @@ -36,6 +58,7 @@ void delayacct_init(void) 0, SLAB_PANIC, NULL, NULL); + register_task_watcher(&delayacct_nb); delayacct_tsk_init(&init_task); } diff -puN kernel/exit.c~task-watchers-register-per-task-delay-accounting kernel/exit.c --- a/kernel/exit.c~task-watchers-register-per-task-delay-accounting +++ a/kernel/exit.c @@ -28,7 +28,6 @@ #include <linux/proc_fs.h> #include <linux/mempolicy.h> #include <linux/taskstats_kern.h> -#include <linux/delayacct.h> #include <linux/cpuset.h> #include <linux/syscalls.h> #include <linux/signal.h> @@ -910,7 +909,6 @@ fastcall NORET_TYPE void do_exit(long co tsk->exit_code = code; taskstats_exit_send(tsk, tidstats, tgidstats); taskstats_exit_free(tidstats, tgidstats); - delayacct_tsk_exit(tsk); notify_result = notify_watchers(WATCH_TASK_FREE, tsk); WARN_ON(notify_result & NOTIFY_STOP_MASK); diff -puN kernel/fork.c~task-watchers-register-per-task-delay-accounting kernel/fork.c --- a/kernel/fork.c~task-watchers-register-per-task-delay-accounting +++ a/kernel/fork.c @@ -43,7 +43,6 @@ #include <linux/profile.h> #include <linux/rmap.h> #include <linux/acct.h> -#include <linux/delayacct.h> #include <linux/notifier.h> #include <asm/pgtable.h> @@ -1001,7 +1000,6 @@ static task_t *copy_process(unsigned lon goto bad_fork_cleanup_put_domain; p->did_exec = 0; - delayacct_tsk_init(p); /* Must remain after dup_task_struct() */ copy_flags(clone_flags, p); p->pid = pid; retval = -EFAULT; _ Patches currently in -mm which might be from matthltc@xxxxxxxxxx are process-events-header-cleanup.patch process-events-license-change.patch remove-unecessary-null-check-in-kernel-acctc.patch mark-profile-notifier-blocks-__read_mostly.patch task-watchers-task-watchers.patch task-watchers-task-watchers-tidy.patch task-watchers-register-process-events-task-watcher.patch task-watchers-refactor-process-events.patch task-watchers-make-process-events-configurable-as.patch task-watchers-allow-task-watchers-to-block.patch task-watchers-register-audit-task-watcher.patch task-watchers-register-per-task-delay-accounting.patch task-watchers-register-profile-as-a-task-watcher.patch task-watchers-add-support-for-per-task-watchers.patch task-watchers-register-semundo-task-watcher.patch task-watchers-register-per-task-semundo-watcher.patch ipc-replace-kmalloc-and-memset-in-get_undo_list-with-kzalloc.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