Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tools/deadlock: Add an option to set the maximum number of stack traces #4591

Merged
merged 1 commit into from
Apr 29, 2023

Conversation

jeromemarchand
Copy link
Contributor

Commit 77f5252 ("tools/deadlock: support specifies maxnum of threads and edge cases (#3455)") allow to set the maximum number of threads and edge cases to be able to reduce the memory usage of the deadlock tool. It however let the size of the map of stack traces fixed. It's current size, 640k (actually rounded up to 1M) takes 1Gb of vmalloced kernel memory.

This patch adds an option to make the maximum number of stack traces user defined. It also set the default value to 64k, in line with the current default for the number of edge cases and threads.

It fix the following issue on system with limited memory ressources: could not open bpf map: stack_traces, error: Cannot allocate memory Traceback (most recent call last):
File "/tmp/./deadlock.py", line 577, in
main()
File "/tmp/./deadlock.py", line 489, in main
bpf = BPF(text=text)
File "/usr/lib/python3.9/site-packages/bcc/init.py", line 479, in init
raise Exception("Failed to compile BPF module %s" % (src_file or ""))
Exception: Failed to compile BPF module

Commit 77f5252 ("tools/deadlock: support specifies maxnum of threads
and edge cases (iovisor#3455)") allow to set the maximum number of threads
and edge cases to be able to reduce the memory usage of the deadlock
tool. It however let the size of the map of stack traces fixed. It's
current size, 640k (actually rounded up to 1M) takes 1Gb of vmalloced
kernel memory.

This patch adds an option to make the maximum number of stack traces
user defined. It also set the default value to 64k, in line with the
current default for the number of edge cases and threads.

It fix the following issue on system with limited memory ressources:
could not open bpf map: stack_traces, error: Cannot allocate memory
Traceback (most recent call last):
  File "/tmp/./deadlock.py", line 577, in <module>
    main()
  File "/tmp/./deadlock.py", line 489, in main
    bpf = BPF(text=text)
  File "/usr/lib/python3.9/site-packages/bcc/__init__.py", line 479, in __init__
    raise Exception("Failed to compile BPF module %s" % (src_file or "<text>"))
Exception: Failed to compile BPF module <text>

Signed-off-by: Jerome Marchand <jmarchan@redhat.com>
@yonghong-song yonghong-song merged commit 5c146cc into iovisor:master Apr 29, 2023
@jeromemarchand jeromemarchand deleted the deadlock-stack-size branch May 2, 2023 12:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants