-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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: support specifies maxnum of threads and edge cases #3455
Merged
yonghong-song
merged 2 commits into
iovisor:master
from
chenyuezhou:tools/deadlock/support_specifies_maxnum_of_threads_and_edge_cases
May 27, 2021
Merged
tools/deadlock: support specifies maxnum of threads and edge cases #3455
yonghong-song
merged 2 commits into
iovisor:master
from
chenyuezhou:tools/deadlock/support_specifies_maxnum_of_threads_and_edge_cases
May 27, 2021
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
chenhengqi
reviewed
May 27, 2021
tools/deadlock.py
Outdated
@@ -465,7 +475,10 @@ def main(): | |||
print('%s. Is the process (pid=%d) running?' % (str(e), args.pid)) | |||
sys.exit(1) | |||
|
|||
bpf = BPF(src_file=b'deadlock.c') | |||
text = open('deadlock.c').read() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be better to use something like with open('deadlock', 'r') as f:
:)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
adjusted.
chenhengqi
approved these changes
May 27, 2021
[buildbot, test this please] |
jeromemarchand
added a commit
to jeromemarchand/bcc
that referenced
this pull request
Apr 25, 2023
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
pushed a commit
that referenced
this pull request
Apr 29, 2023
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 <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>
captain5050
pushed a commit
to captain5050/bcc
that referenced
this pull request
Oct 12, 2023
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>
CrackerCat
pushed a commit
to CrackerCat/bcc
that referenced
this pull request
Jul 31, 2024
…ovisor#3455) support to specify maxinum of threads and edge cases. The default values make map taking more than 0.5G memory which cause out-of-memory issue on some systems. also fix an issue with python `open` so the open file is automatically closed upon file reading is done.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
#3453
support specifies maxnum of threads and edge cases.
The default size of memory that deadlock needs to allocate is too large. Sometimes this will cause OOM for particular system, or the memory limit has been exceeded.