Accepting request 313311 from home:vitezslav_cizek:branches:Base:System

- 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
This commit is contained in:
Kristyna Streitova 2015-06-24 08:32:27 +00:00 committed by Git OBS Bridge
parent 0c97661a07
commit f9b617fd8a
4 changed files with 70 additions and 1 deletions

View File

@ -0,0 +1,59 @@
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

View File

@ -1,3 +1,10 @@
-------------------------------------------------------------------
Tue Jun 23 16:48:56 UTC 2015 - vcizek@suse.com
- 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
-------------------------------------------------------------------
Mon Jun 22 15:07:32 UTC 2015 - tchvatal@suse.com

View File

@ -59,6 +59,7 @@ Patch24: at-backport-old-privs.patch
Patch25: at-atq-timeformat.patch
#PATCH-FIX-OPENSUSE use posix timers to avoid the need of suspend/resume hacks.
Patch27: at-3.1.14-usePOSIXtimers.patch
Patch28: at-adjust_load_to_cpu_count.patch
BuildRequires: autoconf >= 2.69
BuildRequires: automake
BuildRequires: bison
@ -102,6 +103,7 @@ This program allows you to run jobs at specified times.
%patch24 -p1
%patch25
%patch27 -p1
%patch28 -p1
%build
rm -fv y.tab.c y.tab.h lex.yy.c lex.yy.o y.tab.o

View File

@ -13,7 +13,8 @@ ATD_BATCH_INTERVAL=""
## Type: string
## Default: ""
## ServiceRestart: atd
# load limiting factor for atd, "" for default
# load limiting factor for atd, "" for default,
# it's multiplied by the amount of CPUs when comparing to /proc/loadavg
#
ATD_LOADAVG=""