[IMPROVE] add spinlock proc_lock
authorVyacheslav Cherkashin <v.cherkashin@samsung.com>
Mon, 30 Sep 2013 10:26:02 +0000 (14:26 +0400)
committerVyacheslav Cherkashin <v.cherkashin@samsung.com>
Mon, 30 Sep 2013 10:59:34 +0000 (14:59 +0400)
to sync with on_each_proc()

Change-Id: I94a6fa84b7661056294e9d4da1a43117a72587e7
Signed-off-by: Vyacheslav Cherkashin <v.cherkashin@samsung.com>
us_manager/sspt/sspt_proc.c

index 2207805..fe08406 100644 (file)
@@ -56,6 +56,7 @@
        }
 
 static LIST_HEAD(proc_probes_list);
+static DEFINE_SPINLOCK(proc_lock);
 
 struct sspt_proc *sspt_proc_create(struct task_struct *task, void *priv)
 {
@@ -87,7 +88,9 @@ void sspt_proc_free(struct sspt_proc *proc)
        struct sspt_file *file, *n;
 
        /* delete from list */
+       spin_lock(&proc_lock);
        list_del(&proc->list);
+       spin_unlock(&proc_lock);
 
        list_for_each_entry_safe(file, n, &proc->file_list, list) {
                list_del(&file->list);
@@ -116,9 +119,11 @@ void on_each_proc(void (*func)(struct sspt_proc *, void *), void *data)
 {
        struct sspt_proc *proc, *tmp;
 
+       spin_lock(&proc_lock);
        list_for_each_entry_safe(proc, tmp, &proc_probes_list, list) {
                func(proc, data);
        }
+       spin_unlock(&proc_lock);
 }
 
 struct sspt_proc *sspt_proc_get_by_task_or_new(struct task_struct *task,