From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Miller Subject: Re: [PATCH net-next 01/17] net: sched: refactor mini_qdisc_pair_swap() to use workqueue Date: Tue, 13 Nov 2018 08:08:31 -0800 (PST) Message-ID: <20181113.080831.1579511935763457972.davem@davemloft.net> References: <1542009346-23780-2-git-send-email-vladbu@mellanox.com> <20181112.092809.744587974364715455.davem@davemloft.net> Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Cc: netdev@vger.kernel.org, jhs@mojatatu.com, xiyou.wangcong@gmail.com, jiri@resnulli.us, ast@kernel.org, daniel@iogearbox.net To: vladbu@mellanox.com Return-path: Received: from shards.monkeyblade.net ([23.128.96.9]:51446 "EHLO shards.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731439AbeKNCIM (ORCPT ); Tue, 13 Nov 2018 21:08:12 -0500 In-Reply-To: Sender: netdev-owner@vger.kernel.org List-ID: From: Vlad Buslov Date: Tue, 13 Nov 2018 13:13:19 +0000 > > On Mon 12 Nov 2018 at 17:28, David Miller wrote: >> From: Vlad Buslov >> 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.