Re: [patch V2 10/17] posix-timers: Make signal_struct::next_posix_timer_id an atomic_t

From: Cyrill Gorcunov
Date: Wed Mar 05 2025 - 03:28:28 EST


On Wed, Mar 05, 2025 at 08:31:21AM +0100, Thomas Gleixner wrote:
...
>
> The traversal does not RMW the timer itself, it unmangles the signal
> pointer for comparison in posix_timer_hashed(). posix_timer_by_id() does
> straight comparisons. So both only read.

No, I mean that we read the value then allocate a temp value with 0 bit
excluded implicitly, so it is not a straight read, but whatever.

> Sure, we can mangle timer ID instead of the signal pointer, but the
> outcome is pretty much the same. The only difference is in
> posix_timer_hashed(), which must detect a taken timer ID independent of
> the timers valid state to prevent collisions.

Bah, I managed to miss that we need to lookup for not yet fully initialized
timers as well, and indeed it makes no much difference which exactly field
to mangle. Thanks a huge for explanations, Thomas!

Cyrill