From patchwork Sun Dec 15 21:08:04 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Jason A. Donenfeld" X-Patchwork-Id: 181629 Delivered-To: patch@linaro.org Received: by 2002:a92:3001:0:0:0:0:0 with SMTP id x1csp3536218ile; Sun, 15 Dec 2019 13:08:21 -0800 (PST) X-Google-Smtp-Source: APXvYqxXbZXocMicuUbYKxeoepGktZ1CaXUhilDg6t10B6VtAY/MYrBnLvfvPc54JnuP+egIgYKq X-Received: by 2002:a05:6830:603:: with SMTP id w3mr27765711oti.217.1576444101724; Sun, 15 Dec 2019 13:08:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576444101; cv=none; d=google.com; s=arc-20160816; b=YWLbPrIObDUlkyynhgWqmWzaOWCNry0xUlRsIdLFXVbvrulTKnKA4/sVEfGDDfSb1/ b5EvdLUn6YoJwiOR6598jC6a5DUn6G9P6IRi+Teto2Mu4T3KtAzouw9axMj+QCg3cRGG 36WDjUmKifyceBkQEfU433igAgo60SiR8dYbxMT+2R5/yLKQ9BqKbNS5qJ/PQqlnmeY2 rQCZ3/AeM1KzFJALcZ2gVz7PqG+ogdczhMGxheLIaXkLjaBH1BvnxRk5K8UgO+5yrPSn gj9Kd/cumovqA1K3XHqNX4SmIoldeiGBbl5qYijTNtCjpDFLgCAS6iUzlZGZNM6qBc6a aQpA== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=qNVsakGsohC1LfWWje1Vm0+orzibCMvnhKFmXqLLufE=; b=s4Kcryl0l8fNLv/zlT/DuvoaRN4uekpbZYlfSS6R3nulkGf6FlrTA0Cgldu0jQK46V wIPGXsZepUbFm4KZr7Fpn9iUxbsjGmT5RYA6MMnUtS4xYI5kTuveyIej0GixK4dFA39T yMtOEQCMy6DRaa/fLG3AUE8auVYA+ypJ1i5YP1jykLIhyr73FZ/bWinCp+uQtC89eTWs CYP6xN7cWhjkfh7LNhOZNkNW5+89uHjaJuwK63LT+bEtwmD2o6R2U903kxLnYSWan2kU jBkHAXlJz+wUA3iILC5XZn6A2fQ7muF7jK5z/0fq/FRUTcnnUi17BfUrc7PIyCC+Rwpu ORNg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@zx2c4.com header.s=mail header.b=iiLaXx7h; spf=pass (google.com: best guess record for domain of netdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=zx2c4.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j23si8614741otr.48.2019.12.15.13.08.21; Sun, 15 Dec 2019 13:08:21 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of netdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@zx2c4.com header.s=mail header.b=iiLaXx7h; spf=pass (google.com: best guess record for domain of netdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=zx2c4.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726638AbfLOVIU (ORCPT + 9 others); Sun, 15 Dec 2019 16:08:20 -0500 Received: from frisell.zx2c4.com ([192.95.5.64]:48739 "EHLO frisell.zx2c4.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726295AbfLOVIT (ORCPT ); Sun, 15 Dec 2019 16:08:19 -0500 Received: by frisell.zx2c4.com (ZX2C4 Mail Server) with ESMTP id b25e1eae; Sun, 15 Dec 2019 20:12:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=zx2c4.com; h=from:to:cc :subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; s=mail; bh=a8eskatTy4UVgwpkFMQBIMM69 TA=; b=iiLaXx7hEQXXsZ4vFIkzbDRJ9zuaBNEbPDUAvm+PggaM+4mLyf+ZAfs2O 8H76OxSJHcdcadRXMdfyBk3jd4NuETf2z8Wq0ws2c+ndqciESCcldoEckRxIO6qr 5i88SuWMQl65D39nuFb5mP9f9TzLKoLEmphChdWanJXR2QLP4Sq62SKI8kiRV3DV gVUa55+dnHjdw8YXUjgQeIJYn8egeFOQ5wK+HSu8PtgD93yVZkjSjZbPR26EKw+2 wSNzja7zq48eTiA2Jk4MAuXOloMnuTyeakOvx1bgT0rscfEOLuPZkl71EsB3ibwP rgo9S2BRGnxylKGPPTyntb8dgiaHQ== Received: by frisell.zx2c4.com (ZX2C4 Mail Server) with ESMTPSA id d7bee12e (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256:NO); Sun, 15 Dec 2019 20:12:03 +0000 (UTC) From: "Jason A. Donenfeld" To: davem@davemloft.net, netdev@vger.kernel.org Cc: Wei Yongjun , "Jason A . Donenfeld" Subject: [PATCH net-next 5/5] wireguard: allowedips: use kfree_rcu() instead of call_rcu() Date: Sun, 15 Dec 2019 22:08:04 +0100 Message-Id: <20191215210804.143919-6-Jason@zx2c4.com> In-Reply-To: <20191215210804.143919-1-Jason@zx2c4.com> References: <20191215210804.143919-1-Jason@zx2c4.com> MIME-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Wei Yongjun The callback function of call_rcu() just calls a kfree(), so we can use kfree_rcu() instead of call_rcu() + callback function. Signed-off-by: Wei Yongjun Signed-off-by: Jason A. Donenfeld --- drivers/net/wireguard/allowedips.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) -- 2.24.1 diff --git a/drivers/net/wireguard/allowedips.c b/drivers/net/wireguard/allowedips.c index 72667d5399c3..121d9ea0f135 100644 --- a/drivers/net/wireguard/allowedips.c +++ b/drivers/net/wireguard/allowedips.c @@ -31,11 +31,6 @@ static void copy_and_assign_cidr(struct allowedips_node *node, const u8 *src, #define CHOOSE_NODE(parent, key) \ parent->bit[(key[parent->bit_at_a] >> parent->bit_at_b) & 1] -static void node_free_rcu(struct rcu_head *rcu) -{ - kfree(container_of(rcu, struct allowedips_node, rcu)); -} - static void push_rcu(struct allowedips_node **stack, struct allowedips_node __rcu *p, unsigned int *len) { @@ -112,7 +107,7 @@ static void walk_remove_by_peer(struct allowedips_node __rcu **top, if (!node->bit[0] || !node->bit[1]) { rcu_assign_pointer(*nptr, DEREF( &node->bit[!REF(node->bit[0])])); - call_rcu(&node->rcu, node_free_rcu); + kfree_rcu(node, rcu); node = DEREF(nptr); } }