Sophie

Sophie

distrib > * > 2008.0 > x86_64 > by-pkgid > c9debea5be5d2b8d9609815d27698609 > files > 18

torque-2.1.7-3mdv2008.0.src.rpm

diff -aur OpenPBS_2_3_16/src/resmom/mom_main.c OpenPBS_2_3_16.diff/src/resmom/mom_main.c
--- OpenPBS_2_3_16/src/resmom/mom_main.c	Tue Dec  4 18:38:45 2001
+++ OpenPBS_2_3_16.diff/src/resmom/mom_main.c	Wed Jun 12 07:39:32 2002
@@ -133,6 +133,7 @@
 #include	"dis.h"
 #include	"dis_init.h"
 #include	"resmon.h"
+#include  <sys/mman.h>
 
 static char ident[] = "@(#) $RCSfile: mom_main.c,v $ $Revision: 2.16.2.1.2.10 $";
 
@@ -1783,6 +1784,8 @@
 	resource	*prscput;
 	extern char	*optarg;
 	extern int	optind;
+	int		mlockall_return;
+  int   mlockall_counter = 0;
 
 	/* If we are not run with real and effective uid of 0, forget it */
 
@@ -2372,6 +2375,20 @@
 				pjob->ji_qs.ji_svrflags |= JOB_SVFLG_OVERLMT1;
 			}
 		}
+
+                /* call mlockall() only 1 times, since it seems to leak mem */
+                if (!mlockall_counter)
+                {
+                /* make sure pbs_mom stays in RAM and doesn't get paged out */
+                        mlockall_return= mlockall(MCL_CURRENT | MCL_FUTURE);
+
+                        if (mlockall_return == -1)
+                        {
+                                perror("pbs_mom:mom_main.c:mlockall():");
+                                exit(1);
+                        }
+                        mlockall_counter++;
+		}
 	}
 
 	/* kill any running jobs */