From patchwork Thu Feb 27 21:17:00 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Simmons X-Patchwork-Id: 11410687 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id AFA43924 for ; Thu, 27 Feb 2020 21:44:27 +0000 (UTC) Received: from pdx1-mailman02.dreamhost.com (pdx1-mailman02.dreamhost.com [64.90.62.194]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 983DC24690 for ; Thu, 27 Feb 2020 21:44:27 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 983DC24690 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lustre-devel-bounces@lists.lustre.org Received: from pdx1-mailman02.dreamhost.com (localhost [IPv6:::1]) by pdx1-mailman02.dreamhost.com (Postfix) with ESMTP id 4F6FA34A0FE; Thu, 27 Feb 2020 13:35:34 -0800 (PST) X-Original-To: lustre-devel@lists.lustre.org Delivered-To: lustre-devel-lustre.org@pdx1-mailman02.dreamhost.com Received: from smtp3.ccs.ornl.gov (smtp3.ccs.ornl.gov [160.91.203.39]) by pdx1-mailman02.dreamhost.com (Postfix) with ESMTP id 49A9B34893F for ; Thu, 27 Feb 2020 13:21:10 -0800 (PST) Received: from star.ccs.ornl.gov (star.ccs.ornl.gov [160.91.202.134]) by smtp3.ccs.ornl.gov (Postfix) with ESMTP id C0FB791C2; Thu, 27 Feb 2020 16:18:19 -0500 (EST) Received: by star.ccs.ornl.gov (Postfix, from userid 2004) id BF97246C; Thu, 27 Feb 2020 16:18:19 -0500 (EST) From: James Simmons To: Andreas Dilger , Oleg Drokin , NeilBrown Date: Thu, 27 Feb 2020 16:17:00 -0500 Message-Id: <1582838290-17243-553-git-send-email-jsimmons@infradead.org> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1582838290-17243-1-git-send-email-jsimmons@infradead.org> References: <1582838290-17243-1-git-send-email-jsimmons@infradead.org> Subject: [lustre-devel] [PATCH 552/622] lnet: discard lnd_refcount X-BeenThere: lustre-devel@lists.lustre.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "For discussing Lustre software development." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Lustre Development List MIME-Version: 1.0 Errors-To: lustre-devel-bounces@lists.lustre.org Sender: "lustre-devel" From: Mr NeilBrown The lnd_refcount in 'struct lnet_lnd' is never tested (except in an ASSERT()), so it cannot be needed. Let's remove it. Each individual lnd keeps track of how many lnet_ni are registered for that lnd e.g. ksocklnd has a counter in ksnd_nnets and o2iblnd has a linked list in kib_devs. They hold a reference on the module while there are registered devices, and the lnd is only freed (and the lnd_refcount checked) when the module is unloaded. This confirms that lnd_refcount adds no value. WC-bug-id: https://jira.whamcloud.com/browse/LU-12678 Lustre-commit: 606299929509 ("LU-12678 lnet: discard lnd_refcount") Signed-off-by: Mr NeilBrown Reviewed-on: https://review.whamcloud.com/36829 Reviewed-by: Serguei Smirnov Reviewed-by: James Simmons Reviewed-by: Chris Horn Reviewed-by: Amir Shehata Reviewed-by: Oleg Drokin Signed-off-by: James Simmons --- include/linux/lnet/lib-types.h | 1 - net/lnet/lnet/api-ni.c | 18 ------------------ 2 files changed, 19 deletions(-) diff --git a/include/linux/lnet/lib-types.h b/include/linux/lnet/lib-types.h index 4b110eb..e105308 100644 --- a/include/linux/lnet/lib-types.h +++ b/include/linux/lnet/lib-types.h @@ -246,7 +246,6 @@ struct lnet_test_peer { struct lnet_lnd { /* fields managed by portals */ struct list_head lnd_list; /* stash in the LND table */ - int lnd_refcount; /* # active instances */ /* fields initialised by the LND */ u32 lnd_type; diff --git a/net/lnet/lnet/api-ni.c b/net/lnet/lnet/api-ni.c index e66d9dc7..6c913b5 100644 --- a/net/lnet/lnet/api-ni.c +++ b/net/lnet/lnet/api-ni.c @@ -758,7 +758,6 @@ static void lnet_assert_wire_constants(void) LASSERT(!lnet_find_lnd_by_type(lnd->lnd_type)); list_add_tail(&lnd->lnd_list, &the_lnet.ln_lnds); - lnd->lnd_refcount = 0; CDEBUG(D_NET, "%s LND registered\n", libcfs_lnd2str(lnd->lnd_type)); @@ -772,7 +771,6 @@ static void lnet_assert_wire_constants(void) mutex_lock(&the_lnet.ln_lnd_mutex); LASSERT(lnet_find_lnd_by_type(lnd->lnd_type) == lnd); - LASSERT(!lnd->lnd_refcount); list_del(&lnd->lnd_list); CDEBUG(D_NET, "%s LND unregistered\n", libcfs_lnd2str(lnd->lnd_type)); @@ -2045,15 +2043,6 @@ static void lnet_push_target_fini(void) /* Do peer table cleanup for this net */ lnet_peer_tables_cleanup(net); - lnet_net_lock(LNET_LOCK_EX); - /* - * decrement ref count on lnd only when the entire network goes - * away - */ - net->net_lnd->lnd_refcount--; - - lnet_net_unlock(LNET_LOCK_EX); - lnet_net_free(net); } @@ -2134,9 +2123,6 @@ static void lnet_push_target_fini(void) if (rc) { LCONSOLE_ERROR_MSG(0x105, "Error %d starting up LNI %s\n", rc, libcfs_lnd2str(net->net_lnd->lnd_type)); - lnet_net_lock(LNET_LOCK_EX); - net->net_lnd->lnd_refcount--; - lnet_net_unlock(LNET_LOCK_EX); goto failed0; } @@ -2247,10 +2233,6 @@ static void lnet_push_target_fini(void) } } - lnet_net_lock(LNET_LOCK_EX); - lnd->lnd_refcount++; - lnet_net_unlock(LNET_LOCK_EX); - net->net_lnd = lnd; mutex_unlock(&the_lnet.ln_lnd_mutex);