- loadavg on Linux is a sum over all CPUs, so multiply LOADAVG_MX by the amount of CPUs when comparing to loadavg (bnc#889174) * added at-adjust_load_to_cpu_count.patch OBS-URL: https://build.opensuse.org/request/show/313311 OBS-URL: https://build.opensuse.org/package/show/Base:System/at?expand=0&rev=98
60 lines
2.1 KiB
Diff
60 lines
2.1 KiB
Diff
Index: at-3.1.16/at.1.in
|
|
===================================================================
|
|
--- at-3.1.16.orig/at.1.in 2015-06-23 18:12:35.348993941 +0200
|
|
+++ at-3.1.16/at.1.in 2015-06-23 18:48:39.666401868 +0200
|
|
@@ -68,6 +68,9 @@ deletes jobs, identified by their job nu
|
|
executes commands when system load levels permit; in other words, when the load average
|
|
drops below @LOADAVG_MX@, or the value specified in the invocation of
|
|
.BR atd .
|
|
+Note that because of the load meaning on Linux,
|
|
+this number is multiplied by the amount of CPUs when compared to the
|
|
+system loadavg.
|
|
.PP
|
|
.B At
|
|
allows fairly complex time
|
|
Index: at-3.1.16/atd.c
|
|
===================================================================
|
|
--- at-3.1.16.orig/atd.c 2015-06-23 18:12:35.353994001 +0200
|
|
+++ at-3.1.16/atd.c 2015-06-23 18:31:52.137058536 +0200
|
|
@@ -763,6 +763,7 @@ run_loop()
|
|
int run_batch;
|
|
static time_t next_batch = 0;
|
|
double currlavg[3];
|
|
+ int cpu_count = 1;
|
|
|
|
/* Main loop. Open spool directory for reading and look over all the
|
|
* files in there. If the filename indicates that the job should be run,
|
|
@@ -907,7 +908,14 @@ run_loop()
|
|
#ifdef GETLOADAVG_PRIVILEGED
|
|
END_PRIV
|
|
#endif
|
|
- if (currlavg[0] < load_avg) {
|
|
+#ifdef _SC_NPROCESSORS_ONLN
|
|
+ cpu_count = sysconf(_SC_NPROCESSORS_ONLN);
|
|
+ if (cpu_count < 1) {
|
|
+ cpu_count = 1;
|
|
+ }
|
|
+#endif
|
|
+
|
|
+ if (currlavg[0] < load_avg * cpu_count) {
|
|
run_file(batch_name, batch_uid, batch_gid);
|
|
run_batch--;
|
|
}
|
|
Index: at-3.1.16/atd.8.in
|
|
===================================================================
|
|
--- at-3.1.16.orig/atd.8.in 2014-09-30 08:29:02.000000000 +0200
|
|
+++ at-3.1.16/atd.8.in 2015-06-23 18:48:17.519128303 +0200
|
|
@@ -20,10 +20,8 @@ runs jobs queued by
|
|
.B -l
|
|
Specifies a limiting load factor, over which batch jobs should
|
|
not be run, instead of the compile-time choice of @LOADAVG_MX@.
|
|
-For an SMP system with
|
|
-.I n
|
|
-CPUs, you will probably want to set this higher than
|
|
-.IR n-1.
|
|
+This number is multiplied by the amount of CPUs when comparing
|
|
+to /proc/loadavg, because loadavg is a sum over all processors on Linux.
|
|
.TP 8
|
|
.B -b
|
|
Specify the minimum interval in seconds between the start of two
|