Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp2189331ybi; Sat, 13 Jul 2019 08:40:24 -0700 (PDT) X-Google-Smtp-Source: APXvYqxldpjjyH7BWPiG6PFMGVLQMSVpkyDNz/GAvPJKYM6l/Ku6JpIE0utdU/vVYxhCV1PH5DLS X-Received: by 2002:a17:90a:b908:: with SMTP id p8mr18857533pjr.94.1563032424071; Sat, 13 Jul 2019 08:40:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563032424; cv=none; d=google.com; s=arc-20160816; b=qmlTzIY3lRW+ts9LRvZrr9Efo1q1TDKcUfO9eiV3n6ZY4oIWWdep8ZnuKYxR1HG5lG CXCqSDAjndxEyzdIrk3MPKTpG1ItGzLSnDswDLN8eK8TeqrPLrm51zrMLDYbG2atlwlf 15jMEayFTAr8shLuPqWdntD3OoWMA3wLPUw23IfaKjaMTGD1MlQ1R2NCir+pcKG+pSzm xnLGyAYYezDO+dLcGu5NSHrIcOZ7dCBqoVIwp/N4ackDViKb8h8omhFhgKfnOoQfE4u+ 2WXCaAaGft6QasxPVX6w/Td1Hpe/LtaLWy09YcGIVkb0GXSEescgesoD5W/f/wM0QtfM 7cvA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=1mYspFeIYuWoo65Iey348VTKM+PUtf99vWNI+hTszvQ=; b=MvQ/80WOcT01hlbwGWAahR750bmMFglTQG11g1HOY4FO8uOS0wYTM/kUOtVXa9//If 8h8ySdOyXj1BvMo5U1u5qmYvjpxrGQnzBNoB/EEnlOrPMwlC7Ew2+YCbD04iBuePDcop Ye/2F/WS+2XxKMc8mCKHHMMsBUUhzh1iV+sRy8Jszrep40CDy3ikKbRWGxTMN6h/5nZ7 hbWV4MCH+/1RFrkTK4KO8Kdx3g5g1OZ0fBbmjetIl8DoCwGi1qQ9OMl5l18e8Zk+BuhM beZfgctNedo8/1CJHM0iuO+Fux0FZ4HrIR48g5FEIPg2aAVj68c+IOFxZL34QIxw7R5K nM2w== 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 d37si10711400pla.288.2019.07.13.08.40.09; Sat, 13 Jul 2019 08:40:24 -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 S1727936AbfGMPia (ORCPT + 99 others); Sat, 13 Jul 2019 11:38:30 -0400 Received: from cmccmta2.chinamobile.com ([221.176.66.80]:2141 "EHLO cmccmta2.chinamobile.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727656AbfGMPia (ORCPT ); Sat, 13 Jul 2019 11:38:30 -0400 Received: from spf.mail.chinamobile.com (unknown[172.16.121.5]) by rmmx-syy-dmz-app08-12008 (RichMail) with SMTP id 2ee85d29f77052c-3a621; Sat, 13 Jul 2019 23:23:28 +0800 (CST) X-RM-TRANSID: 2ee85d29f77052c-3a621 X-RM-TagInfo: emlType=0 X-RM-SPAM-FLAG: 00000000 Received: from localhost (unknown[223.105.0.241]) by rmsmtp-syy-appsvr03-12003 (RichMail) with SMTP id 2ee35d29f76f5a8-83a47; Sat, 13 Jul 2019 23:23:28 +0800 (CST) X-RM-TRANSID: 2ee35d29f76f5a8-83a47 From: Haishuang Yan To: "David S. Miller" , Pablo Neira Ayuso , Simon Horman Cc: netdev@vger.kernel.org, lvs-devel@vger.kernel.org, linux-kernel@vger.kernel.org, netfilter-devel@vger.kernel.org, Haishuang Yan Subject: [net-next 2/2] ipvs: batch __ip_vs_dev_cleanup Date: Sat, 13 Jul 2019 23:19:46 +0800 Message-Id: <1563031186-2101-3-git-send-email-yanhaishuang@cmss.chinamobile.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1563031186-2101-1-git-send-email-yanhaishuang@cmss.chinamobile.com> References: <1563031186-2101-1-git-send-email-yanhaishuang@cmss.chinamobile.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org It's better to batch __ip_vs_cleanup to speedup ipvs devices dismantle. Signed-off-by: Haishuang Yan --- net/netfilter/ipvs/ip_vs_core.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/net/netfilter/ipvs/ip_vs_core.c b/net/netfilter/ipvs/ip_vs_core.c index b4d79b7..58af24a 100644 --- a/net/netfilter/ipvs/ip_vs_core.c +++ b/net/netfilter/ipvs/ip_vs_core.c @@ -2434,14 +2434,20 @@ static int __net_init __ip_vs_dev_init(struct net *net) return ret; } -static void __net_exit __ip_vs_dev_cleanup(struct net *net) +static void __net_exit __ip_vs_dev_cleanup_batch(struct list_head *net_list) { - struct netns_ipvs *ipvs = net_ipvs(net); + struct netns_ipvs *ipvs; + struct net *net; + LIST_HEAD(list); + EnterFunction(2); - nf_unregister_net_hooks(net, ip_vs_ops, ARRAY_SIZE(ip_vs_ops)); - ipvs->enable = 0; /* Disable packet reception */ - smp_wmb(); - ip_vs_sync_net_cleanup(ipvs); + list_for_each_entry(net, net_list, exit_list) { + ipvs = net_ipvs(net); + nf_unregister_net_hooks(net, ip_vs_ops, ARRAY_SIZE(ip_vs_ops)); + ipvs->enable = 0; /* Disable packet reception */ + smp_wmb(); + ip_vs_sync_net_cleanup(ipvs); + } LeaveFunction(2); } @@ -2454,7 +2460,7 @@ static void __net_exit __ip_vs_dev_cleanup(struct net *net) static struct pernet_operations ipvs_core_dev_ops = { .init = __ip_vs_dev_init, - .exit = __ip_vs_dev_cleanup, + .exit_batch = __ip_vs_dev_cleanup_batch, }; /* -- 1.8.3.1