Commit 5e9a1167 authored by John Levon's avatar John Levon Committed by Linus Torvalds

[PATCH] OProfile: thread switching performance fix

Avoid the linear list walk of get_exec_dcookie() when we've switched to a task
using the same mm.
parent 438612ea
...@@ -425,7 +425,7 @@ static void sync_buffer(struct oprofile_cpu_buffer * cpu_buf) ...@@ -425,7 +425,7 @@ static void sync_buffer(struct oprofile_cpu_buffer * cpu_buf)
{ {
struct mm_struct * mm = 0; struct mm_struct * mm = 0;
struct task_struct * new; struct task_struct * new;
unsigned long cookie; unsigned long cookie = 0;
int in_kernel = 1; int in_kernel = 1;
unsigned int i; unsigned int i;
...@@ -442,12 +442,14 @@ static void sync_buffer(struct oprofile_cpu_buffer * cpu_buf) ...@@ -442,12 +442,14 @@ static void sync_buffer(struct oprofile_cpu_buffer * cpu_buf)
in_kernel = s->event; in_kernel = s->event;
add_kernel_ctx_switch(s->event); add_kernel_ctx_switch(s->event);
} else { } else {
struct mm_struct * oldmm = mm;
/* userspace context switch */ /* userspace context switch */
new = (struct task_struct *)s->event; new = (struct task_struct *)s->event;
release_mm(mm); release_mm(oldmm);
mm = take_tasks_mm(new); mm = take_tasks_mm(new);
if (mm != oldmm)
cookie = get_exec_dcookie(mm); cookie = get_exec_dcookie(mm);
add_user_ctx_switch(new, cookie); add_user_ctx_switch(new, cookie);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment