diff --git a/tools/deadlock.c b/tools/deadlock.c index 006dc121932e..6ae405badadc 100644 --- a/tools/deadlock.c +++ b/tools/deadlock.c @@ -60,7 +60,7 @@ struct thread_created_leaf_t { BPF_HASH(thread_to_parent, u32, struct thread_created_leaf_t); // Stack traces when threads are created and when mutexes are locked/unlocked. -BPF_STACK_TRACE(stack_traces, 655360); +BPF_STACK_TRACE(stack_traces, MAX_TRACES); // The first argument to the user space function we are tracing // is a pointer to the mutex M held by thread T. diff --git a/tools/deadlock.py b/tools/deadlock.py index 12de099f3932..f7eb4ce0bd7e 100755 --- a/tools/deadlock.py +++ b/tools/deadlock.py @@ -467,6 +467,13 @@ def main(): help='Specifies the maximum number of edge cases that can be recorded. ' 'default 65536. Note. 88 bytes per edge case.' ) + parser.add_argument( + '-s', '--stacktraces', type=int, default=65536, + help='Specifies the maximum number of stack traces that can be recorded. ' + 'This number is rounded up to the next power of two.' + 'default 65536. Note. 1 kbytes vmalloced per stack trace.' + ) + args = parser.parse_args() if not args.binary: try: @@ -479,6 +486,7 @@ def main(): text = f.read() text = text.replace('MAX_THREADS', str(args.threads)); text = text.replace('MAX_EDGES', str(args.edges)); + text = text.replace('MAX_TRACES', str(args.stacktraces)); bpf = BPF(text=text) # Trace where threads are created