From 2df5f9bf5bdd4cd0becaab592be8bd086c19f5cb Mon Sep 17 00:00:00 2001
From: Don Lipari <lipari1@llnl.gov>
Date: Fri, 4 Dec 2009 22:31:27 +0000
Subject: [PATCH] Remove MEM_PER_CPU flag from real memory requirement in
 sched/wiki2/get_jobs.c

---
 doc/man/man1/salloc.1              | 2 +-
 doc/man/man1/sbatch.1              | 2 +-
 doc/man/man1/srun.1                | 2 +-
 src/plugins/sched/wiki2/get_jobs.c | 8 ++++++--
 4 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/doc/man/man1/salloc.1 b/doc/man/man1/salloc.1
index 345fe67411e..8265109cf70 100644
--- a/doc/man/man1/salloc.1
+++ b/doc/man/man1/salloc.1
@@ -496,7 +496,7 @@ Specify the real memory required per node in MegaBytes.
 Default value is \fBDefMemPerNode\fR and the maximum value is
 \fBMaxMemPerNode\fR. If configured, both of parameters can be
 seen using the \fBscontrol show config\fR command.
-This parameter would generally be used of whole nodes
+This parameter would generally be used if whole nodes
 are allocated to jobs (\fBSelectType=select/linear\fR).
 Also see \fB\-\-mem\-per\-cpu\fR.
 \fB\-\-mem\fR and \fB\-\-mem\-per\-cpu\fR are mutually exclusive.
diff --git a/doc/man/man1/sbatch.1 b/doc/man/man1/sbatch.1
index 88266b3a372..5e0c856c189 100644
--- a/doc/man/man1/sbatch.1
+++ b/doc/man/man1/sbatch.1
@@ -526,7 +526,7 @@ Specify the real memory required per node in MegaBytes.
 Default value is \fBDefMemPerNode\fR and the maximum value is
 \fBMaxMemPerNode\fR. If configured, both of parameters can be
 seen using the \fBscontrol show config\fR command.
-This parameter would generally be used of whole nodes
+This parameter would generally be used if whole nodes
 are allocated to jobs (\fBSelectType=select/linear\fR).
 Also see \fB\-\-mem\-per\-cpu\fR.
 \fB\-\-mem\fR and \fB\-\-mem\-per\-cpu\fR are mutually exclusive.
diff --git a/doc/man/man1/srun.1 b/doc/man/man1/srun.1
index a637b6db963..1b2e9cc64f0 100644
--- a/doc/man/man1/srun.1
+++ b/doc/man/man1/srun.1
@@ -542,7 +542,7 @@ Specify the real memory required per node in MegaBytes.
 Default value is \fBDefMemPerNode\fR and the maximum value is
 \fBMaxMemPerNode\fR. If configured, both of parameters can be
 seen using the \fBscontrol show config\fR command.
-This parameter would generally be used of whole nodes
+This parameter would generally be used if whole nodes
 are allocated to jobs (\fBSelectType=select/linear\fR).
 Also see \fB\-\-mem\-per\-cpu\fR.
 \fB\-\-mem\fR and \fB\-\-mem\-per\-cpu\fR are mutually exclusive.
diff --git a/src/plugins/sched/wiki2/get_jobs.c b/src/plugins/sched/wiki2/get_jobs.c
index b6974b8c9bf..ddb4d54ef71 100644
--- a/src/plugins/sched/wiki2/get_jobs.c
+++ b/src/plugins/sched/wiki2/get_jobs.c
@@ -236,7 +236,7 @@ static char *	_dump_job(struct job_record *job_ptr, time_t update_time)
 {
 	char *buf = NULL, tmp[16384];
 	char *gname, *quote, *uname;
-	uint32_t end_time, suspend_time;
+	uint32_t end_time, suspend_time, min_mem;
 	int i, rej_sent = 0;
 
 	if (!job_ptr)
@@ -338,9 +338,13 @@ static char *	_dump_job(struct job_record *job_ptr, time_t update_time)
 		job_ptr->partition);
 	xstrcat(buf, tmp);
 
+	min_mem = _get_job_min_mem(job_ptr);
+	if (min_mem & MEM_PER_CPU) {
+		min_mem &= ~MEM_PER_CPU;
+	}
 	snprintf(tmp, sizeof(tmp),
 		"RMEM=%u;RDISK=%u;",
-		_get_job_min_mem(job_ptr),
+		 min__mem,
 		_get_job_min_disk(job_ptr));
 	xstrcat(buf, tmp);
 
-- 
GitLab