From: Vlad Buslov <vla...@mellanox.com>
Date: Tue, 13 Nov 2018 13:13:19 +0000

> 
> On Mon 12 Nov 2018 at 17:28, David Miller <da...@davemloft.net> wrote:
>> From: Vlad Buslov <vla...@mellanox.com>
>> Date: Mon, 12 Nov 2018 09:55:30 +0200
>>
>>> +void mini_qdisc_pair_swap(struct mini_Qdisc_pair *miniqp,
>>> +                     struct tcf_proto *tp_head)
>>> +{
>>> +   xchg(&miniqp->tp_head, tp_head);
>>
>> If you are not checking the return value of xchg(), then this is
>> simply a store with optionally a memory barrier of some sort
>> either before or after.
> 
> That was my intention. What would be a better way to atomically
> reset a pointer? Should I just change this line to explicit
> assignment+barrier?

We have all kinds of helpers in the kernel for doing things like
this, grep for things like "smp_load_acquire", "smp_store_release()"
etc.

Reply via email to