+ task-watchers-register-profile-as-a-task-watcher.patch added to -mm tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The patch titled

     Task watchers: register profile as a task watcher

has been added to the -mm tree.  Its filename is

     task-watchers-register-profile-as-a-task-watcher.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 profile as a task watcher
From: Matt Helsley <matthltc@xxxxxxxxxx>


Modify oprofile to use the task watcher chain to watch for task exit. 
oprofile uses task exit as a point to synch buffers.

This patch does not modify oprofile to use the task free path of task
watchers.  oprofile has its own task_free atomic notifier chain.  Since its an
atomic chain we can't replace it with task watcher.  Also, it's called much
later when the actual task struct is really about to be freed.

Signed-off-by: Matt Helsley <matthltc@xxxxxxxxxx>
Cc: Philippe Elie <phil.el@xxxxxxxxxx>
Cc: <profile-list@xxxxxxxxxxxx>
Signed-off-by: Andrew Morton <akpm@xxxxxxxx>
---

 drivers/oprofile/buffer_sync.c |   11 ++++++-----
 include/linux/profile.h        |    3 +--
 kernel/exit.c                  |    1 -
 kernel/profile.c               |   14 --------------
 4 files changed, 7 insertions(+), 22 deletions(-)

diff -puN drivers/oprofile/buffer_sync.c~task-watchers-register-profile-as-a-task-watcher drivers/oprofile/buffer_sync.c
--- a/drivers/oprofile/buffer_sync.c~task-watchers-register-profile-as-a-task-watcher
+++ a/drivers/oprofile/buffer_sync.c
@@ -65,8 +65,9 @@ static int task_exit_notify(struct notif
 	/* To avoid latency problems, we only process the current CPU,
 	 * hoping that most samples for the task are on this CPU
 	 */
-	sync_buffer(raw_smp_processor_id());
-  	return 0;
+	if (get_watch_event(val) == WATCH_TASK_EXIT)
+		sync_buffer(raw_smp_processor_id());
+  	return NOTIFY_DONE;
 }
 
 
@@ -152,7 +153,7 @@ int sync_start(void)
 	err = task_handoff_register(&task_free_nb);
 	if (err)
 		goto out1;
-	err = profile_event_register(PROFILE_TASK_EXIT, &task_exit_nb);
+	err = register_task_watcher(&task_exit_nb);
 	if (err)
 		goto out2;
 	err = profile_event_register(PROFILE_MUNMAP, &munmap_nb);
@@ -167,7 +168,7 @@ out:
 out4:
 	profile_event_unregister(PROFILE_MUNMAP, &munmap_nb);
 out3:
-	profile_event_unregister(PROFILE_TASK_EXIT, &task_exit_nb);
+	unregister_task_watcher(&task_exit_nb);
 out2:
 	task_handoff_unregister(&task_free_nb);
 out1:
@@ -180,7 +181,7 @@ void sync_stop(void)
 {
 	unregister_module_notifier(&module_load_nb);
 	profile_event_unregister(PROFILE_MUNMAP, &munmap_nb);
-	profile_event_unregister(PROFILE_TASK_EXIT, &task_exit_nb);
+	unregister_task_watcher(&task_exit_nb);
 	task_handoff_unregister(&task_free_nb);
 	end_sync();
 }
diff -puN include/linux/profile.h~task-watchers-register-profile-as-a-task-watcher include/linux/profile.h
--- a/include/linux/profile.h~task-watchers-register-profile-as-a-task-watcher
+++ a/include/linux/profile.h
@@ -26,8 +26,7 @@ void create_prof_cpu_mask(struct proc_di
 #endif
 
 enum profile_type {
-	PROFILE_TASK_EXIT,
-	PROFILE_MUNMAP
+	PROFILE_MUNMAP = 1
 };
 
 #ifdef CONFIG_PROFILING
diff -puN kernel/exit.c~task-watchers-register-profile-as-a-task-watcher kernel/exit.c
--- a/kernel/exit.c~task-watchers-register-profile-as-a-task-watcher
+++ a/kernel/exit.c
@@ -849,7 +849,6 @@ fastcall NORET_TYPE void do_exit(long co
 	int group_dead;
 	int notify_result;
 
-	profile_task_exit(tsk);
 	tsk->exit_code = code;
 	notify_result = notify_watchers(WATCH_TASK_EXIT, tsk);
 
diff -puN kernel/profile.c~task-watchers-register-profile-as-a-task-watcher kernel/profile.c
--- a/kernel/profile.c~task-watchers-register-profile-as-a-task-watcher
+++ a/kernel/profile.c
@@ -87,15 +87,9 @@ void __init profile_init(void)
  
 #ifdef CONFIG_PROFILING
  
-static BLOCKING_NOTIFIER_HEAD(task_exit_notifier);
 static ATOMIC_NOTIFIER_HEAD(task_free_notifier);
 static BLOCKING_NOTIFIER_HEAD(munmap_notifier);
  
-void profile_task_exit(struct task_struct * task)
-{
-	blocking_notifier_call_chain(&task_exit_notifier, 0, task);
-}
- 
 int profile_handoff_task(struct task_struct * task)
 {
 	int ret;
@@ -123,10 +117,6 @@ int profile_event_register(enum profile_
 	int err = -EINVAL;
  
 	switch (type) {
-		case PROFILE_TASK_EXIT:
-			err = blocking_notifier_chain_register(
-					&task_exit_notifier, n);
-			break;
 		case PROFILE_MUNMAP:
 			err = blocking_notifier_chain_register(
 					&munmap_notifier, n);
@@ -142,10 +132,6 @@ int profile_event_unregister(enum profil
 	int err = -EINVAL;
  
 	switch (type) {
-		case PROFILE_TASK_EXIT:
-			err = blocking_notifier_chain_unregister(
-					&task_exit_notifier, n);
-			break;
 		case PROFILE_MUNMAP:
 			err = blocking_notifier_chain_unregister(
 					&munmap_notifier, n);
_

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

[Index of Archives]     [Kernel Newbies FAQ]     [Kernel Archive]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Photo]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]

  Powered by Linux