Increase kprobes maxactives

To handle the case where the pair kprobe/kretprobe is attached to a
functions that can be executed concurrently, for example because called
at the same time on different CPUs or because the calling process can be
preempted and a different process can call the same function, the kernel
needs to keep a pool of instances to track the execution stages of every
kprobe. The pool size is defined, per kretprobe, by the maxactive
parameter. If the maxactive number is too small, the pool may overflow
and kretprobe events may not find their matching kprobes, being missed.

To solve this issue, increase the default number of maxactives from the
default value (from the kernel documentation, if CONFIG_PREEMPT is
enabled, the default is max(10, 2*NR_CPUS)) to 1024. This number has
been found empirically, to reduce the number of misses for the Android
functions binder_ioctl_write_read and binder_ioctl, identified as being
problematic for their preemptability and popularity in Android.

Test: Visual inspection of /sys/kernel/tracing/kprobe_profile
Bug: 359542775
Change-Id: I2cd527174d8a37608f7702d20c244a75371299b4
Signed-off-by: Alessio Balsini <balsini@google.com>
3 files changed
tree: 11ef7aca48d5c8d791e3c76b49cfd103be42df1a
  1. .github/
  2. bazel/
  3. build_overrides/
  4. buildtools/
  5. debian/
  6. docs/
  7. examples/
  8. gn/
  9. include/
  10. infra/
  11. protos/
  12. python/
  13. src/
  14. test/
  15. third_party/
  16. tools/
  17. ui/
  18. .bazelignore
  19. .bazelrc
  20. .clang-format
  21. .clang-tidy
  22. .git-blame-ignore-revs
  23. .gitattributes
  24. .gitignore
  25. .gn
  26. .style.yapf
  27. Android.bp
  28. Android.bp.extras
  29. BUILD
  30. BUILD.extras
  31. BUILD.gn
  32. CHANGELOG
  33. codereview.settings
  34. DIR_METADATA
  35. heapprofd.rc
  36. LICENSE
  37. meson.build
  38. METADATA
  39. MODULE_LICENSE_APACHE2
  40. OWNERS
  41. perfetto.rc
  42. PerfettoIntegrationTests.xml
  43. persistent_cfg.pbtxt
  44. PRESUBMIT.py
  45. README.chromium
  46. README.md
  47. TEST_MAPPING
  48. traced_perf.rc
  49. WATCHLISTS
  50. WORKSPACE
README.md

Perfetto - System profiling, app tracing and trace analysis

Perfetto is a production-grade open-source stack for performance instrumentation and trace analysis. It offers services and libraries and for recording system-level and app-level traces, native + java heap profiling, a library for analyzing traces using SQL and a web-based UI to visualize and explore multi-GB traces.

See https://perfetto.dev/docs or the /docs/ directory for documentation.