Hello community, here is the log from the commit of package stress-ng for openSUSE:Factory checked in at 2020-03-05 23:22:14 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/stress-ng (Old) and /work/SRC/openSUSE:Factory/.stress-ng.new.26092 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "stress-ng" Thu Mar 5 23:22:14 2020 rev:79 rq:781735 version:0.11.02 Changes: -------- --- /work/SRC/openSUSE:Factory/stress-ng/stress-ng.changes 2020-02-27 14:37:18.578028782 +0100 +++ /work/SRC/openSUSE:Factory/.stress-ng.new.26092/stress-ng.changes 2020-03-05 23:22:22.661314066 +0100 @@ -1,0 +2,17 @@ +Wed Mar 4 19:58:41 UTC 2020 - Martin Hauke <[email protected]> + +- Update to version 0.11.02 + * core-parse-opts: cater for -ve values + * core-parse-opts: check for non-numeric in numeric args + * Fix --random mode + * Allow negative --random for selecting number of online CPUs + * stress-prctl: add PR_SET_IO_FLUSHER PR_GET_IO_FLUSHER prctl + commands + * stress-mmapfork: check if parent is OOM'd and force exit on + early abort + * stress-mmapfork: force reap on interrupt waiting for pid + * stress-mmapfork: ensure we kill and reap child processes + * stress-mmapfork: reap when no more process slots are free + * stress-mmap: add in more yield points + +------------------------------------------------------------------- Old: ---- stress-ng-0.11.01.tar.xz New: ---- stress-ng-0.11.02.tar.xz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ stress-ng.spec ++++++ --- /var/tmp/diff_new_pack.kdT8Xg/_old 2020-03-05 23:22:24.741315210 +0100 +++ /var/tmp/diff_new_pack.kdT8Xg/_new 2020-03-05 23:22:24.745315212 +0100 @@ -18,7 +18,7 @@ Name: stress-ng -Version: 0.11.01 +Version: 0.11.02 Release: 0 Summary: Tool to load and stress a computer License: GPL-2.0-only ++++++ stress-ng-0.11.01.tar.xz -> stress-ng-0.11.02.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/stress-ng-0.11.01/Makefile new/stress-ng-0.11.02/Makefile --- old/stress-ng-0.11.01/Makefile 2020-02-24 11:48:48.000000000 +0100 +++ new/stress-ng-0.11.02/Makefile 2020-03-03 16:27:42.000000000 +0100 @@ -16,7 +16,7 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # -VERSION=0.11.01 +VERSION=0.11.02 # # Codename "synthetic system strainer" # diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/stress-ng-0.11.01/core-parse-opts.c new/stress-ng-0.11.02/core-parse-opts.c --- old/stress-ng-0.11.01/core-parse-opts.c 2020-02-24 11:48:48.000000000 +0100 +++ new/stress-ng-0.11.02/core-parse-opts.c 2020-03-03 16:27:42.000000000 +0100 @@ -81,6 +81,28 @@ } } +/* + * ensure_numeric() + * ensure just numeric values + */ +static void ensure_numeric(const char *const str) +{ + const char *ptr = str; + + if (*ptr == '-') + ptr++; + while (*ptr) { + if (!isdigit(*ptr)) + break; + ptr++; + } + if (*ptr == '\0') + return; + (void)fprintf(stderr, "Value %s contains non-numeric: '%s'\n", + str, ptr); + longjmp(g_error_env, 1); +} + /* * ensure_positive() @@ -116,6 +138,7 @@ uint64_t val; ensure_positive(str); + ensure_numeric(str); if (sscanf(str, "%" SCNu64, &val) != 1) { (void)fprintf(stderr, "Invalid number %s\n", str); longjmp(g_error_env, 1); @@ -136,6 +159,7 @@ { int64_t val; + ensure_numeric(str); if (sscanf(str, "%" SCNd64, &val) != 1) { (void)fprintf(stderr, "Invalid number %s\n", str); longjmp(g_error_env, 1); @@ -162,6 +186,7 @@ uint64_t val; ensure_positive(str); + ensure_numeric(str); if (sscanf(str, "%" SCNu64, &val) != 1) { (void)fprintf(stderr, "Invalid number %s\n", str); longjmp(g_error_env, 1); @@ -183,7 +208,12 @@ int ch; int i; - val = get_uint64(str); + ensure_positive(str); + if (sscanf(str, "%" SCNu64, &val) != 1) { + (void)fprintf(stderr, "Invalid number %s\n", str); + longjmp(g_error_env, 1); + } + if (!len) { (void)fprintf(stderr, "Value %s is an invalid size\n", str); longjmp(g_error_env, 1); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/stress-ng-0.11.01/stress-mmapfork.c new/stress-ng-0.11.02/stress-mmapfork.c --- old/stress-ng-0.11.01/stress-mmapfork.c 2020-02-24 11:48:48.000000000 +0100 +++ new/stress-ng-0.11.02/stress-mmapfork.c 2020-03-03 16:27:42.000000000 +0100 @@ -71,6 +71,16 @@ } /* + * Check that parent hasn't been OOM'd or it is time to die + */ +static inline bool should_terminate(const args_t *args, const pid_t ppid) +{ + if ((kill(ppid, 0) < 0) && (errno == ESRCH)) + return true; + return !keep_stressing(); +} + +/* * stress_mmapfork() * stress mappings + fork VM subystem */ @@ -83,25 +93,23 @@ int8_t segv_reasons = 0; do { - size_t i, n, len; + size_t i, len; - (void)memset(pids, 0, sizeof(pids)); + for (i = 0; i < MAX_PIDS; i++) + pids[i] = -1; - for (n = 0; n < MAX_PIDS; n++) { -retry: if (!keep_stressing_flag()) + for (i = 0; i < MAX_PIDS; i++) { + if (!keep_stressing()) goto reap; - pids[n] = fork(); - if (pids[n] < 0) { - /* Out of resources for fork, re-do, ugh */ - if ((errno == EAGAIN) || (errno == ENOMEM)) { - (void)shim_usleep(10000); - goto retry; - } + pids[i] = fork(); + /* Out of resources for fork?, do a reap */ + if (pids[i] < 0) break; - } - if (pids[n] == 0) { + if (pids[i] == 0) { /* Child */ + const pid_t ppid = getppid(); + (void)setpgid(0, g_pgrp); stress_parent_died_alarm(); @@ -118,32 +126,50 @@ ptr = mmap(NULL, len, PROT_READ | PROT_WRITE, MAP_POPULATE | MAP_SHARED | MAP_ANONYMOUS, -1, 0); if (ptr != MAP_FAILED) { + if (should_terminate(args, ppid)) + _exit(EXIT_SUCCESS); segv_ret = _EXIT_SEGV_MADV_WILLNEED; (void)shim_madvise(ptr, len, MADV_WILLNEED); + if (should_terminate(args, ppid)) + _exit(EXIT_SUCCESS); segv_ret = _EXIT_SEGV_MEMSET; (void)memset(ptr, 0, len); + if (should_terminate(args, ppid)) + _exit(EXIT_SUCCESS); segv_ret = _EXIT_SEGV_MADV_DONTNEED; (void)shim_madvise(ptr, len, MADV_DONTNEED); + if (should_terminate(args, ppid)) + _exit(EXIT_SUCCESS); segv_ret = _EXIT_SEGV_MUNMAP; (void)munmap(ptr, len); } _exit(EXIT_SUCCESS); } - (void)setpgid(pids[n], g_pgrp); + (void)setpgid(pids[i], g_pgrp); } -reap: - for (i = 0; i < n; i++) { + + /* + * Wait for children to terminate + */ + for (i = 0; i < MAX_PIDS; i++) { int status; + if (UNLIKELY(pids[i] < 0)) + continue; + if (shim_waitpid(pids[i], &status, 0) < 0) { if (errno != EINTR) { pr_err("%s: waitpid errno=%d (%s)\n", args->name, errno, strerror(errno)); + } else { + /* Probably an SIGARLM, force reap */ + goto reap; } } else { + pids[i] = -1; if (WIFEXITED(status)) { int masked = WEXITSTATUS(status) & _EXIT_MASK; @@ -154,6 +180,18 @@ } } } +reap: + /* + * Force child death and reap + */ + for (i = 0; i < MAX_PIDS; i++) { + int status; + + if (UNLIKELY(pids[i] < 0)) + continue; + (void)kill(pids[i], SIGKILL); + (void)shim_waitpid(pids[i], &status, 0); + } inc_counter(args); } while (keep_stressing()); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/stress-ng-0.11.01/stress-ng.1 new/stress-ng-0.11.02/stress-ng.1 --- old/stress-ng-0.11.01/stress-ng.1 2020-02-24 11:48:48.000000000 +0100 +++ new/stress-ng-0.11.02/stress-ng.1 2020-03-03 16:27:42.000000000 +0100 @@ -4247,8 +4247,8 @@ Christian Ehrhardt, Fabrice Fontaine, James Hunt, Jim Rowan, Joseph DeVincentis, Khem Raj, Luca Pizzamiglio, Luis Henriques, Manoj Iyer, Matthew Tippett, Mauricio Faria de Oliveira, -Ralf Ramsauer, Rob Colclaser, Thia Wyrod, Tim Gardner, Tim Orling, Zhiyi Sun -and others. +Ralf Ramsauer, Rob Colclaser, Thia Wyrod, Tim Gardner, Tim Orling, +Tommi Rantala, Zhiyi Sun and others. .SH NOTES Sending a SIGALRM, SIGINT or SIGHUP to stress-ng causes it to terminate all the stressor processes and ensures temporary files and diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/stress-ng-0.11.01/stress-ng.c new/stress-ng-0.11.02/stress-ng.c --- old/stress-ng-0.11.01/stress-ng.c 2020-02-24 11:48:48.000000000 +0100 +++ new/stress-ng-0.11.02/stress-ng.c 2020-03-03 16:27:42.000000000 +0100 @@ -2302,8 +2302,11 @@ exit(EXIT_FAILURE); } - if (!n_procs) - n_procs = 1; + if (!n_procs) { + (void)fprintf(stderr, + "No stressors are available, unable to continue\n"); + exit(EXIT_FAILURE); + } /* create n randomly chosen stressors */ while (n > 0) { @@ -2514,8 +2517,8 @@ case OPT_random: g_opt_flags |= OPT_FLAGS_RANDOM; i32 = get_int32(optarg); - check_value("random", i32); stress_get_processors(&i32); + check_value("random", i32); set_setting("random", TYPE_ID_INT32, &i32); break; case OPT_sched: @@ -2806,6 +2809,11 @@ cpus_configured, cpus_configured == 1 ? "" : "s"); /* + * For random mode the stressors must be available + */ + if (g_opt_flags & OPT_FLAGS_RANDOM) + enable_all_stressors(0); + /* * These two options enable all the stressors */ if (g_opt_flags & OPT_FLAGS_SEQUENTIAL) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/stress-ng-0.11.01/stress-prctl.c new/stress-ng-0.11.02/stress-prctl.c --- old/stress-ng-0.11.01/stress-prctl.c 2020-02-24 11:48:48.000000000 +0100 +++ new/stress-ng-0.11.02/stress-prctl.c 2020-03-03 16:27:42.000000000 +0100 @@ -82,7 +82,9 @@ defined(PR_SVE_GET_VL) || \ defined(PR_SVE_SET_VL) || \ defined(PR_GET_TAGGED_ADDR_CTRL) || \ - defined(PR_SET_TAGGED_ADDR_CTRL) + defined(PR_SET_TAGGED_ADDR_CTRL) || \ + defined(PR_GET_IO_FLUSHER) || \ + defined(PR_SET_IO_FLUSHER) static int stress_prctl_child(const args_t *args, const pid_t mypid) { @@ -499,6 +501,18 @@ (void)ret; #endif } +#endif + +#if defined(PR_GET_IO_FLUSHER) + { + ret = prctl(PR_GET_IO_FLUSHER, 0, 0, 0, 0); + (void)ret; + +#if defined(PR_SET_IO_FLUSHER) + ret = prctl(PR_SET_IO_FLUSHER, ret, 0, 0, 0); + (void)ret; +#endif + } #endif (void)ret;
