# Re: \[PATCH v10 04/14\] unwind\_user/deferred: Add unwind\_deferred\_trace()

- From: Steven Rostedt \<rostedt@goodmis.org\>
- Date: 2025-06-18 15:23:53 
- List: linux-trace-kernel
- Page: https://ratatoskr.run/linux-trace-kernel/2025/06/3097663
- Thread: https://ratatoskr.run/linux-trace-kernel/2025/06/3086227/t.md

```text
On Wed, 18 Jun 2025 16:01:11 +0200
Peter Zijlstra [ref] wrote:

> On Tue, Jun 10, 2025 at 08:54:25PM -0400, Steven Rostedt wrote:
> 
> > +#define UNWIND_MAX_ENTRIES 512  
> 
> The reason this is 512 is so that you end up with a whole page below?

Possibly. We could probably even make that configurable. Perhaps just use
sysctl_perf_event_max_contexts_per_stack ?


Josh, any comments about why you picked this number?

-- Steve

> 
> > +int unwind_deferred_trace(struct unwind_stacktrace *trace)
> > +{
> > +	struct unwind_task_info *info = &current->unwind_info;
> > +
> > +	/* Should always be called from faultable context */
> > +	might_fault();
> > +
> > +	if (current->flags & PF_EXITING)
> > +		return -EINVAL;
> > +
> > +	if (!info->entries) {
> > +		info->entries = kmalloc_array(UNWIND_MAX_ENTRIES, sizeof(long),
> > +					      GFP_KERNEL);  
> 

```
