From 7db3406210b2ad8d96f9edb3f95d4987e4689ed7 Mon Sep 17 00:00:00 2001
From: Moe Jette <jette1@llnl.gov>
Date: Wed, 25 Mar 2009 17:48:01 +0000
Subject: [PATCH] Add logic for bluegene so that a job will be started
 immediately if  possible even when there are higher priority jobs ONLY in
 static  partitioning mode.

---
 .../select/bluegene/plugin/select_bluegene.c  | 10 ++++++++-
 src/slurmctld/job_mgr.c                       | 21 +++++++++++++------
 src/slurmctld/slurmctld.h                     |  4 +++-
 3 files changed, 27 insertions(+), 8 deletions(-)

diff --git a/src/plugins/select/bluegene/plugin/select_bluegene.c b/src/plugins/select/bluegene/plugin/select_bluegene.c
index abe836f21c7..02167d45835 100644
--- a/src/plugins/select/bluegene/plugin/select_bluegene.c
+++ b/src/plugins/select/bluegene/plugin/select_bluegene.c
@@ -2,7 +2,7 @@
  *  select_bluegene.c - node selection plugin for Blue Gene system.
  *****************************************************************************
  *  Copyright (C) 2004-2007 The Regents of the University of California.
- *  Copyright (C) 2008 Lawrence Livermore National Security.
+ *  Copyright (C) 2008-2009 Lawrence Livermore National Security.
  *  Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER).
  *  Written by Dan Phung <phung4@llnl.gov> Danny Auble <da@llnl.gov>
  *  CODE-OCEC-09-009. All rights reserved.
@@ -912,6 +912,14 @@ extern int select_p_get_info_from_plugin (enum select_data_info info,
 					  struct job_record *job_ptr,
 					  void *data)
 {
+	if (info == SELECT_STATIC_PART) {
+		uint16_t *tmp16 = (uint16_t *) data;
+		if (bluegene_layout_mode == LAYOUT_STATIC)
+			*tmp16 = 1;
+		else
+			*tmp16 = 0;
+	}
+
 	return SLURM_SUCCESS;
 }
 
diff --git a/src/slurmctld/job_mgr.c b/src/slurmctld/job_mgr.c
index a73aea16745..0c96e5388d3 100644
--- a/src/slurmctld/job_mgr.c
+++ b/src/slurmctld/job_mgr.c
@@ -4254,15 +4254,24 @@ void reset_job_priority(void)
  */
 static bool _top_priority(struct job_record *job_ptr)
 {
-#ifdef HAVE_BG
-	/* On BlueGene, all jobs run ASAP. 
-	 * Priority only matters within a specific job size. */
-	return true;
-
-#else
 	struct job_details *detail_ptr = job_ptr->details;
 	bool top;
 
+#ifdef HAVE_BG
+	uint16_t static_part = 0;
+	int rc;
+
+	/* On BlueGene with static partitioning, we don't want to delay
+	 * jobs based upon priority since jobs of different sizes can 
+	 * execute on different sets of nodes. While sched/backfill would
+	 * eventually start the job if delayed here based upon priority,
+	 * that could delay the initiation of a job by a few seconds. */
+	rc = select_g_get_info_from_plugin(SELECT_STATIC_PART, job_ptr, 
+					   &static_part);
+	if ((rc == SLURM_SUCCESS) && (static_part == 1))
+		return true;
+#endif
+
 	if (job_ptr->priority == 0)	/* user held */
 		top = false;
 	else {
diff --git a/src/slurmctld/slurmctld.h b/src/slurmctld/slurmctld.h
index 9bc72122414..69040ba630d 100644
--- a/src/slurmctld/slurmctld.h
+++ b/src/slurmctld/slurmctld.h
@@ -610,7 +610,9 @@ enum select_data_info {
 	SELECT_BITMAP,       /* data-> partially_idle_bitmap (CR support) */
 	SELECT_ALLOC_CPUS,   /* data-> uint16 alloc cpus (CR support) */
 	SELECT_ALLOC_LPS,    /* data-> uint32 alloc lps  (CR support) */
-	SELECT_AVAIL_MEMORY  /* data-> uint32 avail mem  (CR support) */ 
+	SELECT_AVAIL_MEMORY, /* data-> uint32 avail mem  (CR support) */
+	SELECT_STATIC_PART   /* data-> uint16, 1 if static partitioning 
+			      * BlueGene support */
 } ;
 
 /*****************************************************************************\
-- 
GitLab