lkml.org 
[lkml]   [2023]   [May]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [patch v3 18/36] [patch V2 18/38] cpu/hotplug: Add CPU state tracking and synchronization
On Tue, May 09, 2023 at 01:07:23PM +0200, Peter Zijlstra wrote:
> On Mon, May 08, 2023 at 09:43:55PM +0200, Thomas Gleixner wrote:
>
> > +static inline void cpuhp_ap_update_sync_state(enum cpuhp_sync_state state)
> > +{
> > + atomic_t *st = this_cpu_ptr(&cpuhp_state.ap_sync_state);
> > + int sync = atomic_read(st);
> > +
> > + while (!atomic_try_cmpxchg(st, &sync, state));
> > +}
>
> Why isn't:
>
> atomic_set(st, state);
>
> any good?

Hmm, should at the very least be atomic_set_release(), but if you want
the full barrier then:

(void)atomic_xchg(st, state);

is the much saner way to write the above.

\
 
 \ /
  Last update: 2023-05-09 13:37    [W:0.081 / U:0.720 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site