Received: by 2002:a25:824b:0:0:0:0:0 with SMTP id d11csp2967411ybn; Thu, 26 Sep 2019 21:59:42 -0700 (PDT) X-Google-Smtp-Source: APXvYqz0TzVt66JTYXrPxffozQozZNLSYfTZDSsDirg8Uc2rqHdnMophXV/QJzcetV2FDaVLAzYo X-Received: by 2002:a17:906:8043:: with SMTP id x3mr6197878ejw.221.1569560382485; Thu, 26 Sep 2019 21:59:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569560382; cv=none; d=google.com; s=arc-20160816; b=FuCLFSVrs13j2chR1D/Q7SPAKLfcD0DiRztGhCzGogSaNfkDchsoWhUd/uN8JMftUk j6GKpY2J2Ok/5Y+OZZvB0SevkNvYG6FwL1jqMO4QRCdvCFYhL5dHkwjt3eOmoKQGVBBL wke7RSl9kHbLYXr0FKQxDG37QncwcGsot72DXitU+okcOBXdN/DCnU/J4jxrVD5YwQWs Q8bQ6UI0hiUSlDIsD0q9w8lynJAKpcuj2Ink+mb8W70Zf1UgkD3UPm4a4O4Dnlci9wBl eeVQl303UWSRlb6h0BVzSWoB5WfhjsiOowoWMZmWhQ076UmXy/dT0g13GP1V8Kms8UBA j3SA== 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=3oTC+AJKlq8T06Ki5fgdOt5J1YGM9LQNNa25FHr1FzU=; b=vmC73115lPLAlFlG5VpCsohflPbkZfOPYRg+J/QivIUb9jZpsBzOS3IiHfzJbRd2hr yLlAJMPsGrNNKCDtqOAh4fSJeB1QfYd+Qaulq/gO2a596/XfjCXAobkS1ZPyJd7s+Wxb sDYEy+1+ZHE60zSK/Nlt+KA1E1nhNfvP2KCF1fg/HnBFEniH5KfXcc6SDR9D4MYMb76G mDM7bkGImbjK9mb1UZy+CpszZKL1x4qK131f7znGLmydvucw3a54bHsTetrusCrZE6wQ CZ87RpmmLx8W28vrwwynhinGObqmcDvmFXPjCc6yvMJrQv1t5pU12//qElOxjTOduB/g T4sw== 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 g18si833685edq.209.2019.09.26.21.59.18; Thu, 26 Sep 2019 21:59:42 -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 S1728984AbfI0Ezs (ORCPT + 99 others); Fri, 27 Sep 2019 00:55:48 -0400 Received: from cmccmta2.chinamobile.com ([221.176.66.80]:2981 "EHLO cmccmta2.chinamobile.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725996AbfI0Ezs (ORCPT ); Fri, 27 Sep 2019 00:55:48 -0400 Received: from spf.mail.chinamobile.com (unknown[172.16.121.19]) by rmmx-syy-dmz-app05-12005 (RichMail) with SMTP id 2ee55d8d963cffc-3ac18; Fri, 27 Sep 2019 12:55:24 +0800 (CST) X-RM-TRANSID: 2ee55d8d963cffc-3ac18 X-RM-TagInfo: emlType=0 X-RM-SPAM-FLAG: 00000000 Received: from localhost (unknown[223.105.0.241]) by rmsmtp-syy-appsvr10-12010 (RichMail) with SMTP id 2eea5d8d963bc64-9fd87; Fri, 27 Sep 2019 12:55:24 +0800 (CST) X-RM-TRANSID: 2eea5d8d963bc64-9fd87 From: Haishuang Yan To: Julian Anastasov , "David S. Miller" , Pablo Neira Ayuso Cc: netdev@vger.kernel.org, lvs-devel@vger.kernel.org, linux-kernel@vger.kernel.org, netfilter-devel@vger.kernel.org, Haishuang Yan Subject: [PATCH v2 2/2] ipvs: batch __ip_vs_dev_cleanup Date: Fri, 27 Sep 2019 12:54:51 +0800 Message-Id: <1569560091-20553-3-git-send-email-yanhaishuang@cmss.chinamobile.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1569560091-20553-1-git-send-email-yanhaishuang@cmss.chinamobile.com> References: <1569560091-20553-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 --- v2: remove unused pointer list --- net/netfilter/ipvs/ip_vs_core.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/net/netfilter/ipvs/ip_vs_core.c b/net/netfilter/ipvs/ip_vs_core.c index 93cfb47..512259f 100644 --- a/net/netfilter/ipvs/ip_vs_core.c +++ b/net/netfilter/ipvs/ip_vs_core.c @@ -2433,14 +2433,19 @@ 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; + 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); } @@ -2453,7 +2458,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