Re: [PATCH bpf-next v9 1/6] locking/local_lock: Introduce localtry_lock_t

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Feb 21, 2025 at 06:44:22PM -0800, Alexei Starovoitov wrote:
> +#define __localtry_lock(lock)					\
> +	do {							\
> +		localtry_lock_t *lt;				\
> +		preempt_disable();				\
> +		lt = this_cpu_ptr(lock);			\
> +		local_lock_acquire(&lt->llock);			\
> +		WRITE_ONCE(lt->acquired, 1);			\
> +	} while (0)

I think these need compiler barriers.

I checked with gcc docs (https://gcc.gnu.org/onlinedocs/gcc/Volatiles.html)
and found this as confirmation:
> Accesses to non-volatile objects are not ordered with respect to volatile accesses.

Unless the Linux kernel is built with some magic to render this moot(?).




[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux