mirror of
https://github.com/mirror/make.git
synced 2025-03-03 22:30:59 +08:00
* src/job.c (load_too_high): Re-enable Linux /proc/loadavg checks.
Further experimentation shows that my previous thinking that there was a problem using this was woefully mistaken. The value generated by the kernel shows runn*ABLE* processes not runn*ING* processes. * NEWS: Announce the change.
This commit is contained in:
parent
aab51f7ef2
commit
15db387f18
6
NEWS
6
NEWS
@ -55,6 +55,12 @@ https://sv.gnu.org/bugs/index.php?group=make&report_id=111&fix_release_id=109&se
|
|||||||
comparison.
|
comparison.
|
||||||
Implementation provided by Jouke Witteveen <j.witteveen@gmail.com>
|
Implementation provided by Jouke Witteveen <j.witteveen@gmail.com>
|
||||||
|
|
||||||
|
* New feature: Improved support for -l / --load-average
|
||||||
|
On systems that provide /proc/loadavg (Linux), GNU make will use it to
|
||||||
|
determine the number of runnable jobs and use this as the current load,
|
||||||
|
avoiding the need for heuristics.
|
||||||
|
Implementation provided by Sven C. Dack <sdack@gmx.com>
|
||||||
|
|
||||||
* If the MAKEFLAGS variable is modified in a makefile, it will be re-parsed
|
* If the MAKEFLAGS variable is modified in a makefile, it will be re-parsed
|
||||||
immediately rather than after all makefiles have been read. Note that
|
immediately rather than after all makefiles have been read. Note that
|
||||||
although all options are parsed immediately, some special effects won't
|
although all options are parsed immediately, some special effects won't
|
||||||
|
23
src/job.c
23
src/job.c
@ -1948,12 +1948,13 @@ job_next_command (struct child *child)
|
|||||||
|
|
||||||
On systems which provide /proc/loadavg (e.g., Linux), we use an idea
|
On systems which provide /proc/loadavg (e.g., Linux), we use an idea
|
||||||
provided by Sven C. Dack <sven.c.dack@sky.com>: retrieve the current number
|
provided by Sven C. Dack <sven.c.dack@sky.com>: retrieve the current number
|
||||||
of processes the kernel is running and, if it's greater than the requested
|
of runnable processes, if it's greater than the requested load we don't
|
||||||
load we don't allow another job to start. We allow a job to start with
|
allow another job to start. We allow a job to start with equal processes
|
||||||
equal processes since one of those will be for make itself, which will then
|
since one of those will be for make itself, which will then pause waiting
|
||||||
pause waiting for jobs to clear.
|
for jobs to clear.
|
||||||
|
|
||||||
Otherwise, we obtain the system load average and compare that.
|
If /proc/loadavg is not available for some reason, we obtain the system
|
||||||
|
load average and compare that.
|
||||||
|
|
||||||
The system load average is only recomputed once every N (N>=1) seconds.
|
The system load average is only recomputed once every N (N>=1) seconds.
|
||||||
However, a very parallel make can easily start tens or even hundreds of
|
However, a very parallel make can easily start tens or even hundreds of
|
||||||
@ -2006,17 +2007,7 @@ load_too_high (void)
|
|||||||
#else
|
#else
|
||||||
static double last_sec;
|
static double last_sec;
|
||||||
static time_t last_now;
|
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;
|
double load, guess;
|
||||||
time_t now;
|
time_t now;
|
||||||
|
Loading…
Reference in New Issue
Block a user