From ec59bb1b86344823ebbe38deb32c6e77f1b95a36 Mon Sep 17 00:00:00 2001
From: Danny Auble <da@schedmd.com>
Date: Fri, 7 Nov 2014 11:09:58 -0800
Subject: [PATCH] Minor performance mod to commit 3f736aa2e9f

---
 src/slurmctld/node_scheduler.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/slurmctld/node_scheduler.c b/src/slurmctld/node_scheduler.c
index 5ce310b0f64..0aa1c396355 100644
--- a/src/slurmctld/node_scheduler.c
+++ b/src/slurmctld/node_scheduler.c
@@ -1682,9 +1682,11 @@ extern int select_nodes(struct job_record *job_ptr, bool test_only,
 	/* Set this guess here to give the user tools an idea
 	 * of how many nodes Slurm is planning on giving the job.
 	 * This needs to be done on success or not.  It means the job
-	 * could run on nodes.
+	 * could run on nodes.  We only set the wag once to avoid
+	 * having to go through the bit logic multiple times.
 	 */
-	if (select_bitmap) {
+	if (select_bitmap
+	    && ((error_code == SLURM_SUCCESS) || !job_ptr->node_cnt_wag)) {
 #ifdef HAVE_BG
 		xassert(job_ptr->select_jobinfo);
 		select_g_select_jobinfo_get(job_ptr->select_jobinfo,
-- 
GitLab