From patchwork Wed Jul 13 01:09:31 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ira Weiny X-Patchwork-Id: 969782 X-Patchwork-Delegate: alexne@voltaire.com Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter2.kernel.org (8.14.4/8.14.4) with ESMTP id p6D1FwbW024677 for ; Wed, 13 Jul 2011 01:15:59 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756661Ab1GMBJc (ORCPT ); Tue, 12 Jul 2011 21:09:32 -0400 Received: from nspiron-1.llnl.gov ([128.115.41.81]:55693 "EHLO nspiron-1.llnl.gov" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755204Ab1GMBJc (ORCPT ); Tue, 12 Jul 2011 21:09:32 -0400 X-Attachments: None Received: from eris.llnl.gov (HELO trebuchet) ([134.9.2.84]) by nspiron-1.llnl.gov with SMTP; 12 Jul 2011 18:09:31 -0700 Date: Tue, 12 Jul 2011 18:09:31 -0700 From: Ira Weiny To: Alex Netes Cc: "linux-rdma@vger.kernel.org" Subject: [PATCH] opensm: perfmgr only run sweep timer when enabled. Message-Id: <20110712180931.671ce7c5.weiny2@llnl.gov> X-Mailer: Sylpheed 3.1.1 (GTK+ 2.18.9; x86_64-unknown-linux-gnu) Mime-Version: 1.0 Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter2.kernel.org [140.211.167.43]); Wed, 13 Jul 2011 01:15:59 +0000 (UTC) Signed-off-by: Ira Weiny --- include/opensm/osm_perfmgr.h | 7 +++++-- opensm/osm_perfmgr.c | 6 +++--- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/include/opensm/osm_perfmgr.h b/include/opensm/osm_perfmgr.h index 34925e8..67c0ce4 100644 --- a/include/opensm/osm_perfmgr.h +++ b/include/opensm/osm_perfmgr.h @@ -167,8 +167,11 @@ inline static void osm_perfmgr_set_state(osm_perfmgr_t * p_perfmgr, osm_perfmgr_state_t state) { p_perfmgr->state = state; - if (state == PERFMGR_STATE_ENABLED) - osm_sm_signal(p_perfmgr->sm, OSM_SIGNAL_PERFMGR_SWEEP); + if (state == PERFMGR_STATE_ENABLED) { + cl_timer_start(&p_perfmgr->sweep_timer, p_perfmgr->sweep_time_s * 1000); + } else { + cl_timer_stop(&p_perfmgr->sweep_timer); + } } inline static osm_perfmgr_state_t osm_perfmgr_get_state(osm_perfmgr_t * perfmgr) diff --git a/opensm/osm_perfmgr.c b/opensm/osm_perfmgr.c index cb1329e..ded5a5e 100644 --- a/opensm/osm_perfmgr.c +++ b/opensm/osm_perfmgr.c @@ -860,8 +860,7 @@ static void perfmgr_sweep(void *arg) { osm_perfmgr_t *pm = arg; - if (pm->state == PERFMGR_STATE_ENABLED) - osm_sm_signal(pm->sm, OSM_SIGNAL_PERFMGR_SWEEP); + osm_sm_signal(pm->sm, OSM_SIGNAL_PERFMGR_SWEEP); cl_timer_start(&pm->sweep_timer, pm->sweep_time_s * 1000); } @@ -1380,7 +1379,8 @@ ib_api_status_t osm_perfmgr_init(osm_perfmgr_t * pm, osm_opensm_t * osm, init_monitored_nodes(pm); - cl_timer_start(&pm->sweep_timer, pm->sweep_time_s * 1000); + if (pm->state == PERFMGR_STATE_ENABLED) + cl_timer_start(&pm->sweep_timer, pm->sweep_time_s * 1000); status = IB_SUCCESS; Exit: