Re: [PATCH 1/2] CodeSample/count: Use plain access instead of WRITE_ONCE

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

 



On Sun, May 28, 2023 at 02:37:28PM +0000, Alan Huang wrote:
> The cap here has not been published, plain access is enough.
> 
> Signed-off-by: Alan Huang <mmpgouride@xxxxxxxxx>

Good catch, thank you!

Does line 27 of that same listing need a READ_ONCE(*ctrp)?

							Thanx, Paul

> ---
>  CodeSamples/count/count_end_rcu.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/CodeSamples/count/count_end_rcu.c b/CodeSamples/count/count_end_rcu.c
> index 1171f0b6..8fc70611 100644
> --- a/CodeSamples/count/count_end_rcu.c
> +++ b/CodeSamples/count/count_end_rcu.c
> @@ -89,7 +89,7 @@ void count_unregister_thread(int nthreadsexpected)	//\lnlbl{unreg:b}
>  	}						//\lnlbl{unreg:alloc:e}
>  	spin_lock(&final_mutex);			//\lnlbl{unreg:acq}
>  	*cap = *countarrayp;				//\lnlbl{unreg:copy}
> -	WRITE_ONCE(cap->total, cap->total + counter);	//\lnlbl{unreg:add}
> +	cap->total += counter;	//\lnlbl{unreg:add}
>  	cap->counterp[idx] = NULL;			//\lnlbl{unreg:null}
>  	capold = countarrayp;				//\lnlbl{unreg:retain}
>  	rcu_assign_pointer(countarrayp, cap);		//\lnlbl{unreg:assign}
> -- 
> 2.34.1
> 



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux