projects
/
powerpc.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
sky2: better power state management
[powerpc.git]
/
drivers
/
oprofile
/
buffer_sync.c
diff --git
a/drivers/oprofile/buffer_sync.c
b/drivers/oprofile/buffer_sync.c
index
531b073
..
78c2e6e
100644
(file)
--- a/
drivers/oprofile/buffer_sync.c
+++ b/
drivers/oprofile/buffer_sync.c
@@
-43,13
+43,16
@@
static void process_task_mortuary(void);
* list for processing. Only after two full buffer syncs
* does the task eventually get freed, because by then
* we are sure we will not reference it again.
* list for processing. Only after two full buffer syncs
* does the task eventually get freed, because by then
* we are sure we will not reference it again.
+ * Can be invoked from softirq via RCU callback due to
+ * call_rcu() of the task struct, hence the _irqsave.
*/
static int task_free_notify(struct notifier_block * self, unsigned long val, void * data)
{
*/
static int task_free_notify(struct notifier_block * self, unsigned long val, void * data)
{
+ unsigned long flags;
struct task_struct * task = data;
struct task_struct * task = data;
- spin_lock
(&task_mortuary
);
+ spin_lock
_irqsave(&task_mortuary, flags
);
list_add(&task->tasks, &dying_tasks);
list_add(&task->tasks, &dying_tasks);
- spin_unlock
(&task_mortuary
);
+ spin_unlock
_irqrestore(&task_mortuary, flags
);
return NOTIFY_OK;
}
return NOTIFY_OK;
}
@@
-105,10
+108,10
@@
static int module_load_notify(struct notifier_block * self, unsigned long val, v
return 0;
/* FIXME: should we process all CPU buffers ? */
return 0;
/* FIXME: should we process all CPU buffers ? */
-
down(&buffer_sem
);
+
mutex_lock(&buffer_mutex
);
add_event_entry(ESCAPE_CODE);
add_event_entry(MODULE_LOADED_CODE);
add_event_entry(ESCAPE_CODE);
add_event_entry(MODULE_LOADED_CODE);
-
up(&buffer_sem
);
+
mutex_unlock(&buffer_mutex
);
#endif
return 0;
}
#endif
return 0;
}
@@
-217,8
+220,8
@@
static unsigned long get_exec_dcookie(struct mm_struct * mm)
continue;
if (!(vma->vm_flags & VM_EXECUTABLE))
continue;
continue;
if (!(vma->vm_flags & VM_EXECUTABLE))
continue;
- cookie = fast_get_dcookie(vma->vm_file->f_dentry,
- vma->vm_file->f_
vfs
mnt);
+ cookie = fast_get_dcookie(vma->vm_file->f_
path.
dentry,
+ vma->vm_file->f_
path.
mnt);
break;
}
break;
}
@@
-243,8
+246,8
@@
static unsigned long lookup_dcookie(struct mm_struct * mm, unsigned long addr, o
continue;
if (vma->vm_file) {
continue;
if (vma->vm_file) {
- cookie = fast_get_dcookie(vma->vm_file->f_dentry,
- vma->vm_file->f_
vfs
mnt);
+ cookie = fast_get_dcookie(vma->vm_file->f_
path.
dentry,
+ vma->vm_file->f_
path.
mnt);
*offset = (vma->vm_pgoff << PAGE_SHIFT) + addr -
vma->vm_start;
} else {
*offset = (vma->vm_pgoff << PAGE_SHIFT) + addr -
vma->vm_start;
} else {
@@
-431,25
+434,22
@@
static void increment_tail(struct oprofile_cpu_buffer * b)
*/
static void process_task_mortuary(void)
{
*/
static void process_task_mortuary(void)
{
-
struct list_head * po
s;
-
struct list_head * pos2
;
+
unsigned long flag
s;
+
LIST_HEAD(local_dead_tasks)
;
struct task_struct * task;
struct task_struct * task;
+ struct task_struct * ttask;
- spin_lock
(&task_mortuary
);
+ spin_lock
_irqsave(&task_mortuary, flags
);
- list_for_each_safe(pos, pos2, &dead_tasks) {
- task = list_entry(pos, struct task_struct, tasks);
- list_del(&task->tasks);
- free_task(task);
- }
+ list_splice_init(&dead_tasks, &local_dead_tasks);
+ list_splice_init(&dying_tasks, &dead_tasks);
- list_for_each_safe(pos, pos2, &dying_tasks) {
- task = list_entry(pos, struct task_struct, tasks);
+ spin_unlock_irqrestore(&task_mortuary, flags);
+
+ list_for_each_entry_safe(task, ttask, &local_dead_tasks, tasks) {
list_del(&task->tasks);
list_del(&task->tasks);
-
list_add_tail(&task->tasks, &dead_tasks
);
+
free_task(task
);
}
}
-
- spin_unlock(&task_mortuary);
}
}
@@
-501,7
+501,7
@@
void sync_buffer(int cpu)
sync_buffer_state state = sb_buffer_start;
unsigned long available;
sync_buffer_state state = sb_buffer_start;
unsigned long available;
-
down(&buffer_sem
);
+
mutex_lock(&buffer_mutex
);
add_cpu_switch(cpu);
add_cpu_switch(cpu);
@@
-550,5
+550,5
@@
void sync_buffer(int cpu)
mark_done(cpu);
mark_done(cpu);
-
up(&buffer_sem
);
+
mutex_unlock(&buffer_mutex
);
}
}