On Wed, 18 Jun 2025 20:46:20 +0200
Peter Zijlstra <[email protected]> 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

Reply via email to