summaryrefslogtreecommitdiffstats
path: root/runtime/map.c
diff options
context:
space:
mode:
authorfche <fche>2007-05-29 19:24:36 +0000
committerfche <fche>2007-05-29 19:24:36 +0000
commit4d88dfc7abf9e2b566136037bc405942c35a452c (patch)
tree790190438f59d0f0cf1f7ed832c8ae113e90b9cf /runtime/map.c
parent888af770ba125802efa0f9209064be7b5d000f87 (diff)
downloadsystemtap-steved-4d88dfc7abf9e2b566136037bc405942c35a452c.tar.gz
systemtap-steved-4d88dfc7abf9e2b566136037bc405942c35a452c.tar.xz
systemtap-steved-4d88dfc7abf9e2b566136037bc405942c35a452c.zip
2007-05-29 Frank Ch. Eigler <fche@redhat.com>
PR 2224 * map.h (NEED_MAP_LOCKS): New config macro, defaults to 0. (MAP_GET_CPU, MAP_PUT_CPU): Wrappers, default to ~no-op. * map.c (_stp_pmap_clear,agg): Use them. * pmap-gen.c (_stp_pmap_new,set,add,get_cpu,get,del): Ditto.
Diffstat (limited to 'runtime/map.c')
-rw-r--r--runtime/map.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/runtime/map.c b/runtime/map.c
index e4235901..2acf2fe2 100644
--- a/runtime/map.c
+++ b/runtime/map.c
@@ -369,9 +369,13 @@ void _stp_pmap_clear(PMAP pmap)
for_each_cpu(i) {
MAP m = per_cpu_ptr (pmap->map, i);
+#if NEED_MAP_LOCKS
spin_lock(&m->lock);
+#endif
_stp_map_clear(m);
+#if NEED_MAP_LOCKS
spin_unlock(&m->lock);
+#endif
}
_stp_map_clear(&pmap->agg);
}
@@ -873,7 +877,9 @@ MAP _stp_pmap_agg (PMAP pmap)
for_each_cpu(i) {
m = per_cpu_ptr (pmap->map, i);
+#if NEED_MAP_LOCKS
spin_lock(&m->lock);
+#endif
/* walk the hash chains. */
for (hash = 0; hash < HASH_TABLE_SIZE; hash++) {
head = &m->hashes[hash];
@@ -892,13 +898,17 @@ MAP _stp_pmap_agg (PMAP pmap)
_stp_add_agg(aptr, ptr);
else {
if (!_stp_new_agg(agg, ahead, ptr)) {
+#if NEED_MAP_LOCKS
spin_unlock(&m->lock);
+#endif
return NULL;
}
}
}
}
+#if NEED_MAP_LOCKS
spin_unlock(&m->lock);
+#endif
}
return agg;
}