Skip to content

Commit

Permalink
tools/profile: fix suggestion about when to increase stack-storage-size
Browse files Browse the repository at this point in the history
When we do stack traces via stackmaps, hash collisions (-EEXIST) may indicate
that the map size is too small. Not -ENOMEM.
  • Loading branch information
boat0 authored and yonghong-song committed Jun 24, 2020
1 parent 34f8985 commit 1bddba6
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions tools/profile.py
Expand Up @@ -305,17 +305,18 @@ def aksym(addr):

# output stacks
missing_stacks = 0
has_enomem = False
has_collision = False
counts = b.get_table("counts")
stack_traces = b.get_table("stack_traces")
for k, v in sorted(counts.items(), key=lambda counts: counts[1].value):
# handle get_stackid errors
if not args.user_stacks_only and stack_id_err(k.kernel_stack_id):
missing_stacks += 1
has_enomem = has_enomem or k.kernel_stack_id == -errno.ENOMEM
# hash collision (-EEXIST) suggests that the map size may be too small
has_collision = has_collision or k.kernel_stack_id == -errno.EEXIST
if not args.kernel_stacks_only and stack_id_err(k.user_stack_id):
missing_stacks += 1
has_enomem = has_enomem or k.user_stack_id == -errno.ENOMEM
has_collision = has_collision or k.user_stack_id == -errno.EEXIST

user_stack = [] if k.user_stack_id < 0 else \
stack_traces.walk(k.user_stack_id)
Expand Down Expand Up @@ -371,7 +372,7 @@ def aksym(addr):

# check missing
if missing_stacks > 0:
enomem_str = "" if not has_enomem else \
enomem_str = "" if not has_collision else \
" Consider increasing --stack-storage-size."
print("WARNING: %d stack traces could not be displayed.%s" %
(missing_stacks, enomem_str),
Expand Down

0 comments on commit 1bddba6

Please sign in to comment.