From patchwork Thu Feb 27 21:17:25 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Simmons X-Patchwork-Id: 11410817 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 55EC61580 for ; Thu, 27 Feb 2020 21:47:36 +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 3E89B24690 for ; Thu, 27 Feb 2020 21:47:36 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3E89B24690 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 1672434B4AD; Thu, 27 Feb 2020 13:37:35 -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 849C33489B0 for ; Thu, 27 Feb 2020 13:21:18 -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 136BC91DC; Thu, 27 Feb 2020 16:18:20 -0500 (EST) Received: by star.ccs.ornl.gov (Postfix, from userid 2004) id 11B2446A; Thu, 27 Feb 2020 16:18:20 -0500 (EST) From: James Simmons To: Andreas Dilger , Oleg Drokin , NeilBrown Date: Thu, 27 Feb 2020 16:17:25 -0500 Message-Id: <1582838290-17243-578-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 577/622] lnet: Avoid extra lnet_remotenet lookup 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: Chris Horn We can keep track of the lnet_remotenet object associated with the "best" lnet_peer_net, and pass that lnet_remotenet directly to lnet_find_route_locked(). WC-bug-id: https://jira.whamcloud.com/browse/LU-12756 Lustre-commit: 3812c54b9ca3 ("LU-12756 lnet: Avoid extra lnet_remotenet lookup") Signed-off-by: Chris Horn Reviewed-on: https://review.whamcloud.com/36536 Reviewed-by: Alexandr Boyko Reviewed-by: Alexey Lyashkov Reviewed-by: Amir Shehata Reviewed-by: Oleg Drokin Signed-off-by: James Simmons --- net/lnet/lnet/lib-move.c | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/net/lnet/lnet/lib-move.c b/net/lnet/lnet/lib-move.c index 45975d6..03d629d 100644 --- a/net/lnet/lnet/lib-move.c +++ b/net/lnet/lnet/lib-move.c @@ -1324,23 +1324,18 @@ void lnet_usr_translate_stats(struct lnet_ioctl_element_msg_stats *msg_stats, } static struct lnet_route * -lnet_find_route_locked(struct lnet_net *net, u32 remote_net, +lnet_find_route_locked(struct lnet_remotenet *rnet, struct lnet_route **prev_route, struct lnet_peer_ni **gwni) { struct lnet_peer_ni *best_gw_ni = NULL; struct lnet_route *best_route; struct lnet_route *last_route; - struct lnet_remotenet *rnet; struct lnet_peer *lp_best; struct lnet_route *route; struct lnet_peer *lp; int rc; - rnet = lnet_find_rnet_locked(remote_net); - if (!rnet) - return NULL; - lp_best = NULL; best_route = NULL; last_route = NULL; @@ -1832,7 +1827,7 @@ struct lnet_ni * struct lnet_peer *lp; struct lnet_peer_net *lpn; struct lnet_peer_net *best_lpn = NULL; - struct lnet_remotenet *rnet; + struct lnet_remotenet *rnet, *best_rnet = NULL; struct lnet_route *best_route = NULL; struct lnet_route *last_route = NULL; struct lnet_peer_ni *lpni = NULL; @@ -1867,13 +1862,16 @@ struct lnet_ni * if (!rnet) continue; - if (!best_lpn) + if (!best_lpn) { best_lpn = lpn; + best_rnet = rnet; + } if (best_lpn->lpn_seq <= lpn->lpn_seq) continue; best_lpn = lpn; + best_rnet = rnet; } if (!best_lpn) { @@ -1892,8 +1890,8 @@ struct lnet_ni * return -EHOSTUNREACH; } - best_route = lnet_find_route_locked(NULL, best_lpn->lpn_net_id, - &last_route, &gwni); + best_route = lnet_find_route_locked(best_rnet, &last_route, + &gwni); if (!best_route) { CERROR("no route to %s from %s\n", libcfs_nid2str(dst_nid),