Received: by 2002:ac0:98c7:0:0:0:0:0 with SMTP id g7-v6csp1924282imd; Sun, 4 Nov 2018 12:36:56 -0800 (PST) X-Google-Smtp-Source: AJdET5fz0HUtKgEbVspY6jK3fnkULEhSz/KESF6aI4ahEKPNDmO10tPI320MIFPw/6CKi2YSzzWN X-Received: by 2002:a17:902:700c:: with SMTP id y12-v6mr19483425plk.185.1541363816444; Sun, 04 Nov 2018 12:36:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541363816; cv=none; d=google.com; s=arc-20160816; b=L2kDW7eoes0VbucDLl8YYhY6TQykC/6+ONtCGQFbcFoOIbwlEstAR0Ec0A/yPLkQY0 A6LH0eDbsxmKk3EhfhJzAIDS86xICuyRayGyWsjefr04Jh0KNGLJMeZJbRQWc+ISBw+F QKT3jLAVP80CHO+9On8h3jPA2LBaopDrNGQ1O8bpTVyKcOPGPH2bP5MU30LgkYeqg+5S Lx4cNm68F3HqC6v/v6bWXWbUmXYS9Z/Yu1oEDXjdmlKM8ol3x973yHQNr1xb/fEv0tCk VdFGgBVXlxX6Gc4NgYVAMnK+430GYzP/abm/sucXsnaiygLN9hBr9U8xhmKAdGnMAWCK +OLA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=zD1qsgxAtZ8HHb3GRquZWCyoDcKyYugtSJMG+00lDRU=; b=oUjc+X6orhmSaTB+t/LkbZPI//htMt59TXW7j6c5QGG54JpZY9hEnxulJ2l2DxW0Ii CNDcpaVlFDROPhpQK2hpGDXJlHEbfoJFBXXASbJ0NHC/BLsS8Q4Clotcgaj+NFNNwIf4 MMOcvIi/I/lvyBZOjlWd1BRib9dLXfH/58n81X/CSoiqVFCG3n0946FrDEadg4DrSZpI Z07nmP41VkmGcMhQLYg07+tpZNGlS/31Snc61mB6EcmV/q/HsyUd4U0M0yRXNQk92thQ RNmXm0JR4shWJ3zzWPUY66psGY5rmv+Zs8qRyWIhbfEd8YXGJvXKE7HiXeFu+ADqQTQa FAMA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q22-v6si30871859pgb.368.2018.11.04.12.36.39; Sun, 04 Nov 2018 12:36:56 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729723AbeKEE5b (ORCPT + 99 others); Sun, 4 Nov 2018 23:57:31 -0500 Received: from mx2.suse.de ([195.135.220.15]:59816 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1729616AbeKEE5b (ORCPT ); Sun, 4 Nov 2018 23:57:31 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 8832DACED; Sun, 4 Nov 2018 19:41:22 +0000 (UTC) Received: by unicorn.suse.cz (Postfix, from userid 1000) id 8AB58E00A8; Sun, 4 Nov 2018 20:41:21 +0100 (CET) Date: Sun, 4 Nov 2018 20:41:21 +0100 From: Michal Kubecek To: David Miller Cc: mk.singh@oracle.com, netdev@vger.kernel.org, eric.dumazet@gmail.com, j.vosburgh@gmail.com, vfalico@gmail.com, andy@greyhouse.net, linux-kernel@vger.kernel.org Subject: Re: [PATCH] bonding:avoid repeated display of same link status change Message-ID: <20181104194121.GA29914@unicorn.suse.cz> References: <20181031105729.7442-1-mk.singh@oracle.com> <20181102.233138.738200505012734856.davem@davemloft.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20181102.233138.738200505012734856.davem@davemloft.net> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Nov 02, 2018 at 11:31:38PM -0700, David Miller wrote: > From: mk.singh@oracle.com > Date: Wed, 31 Oct 2018 16:27:28 +0530 > > > - if (slave->delay) { > > + if (slave->delay && > > + !atomic64_read(&bond->rtnl_needed)) { > ... > > + !atomic64_read(&bond->rtnl_needed)) { > ... > > + atomic64_set(&bond->rtnl_needed, 1); > ... > > + atomic64_set(&bond->rtnl_needed, 0); > ... > > @@ -229,6 +229,7 @@ struct bonding { > > struct dentry *debug_dir; > > #endif /* CONFIG_DEBUG_FS */ > > struct rtnl_link_stats64 bond_stats; > > + atomic64_t rtnl_needed; > > There is nothing "atomic" about a value that is only set and read. > > And using a full 64-bit value for something taking on only '0' and > '1' is unnecessary as well. Part of the misunderstanding is caused by the fact that this is actually a v4 but not marked as such: v1: https://patchwork.ozlabs.org/patch/955789/ v2: https://patchwork.ozlabs.org/patch/970421/ v3: https://patchwork.ozlabs.org/patch/988241/ When commenting v3, I didn't know about the v2 discussion where Eric Dumazet NACKed the patch because of potential conflict issues: https://patchwork.ozlabs.org/patch/970421/#1992397 https://patchwork.ozlabs.org/patch/988241/#2017317 On the other hand, there is no need for atomic64_t. Simple atomic_t (with explaining comment) would suffice. On architectures allowing atomic read/write for 32-bit integers, there would be no performance penalty. On architectures not allowing it, atomic_read() and atomic_set() are implemented to be safe. Michal Kubecek