]> git.ipfire.org Git - thirdparty/make.git/commitdiff
* src/job.c (load_too_high): Disable Linux /proc/loadavg for now
authorPaul Smith <psmith@gnu.org>
Tue, 17 Dec 2019 17:29:44 +0000 (12:29 -0500)
committerPaul Smith <psmith@gnu.org>
Tue, 17 Dec 2019 20:06:28 +0000 (15:06 -0500)
This new feature has a problem: if you provide a load which is
larger than the number of cores then it will always run every job.
Before we can enable it we need to at the least learn how to clamp
this value to the number of cores.  To experiment with it, set
PROC_FD_INIT to -2 in job.c to re-enable the feature.

src/job.c

index 0052b0cd1da17a72b991ed88114fc74874c53aa9..8c8f0ad9c574ac3d257ed1db91d0c15a04022caf 100644 (file)
--- a/src/job.c
+++ b/src/job.c
@@ -2008,7 +2008,18 @@ load_too_high (void)
 #else
   static double last_sec;
   static time_t last_now;
-  static int proc_fd = -2;
+
+  /* This is disabled by default for now, because it will behave badly if the
+     user gives a value > the number of cores; in that situation the load will
+     never be exceeded, this function always returns false, and we'll start
+     all the jobs.  Also, it's not quite right to limit jobs to the number of
+     cores not busy since a job takes some time to start etc.  Maybe that's
+     OK, I'm not sure exactly how to handle that, but for sure we need to
+     clamp this value at the number of cores before this can be enabled.
+   */
+#define PROC_FD_INIT -1
+  static int proc_fd = PROC_FD_INIT;
+
   double load, guess;
   time_t now;