summaryrefslogtreecommitdiffstats
path: root/runtime/map.h
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.h
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.h')
-rw-r--r--runtime/map.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/runtime/map.h b/runtime/map.h
index 4bb8aee2..f89dc521 100644
--- a/runtime/map.h
+++ b/runtime/map.h
@@ -19,6 +19,23 @@
* @{
*/
+
+/* Include map spinlocks only on demand. Otherwise, assume that
+ caller does the right thing. */
+#ifndef NEED_MAP_LOCKS
+#define NEED_MAP_LOCKS 0
+#endif
+
+#if NEED_MAP_LOCKS
+#define MAP_GET_CPU() get_cpu()
+#define MAP_PUT_CPU() put_cpu()
+#else
+/* get/put_cpu wrappers. Unnecessary if caller is already atomic. */
+#define MAP_GET_CPU() smp_processor_id()
+#define MAP_PUT_CPU() do {} while (0)
+#endif
+
+
/* This sets the size of the hash table. */
#ifndef HASH_TABLE_BITS
#define HASH_TABLE_BITS 8
@@ -102,7 +119,9 @@ struct map_root {
int data_offset;
+#ifdef NEED_MAP_LOCKS
spinlock_t lock;
+#endif
/* the hash table for this array */
struct hlist_head hashes[HASH_TABLE_SIZE];