summaryrefslogtreecommitdiffstats
path: root/tapsets.cxx
diff options
context:
space:
mode:
authorFrank Ch. Eigler <fche@elastic.org>2009-08-12 16:07:08 -0400
committerFrank Ch. Eigler <fche@elastic.org>2009-08-12 16:07:08 -0400
commit43241c442263dd52e34f86e2d0a64c20cd7235c3 (patch)
tree39711f175ec2dc1d712880bc5cdbf1ae22ae3f68 /tapsets.cxx
parent857bdfd1bec07003d3d92aaacf6ba578057324ef (diff)
downloadsystemtap-steved-43241c442263dd52e34f86e2d0a64c20cd7235c3.tar.gz
systemtap-steved-43241c442263dd52e34f86e2d0a64c20cd7235c3.tar.xz
systemtap-steved-43241c442263dd52e34f86e2d0a64c20cd7235c3.zip
PR10507: tweak heuristics for stap_uprobes[] allocation
* tapsets.cxx (uprobes::emit_module_decls): Compute MAXUPROBES with x-treme kl3v3rn3ss. * stap.1.in: Clarify MAXUPROBES.
Diffstat (limited to 'tapsets.cxx')
-rw-r--r--tapsets.cxx17
1 files changed, 12 insertions, 5 deletions
diff --git a/tapsets.cxx b/tapsets.cxx
index 9884860a..333914d0 100644
--- a/tapsets.cxx
+++ b/tapsets.cxx
@@ -4400,12 +4400,19 @@ uprobe_derived_probe_group::emit_module_decls (systemtap_session& s)
s.op->newline() << "#define UPROBES_API_VERSION 1";
s.op->newline() << "#endif";
- s.op->newline() << "#ifndef MULTIPLE_UPROBES";
- s.op->newline() << "#define MULTIPLE_UPROBES 256"; // maximum possible armed uprobes per process() probe point
- // or apprx. max number of processes mapping a shared library
- s.op->newline() << "#endif";
+ // We'll probably need at least this many:
+ unsigned minuprobes = probes.size();
+ // .. but we don't want so many that .bss is inflated (PR10507):
+ unsigned uprobesize = 64;
+ unsigned maxuprobesmem = 10*1024*1024; // 10 MB
+ unsigned maxuprobes = maxuprobesmem / uprobesize;
+
+ // Let's choose a value on the middle, but clamped on the minimum size
+ unsigned default_maxuprobes =
+ (minuprobes < maxuprobes) ? ((minuprobes + maxuprobes) / 2) : minuprobes;
+
s.op->newline() << "#ifndef MAXUPROBES";
- s.op->newline() << "#define MAXUPROBES (MULTIPLE_UPROBES * " << probes.size() << ")";
+ s.op->newline() << "#define MAXUPROBES " << default_maxuprobes;
s.op->newline() << "#endif";
// In .bss, the shared pool of uprobe/uretprobe structs. These are