On Thu, 19 Jun 2025 10:34:15 +0200
Peter Zijlstra <[email protected]> wrote:
> Why can't we cmpxchg_local() the thing and avoid this horrible stuff?
>
> static u64 get_timestamp(struct unwind_task_info *info)
> {
> u64 new, old = info->timestamp;
>
> if (old)
> return old;
>
> new = local_clock();
> old = cmpxchg_local(&info->timestamp, old, new);
> if (old)
> return old;
> return new;
> }
>
> Seems simple enough; what's wrong with it?
It's a 64 bit number where most 32 bit architectures don't have any
decent cmpxchg on 64 bit values. That's given me hell in the ring
buffer code :-p
-- Steve