summaryrefslogtreecommitdiffstats
path: root/runtime/map.c
diff options
context:
space:
mode:
authorhunt <hunt>2005-12-14 21:06:57 +0000
committerhunt <hunt>2005-12-14 21:06:57 +0000
commitc5a2dde1672adc9e326fda6533e9dd90f69dc2f1 (patch)
tree69db3e637edec2e4ffcc1aec241e4cd53be4e50b /runtime/map.c
parent51566dc440ab46954f4bfc96048ca1576867297d (diff)
downloadsystemtap-steved-c5a2dde1672adc9e326fda6533e9dd90f69dc2f1.tar.gz
systemtap-steved-c5a2dde1672adc9e326fda6533e9dd90f69dc2f1.tar.xz
systemtap-steved-c5a2dde1672adc9e326fda6533e9dd90f69dc2f1.zip
2005-12-14 Martin Hunt <hunt@redhat.com>
* pmap-gen.c (_stp_pmap_new_*): Initialize lock. (_stp_pmap_set_*): Lock map while in use. (_stp_pmap_add_*): Lock map while in use. (_stp_pmap_get_cpu): Ditto. (_stp_pmap_get): Lock each per-cpu map. * map-gen.c: Define and use NULLRET for a NULL return value. * map.c (_stp_pmap_clear): New function. (_stp_pmap_agg): Lock each per-cpu map as it gets aggregated.
Diffstat (limited to 'runtime/map.c')
-rw-r--r--runtime/map.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/runtime/map.c b/runtime/map.c
index 1fa4a0e5..1d6d084e 100644
--- a/runtime/map.c
+++ b/runtime/map.c
@@ -355,6 +355,21 @@ void _stp_map_clear(MAP map)
}
}
+void _stp_pmap_clear(PMAP pmap)
+{
+ int i;
+
+ if (pmap == NULL)
+ return;
+
+ for_each_cpu(i) {
+ MAP m = per_cpu_ptr (pmap->map, i);
+ spin_lock(&m->lock);
+ _stp_map_clear(m);
+ spin_unlock(&m->lock);
+ }
+ _stp_map_clear(&pmap->agg);
+}
static void __stp_map_del(MAP map)
{
@@ -853,6 +868,7 @@ MAP _stp_pmap_agg (PMAP pmap)
for_each_cpu(i) {
m = per_cpu_ptr (pmap->map, i);
+ spin_lock(&m->lock);
/* walk the hash chains. */
for (hash = 0; hash < HASH_TABLE_SIZE; hash++) {
head = &m->hashes[hash];
@@ -873,6 +889,7 @@ MAP _stp_pmap_agg (PMAP pmap)
_stp_new_agg(agg, ahead, ptr);
}
}
+ spin_unlock(&m->lock);
}
return agg;
}