file: /proc/sys/kernel/perf_event_max_stack
variable: kernel.perf_event_max_stack
Official reference

Controls maximum number of stack frames to copy for (attr.sample_type & PERF_SAMPLE_CALLCHAIN) configured events, for instance, when using ‘perf record -g’ or ‘perf trace –call-graph fp’.

This can only be done when no events are in use that have callchains enabled, otherwise writing to this file will return -EBUSY.

The default value is 127.