[patch 37/56] openmosix/openmosix-__kcom_task_find-spinlocks.patch
Florian Delizy <[email protected]> Thu, 02 Nov 2006 22:56:58 +0100
| Newsgroups | gmane.linux.cluster.openmosix.devel |
|---|---|
| Message-ID | <[email protected]> |
[patch 37/56] openmosix/openmosix-__kcom_task_find-spinlocks.patch fix spinlock usage This patch fixes the spinlock usage in __kcom_find_task ------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 _______________________________________________ openMosix-devel mailing list openMosix-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org https://lists.sourceforge.net/lists/listinfo/openmosix-devel
openmosix-__kcom_task_find-spinlocks.patch
(text/x-patch, 2.4 KB)
[patch @num@/@total@] @name@ fix spinlock usage
This patch fixes the spinlock usage in __kcom_find_task
Index: linux/hpc/kcom.c
===================================================================
--- linux.orig/hpc/kcom.c 2006-11-02 22:52:23.000000000 +0100
+++ linux/hpc/kcom.c 2006-11-02 22:52:30.000000000 +0100
@@ -572,17 +572,23 @@
struct kcom_task *tmp2;
task_t *p;
- // read_lock(&tasklist_lock);
+ read_lock(&tasklist_lock);
p = find_task_by_pid(pid);
- // read_unlock(&tasklist_lock);
+ read_unlock(&tasklist_lock);
if (!p) {
printk(KERN_ERR "Unable to find pid %u\n", pid);
return NULL;
}
+ // TODO: needs some cleanup (-- Florian Delizy)
if (where == 0) {
- list_for_each_entry(tmp, &kcom_nodes, list)
- list_for_each_entry(tmp2, &tmp->tasks, list)
+
+ read_lock(&kcom_nodes_lock);
+
+ list_for_each_entry(tmp, &kcom_nodes, list) {
+
+ read_lock(&tmp->tasks_lock);
+ list_for_each_entry(tmp2, &tmp->tasks, list) {
/*
* One remote node, we're interested in rpid
* One home node, we're interested in hpid
@@ -594,16 +600,42 @@
if (tmp2->hpid == pid)
return tmp2;
}
+ }
+ read_unlock(&tmp->tasks_lock);
+ }
+ read_unlock(&kcom_nodes_lock);
+
} else if (where == 1) { /* home */
- list_for_each_entry(tmp, &kcom_nodes, list)
- list_for_each_entry(tmp2, &tmp->tasks, list)
+
+ read_lock(&kcom_nodes_lock);
+ list_for_each_entry(tmp, &kcom_nodes, list) {
+
+ read_lock(&tmp->tasks_lock);
+
+ list_for_each_entry(tmp2, &tmp->tasks, list) {
if (tmp2->hpid == pid)
return tmp2;
+ }
+
+ read_unlock(&tmp->tasks_lock);
+ }
+ read_unlock(&kcom_nodes_lock);
+
} else if (where == 2) { /* remote */
- list_for_each_entry(tmp, &kcom_nodes, list)
- list_for_each_entry(tmp2, &tmp->tasks, list)
+
+ read_lock(&kcom_nodes_lock);
+ list_for_each_entry(tmp, &kcom_nodes, list) {
+
+ read_lock(&tmp->tasks_lock);
+
+ list_for_each_entry(tmp2, &tmp->tasks, list) {
if (tmp2->rpid == pid)
return tmp2;
+ }
+
+ read_unlock(&tmp->tasks_lock);
+ }
+ read_unlock(&kcom_nodes_lock);
}
return NULL;