From patchwork Thu Oct 15 20:00:29 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hal Rosenstock X-Patchwork-Id: 54081 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n9FK9sjx031265 for ; Thu, 15 Oct 2009 20:09:55 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758635AbZJOUAy (ORCPT ); Thu, 15 Oct 2009 16:00:54 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1758769AbZJOUAy (ORCPT ); Thu, 15 Oct 2009 16:00:54 -0400 Received: from qmta05.westchester.pa.mail.comcast.net ([76.96.62.48]:59418 "EHLO QMTA05.westchester.pa.mail.comcast.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758635AbZJOUAy (ORCPT ); Thu, 15 Oct 2009 16:00:54 -0400 Received: from OMTA24.westchester.pa.mail.comcast.net ([76.96.62.76]) by QMTA05.westchester.pa.mail.comcast.net with comcast id t3WT1c0071ei1Bg5580JBw; Thu, 15 Oct 2009 20:00:18 +0000 Received: from hal.comcast.net ([75.69.247.31]) by OMTA24.westchester.pa.mail.comcast.net with comcast id t86t1c0060hNrtn3k86tTY; Thu, 15 Oct 2009 20:06:53 +0000 Received: from hal.comcast.net (localhost.localdomain [127.0.0.1]) by hal.comcast.net (8.14.3/8.14.3) with ESMTP id n9FK0jbT014885; Thu, 15 Oct 2009 16:00:50 -0400 Received: (from hnrose@localhost) by hal.comcast.net (8.14.3/8.14.3/Submit) id n9FK0TKt014855; Thu, 15 Oct 2009 16:00:29 -0400 Date: Thu, 15 Oct 2009 16:00:29 -0400 From: Hal Rosenstock To: sashak@voltaire.com Cc: linux-rdma@vger.kernel.org Subject: [PATCHv2] opensm/osm_ucast_updn.c: Further reduction in cas_per_sw allocation Message-ID: <20091015200028.GA14851@comcast.net> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.19 (2009-01-05) Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org diff --git a/opensm/opensm/osm_ucast_updn.c b/opensm/opensm/osm_ucast_updn.c index ced076a..e81a299 100644 --- a/opensm/opensm/osm_ucast_updn.c +++ b/opensm/opensm/osm_ucast_updn.c @@ -432,13 +432,14 @@ static void updn_find_root_nodes_by_min_hop(OUT updn_t * p_updn) "Current number of ports in the subnet is %d\n", cl_qmap_count(&p_osm->subn.port_guid_tbl)); - cas_per_sw = malloc(p_osm->subn.max_ucast_lid_ho * sizeof(*cas_per_sw)); + lid_ho = (uint16_t) cl_ptr_vector_get_size(&p_updn->p_osm->subn.port_lid_tbl) + 1; + cas_per_sw = malloc(lid_ho * sizeof(*cas_per_sw)); if (!cas_per_sw) { OSM_LOG(&p_osm->log, OSM_LOG_ERROR, "ERR AA14: " "cannot alloc mem for CAs per switch counter array\n"); goto _exit; } - memset(cas_per_sw, 0, p_osm->subn.max_ucast_lid_ho * sizeof(*cas_per_sw)); + memset(cas_per_sw, 0, lid_ho * sizeof(*cas_per_sw)); /* Find the Maximum number of CAs (and routers) for histogram normalization */ OSM_LOG(&p_osm->log, OSM_LOG_VERBOSE,