]> sourceware.org Git - systemtap.git/commitdiff
PR10507: tweak heuristics for stap_uprobes[] allocation
authorFrank Ch. Eigler <fche@elastic.org>
Wed, 12 Aug 2009 20:07:08 +0000 (16:07 -0400)
committerFrank Ch. Eigler <fche@elastic.org>
Wed, 12 Aug 2009 20:07:08 +0000 (16:07 -0400)
* tapsets.cxx (uprobes::emit_module_decls): Compute MAXUPROBES
  with x-treme kl3v3rn3ss.
* stap.1.in: Clarify MAXUPROBES.

stap.1.in
tapsets.cxx

index 0e7a51f48490c3d38550a17d46063c199ca10b92..a9af3a132e048085e5afd7d96dfc75edb313f84e 100644 (file)
--- a/stap.1.in
+++ b/stap.1.in
@@ -1081,9 +1081,9 @@ for the probe handler's own needs, plus a safety margin.
 .TP
 MAXUPROBES
 Maximum number of concurrently armed user-space probes (uprobes), default
-100 times the number of user-space probe points named in the script.  This
-pool is large because individual uprobe objects are allocated for each
-process for each script-level probe.
+somewhat larger than the number of user-space probe points named in the script.
+This pool needs to be potentialy large because individual uprobe objects (about
+64 bytes each) are allocated for each process for each matching script-level probe.
 
 .PP
 With scripts that contain probes on any interrupt path, it is possible that
index 9884860a5701aaa868034648a5b8d4db16560531..333914d0ecb8ab3ea14d721b898221c37dcaf554 100644 (file)
@@ -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
This page took 0.051211 seconds and 5 git commands to generate.