Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp797822ybx; Thu, 31 Oct 2019 00:47:28 -0700 (PDT) X-Google-Smtp-Source: APXvYqzXANmiIPsyRJSv78pkg+faRfVfRMowoHx2jGSa0ln3XbtCAl6RQHPrrH6kI/Jpr6arl9m8 X-Received: by 2002:a50:ac3c:: with SMTP id v57mr4256192edc.300.1572508048318; Thu, 31 Oct 2019 00:47:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1572508048; cv=none; d=google.com; s=arc-20160816; b=odYdz9SygrI9vkRCExN54IOjW3zeFvr/LEDHM/BSI96W//Ehl5q5gHHnEXawFo9ozH sfphzS5MyJEk+/tyJv4oB0vX88eTyLXPNU5cPR9rd1RWP1NvNBnPgtGNvsTl8faQTLve KfmYhSbN64ayHl+lq0bY6fJFZhs/FN3IWry3bS8Q/QwqJfwiw9mXOWzWsWLil9ab+DCs R8iHiLL0RfaPvu0QW7RMUD+Q2eG/DGmHWc5nqwLt+icT20wZxiAvU3IFQYZqjuDp8RxH BqRE+pBl6b9rjFvI4T5Mbmf6gK2VTQqxJZUVMwzPjOVFFsXnzS+TPydHjkHTfN2lnV79 5WQw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=/TqoFnjC6QGrXp43uRC7YW3e0C+d8hcxNrpcrOte4RE=; b=U8H+PL4EAHX3B9595lkNJ84dGn8BVmRAdZiAgneZz7t/75LHeDNjGWfv3xjhl7WjG2 894uGrUY/K0foXWNkS6QwB5Amn1UIDsIy8L0pX3prRVALePhTNS33IQJbUx20H7ALk7c KAvkxC3uiL+EFsF9+TNKKeK24CN8y2Y/ylrC9xfbNZAFGatAjUYbfZ6R4jHZLbdTiXEY Z+wAJqHKXU4mGPHG1vGG4b38amlAFysI37+RaAC8/HU8N6GSNSAX3BUixggO2Sl01blq h/yV66mCLN23YKo/9wt5LbWJdnYs6fFqiRNTH5azOWnbdvVbXexLf3+51RKgul99MZcw 7f+g== 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 m26si2834737ejb.324.2019.10.31.00.47.02; Thu, 31 Oct 2019 00:47:28 -0700 (PDT) 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 S1726905AbfJaHnO (ORCPT + 99 others); Thu, 31 Oct 2019 03:43:14 -0400 Received: from smtp10.smtpout.orange.fr ([80.12.242.132]:36087 "EHLO smtp.smtpout.orange.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726747AbfJaHnO (ORCPT ); Thu, 31 Oct 2019 03:43:14 -0400 Received: from localhost.localdomain ([93.23.12.90]) by mwinf5d87 with ME id L7j9210091waAWt037j9B8; Thu, 31 Oct 2019 08:43:12 +0100 X-ME-Helo: localhost.localdomain X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Thu, 31 Oct 2019 08:43:12 +0100 X-ME-IP: 93.23.12.90 From: Christophe JAILLET To: davem@davemloft.net, mareklindner@neomailbox.ch, sw@simonwunderlich.de, a@unstable.cc, sven@narfation.org Cc: b.a.t.m.a.n@lists.open-mesh.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET Subject: [PATCH] batman-adv: Simplify 'batadv_v_ogm_aggr_list_free()' Date: Thu, 31 Oct 2019 08:42:55 +0100 Message-Id: <20191031074255.3234-1-christophe.jaillet@wanadoo.fr> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Use 'skb_queue_purge()' instead of re-implementing it. Signed-off-by: Christophe JAILLET --- BTW, I don't really see the need of 'aggr_list_lock'. I think that the code could be refactored to drop 'aggr_list_lock' and use the already existing 'aggr_list.lock'. This would require to use the lock-free __skb_... variants when working on 'aggr_list'. As far as I understand, the use of 'aggr_list' and 'aggr_list_lock' is limited to bat_v_ogm.c'. So the impact would be limited. This would avoid a useless locking that never fails, so the performance gain should be really limited. So, I'm not sure this would be more readable and/or future proof, so I just note it here to open the discussion. If interested, I have a (compiled tested only) patch that implements this change. --- net/batman-adv/bat_v_ogm.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/net/batman-adv/bat_v_ogm.c b/net/batman-adv/bat_v_ogm.c index dc4f7430cb5a..b841c83d9c3b 100644 --- a/net/batman-adv/bat_v_ogm.c +++ b/net/batman-adv/bat_v_ogm.c @@ -177,13 +177,9 @@ static bool batadv_v_ogm_queue_left(struct sk_buff *skb, */ static void batadv_v_ogm_aggr_list_free(struct batadv_hard_iface *hard_iface) { - struct sk_buff *skb; - lockdep_assert_held(&hard_iface->bat_v.aggr_list_lock); - while ((skb = skb_dequeue(&hard_iface->bat_v.aggr_list))) - kfree_skb(skb); - + skb_queue_purge(&hard_iface->bat_v.aggr_list); hard_iface->bat_v.aggr_len = 0; } -- 2.20.1