[Intel-gfx] [PATCH 1/5] linux/minmax.h: add non-atomic version of xchg
David Laight
David.Laight at ACULAB.COM
Mon Dec 12 09:38:12 UTC 2022
From: Andrzej Hajda <andrzej.hajda at intel.com>
> Sent: 09 December 2022 15:49
>
> The pattern of setting variable with new value and returning old
> one is very common in kernel. Usually atomicity of the operation
> is not required, so xchg seems to be suboptimal and confusing in
> such cases. Since name xchg is already in use and __xchg is used
> in architecture code, proposition is to name the macro exchange.
Dunno, if it is non-atomic then two separate assignment statements
is decidedly more obvious and needs less brain cells to process.
Otherwise someone will assume 'something clever' is going on
and the operation is atomic.
David
-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)
More information about the Intel-gfx
mailing list