# Re: \[PATCH v10 06/14\] unwind\_user/deferred: Add deferred unwinding interface

- From: Steven Rostedt \<rostedt@goodmis.org\>
- Date: 2025-06-24 22:36:23 
- List: linux-trace-kernel
- Page: https://ratatoskr.run/linux-trace-kernel/2025/06/3106010
- Thread: https://ratatoskr.run/linux-trace-kernel/2025/06/3086227/t/2.md

```text
On Wed, 18 Jun 2025 20:46:20 +0200
Peter Zijlstra [ref] wrote:

> >  static __always_inline void unwind_exit_to_user_mode(void)
> >  {
> >  	if (unlikely(current->unwind_info.cache))
> >  		current->unwind_info.cache->nr_entries = 0;
> > +	current->unwind_info.timestamp = 0;  
> 
> Surely clearing that timestamp is only relevant when there is a cache
> around? Better to not add this unconditional write to the exit path.
> 
> >  }

Note, the timestamp could be there if the cache failed to allocate, and
we would still want to clear the timestamp. I did turn this into:

static __always_inline void unwind_reset_info(void)
{
	/* Exit out early if this was never used */
	if (likely(!current->unwind_info.timestamp))
		return;

	if (current->unwind_info.cache)
		current->unwind_info.cache->nr_entries = 0;
	current->unwind_info.timestamp = 0;
}

For this patch, but later patches will give us the bitmask to check.

-- Steve
```
