Hello community, here is the log from the commit of package stress-ng for openSUSE:Factory checked in at 2017-05-20 10:14:06 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/stress-ng (Old) and /work/SRC/openSUSE:Factory/.stress-ng.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "stress-ng" Sat May 20 10:14:06 2017 rev:10 rq:496478 version:0.08.02 Changes: -------- --- /work/SRC/openSUSE:Factory/stress-ng/stress-ng.changes 2017-05-16 14:47:09.602228331 +0200 +++ /work/SRC/openSUSE:Factory/.stress-ng.new/stress-ng.changes 2017-05-20 10:14:16.782657363 +0200 @@ -1,0 +2,21 @@ +Fri May 19 05:34:44 UTC 2017 - mar...@gmx.de + +- update to version 0.08.02: + * Makefile: bump version + * stress-dev: don't build for __sun__, it does not have DT_* macros + * example-jobs/device.job: Add dev stressor + * Move the --dev stressor to the CLASS_DEV class + * example-jobs/memory.job: add memthrash example + * Expand the default run time text into human time units for large times + * stress-dev: remove linux only build constraint + * stress-dev: use pthread_args_t rather than a special context struct + * Makefile: update perf rule to match output of other CC rules + * stress-dev: ensure we check for all watchdog names + * Make zero timeouts run forever. + * Add dev stressor to exercise /dev entries + * stress-sockpair: make parent less oomable than the child + * stress-memthrash: optimization tweaks, makes it run a bit hotter + * stress-memthrash: add OOM detection handling + * stress-memthrash: Add MAP_POPULATE to mmap'd region + +------------------------------------------------------------------- Old: ---- stress-ng-0.08.01.tar.gz New: ---- stress-ng-0.08.02.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ stress-ng.spec ++++++ --- /var/tmp/diff_new_pack.rfFacO/_old 2017-05-20 10:14:17.386572037 +0200 +++ /var/tmp/diff_new_pack.rfFacO/_new 2017-05-20 10:14:17.390571471 +0200 @@ -18,7 +18,7 @@ Name: stress-ng -Version: 0.08.01 +Version: 0.08.02 Release: 0 Summary: Tool to load and stress a computer License: GPL-2.0 ++++++ stress-ng-0.08.01.tar.gz -> stress-ng-0.08.02.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/stress-ng-0.08.01/Makefile new/stress-ng-0.08.02/Makefile --- old/stress-ng-0.08.01/Makefile 2017-05-12 18:21:17.000000000 +0200 +++ new/stress-ng-0.08.02/Makefile 2017-05-18 14:29:44.000000000 +0200 @@ -16,7 +16,7 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # -VERSION=0.08.01 +VERSION=0.08.02 # # Codename "harmful hardware harasser" # @@ -74,6 +74,7 @@ stress-daemon.c \ stress-dccp.c \ stress-dentry.c \ + stress-dev.c \ stress-dir.c \ stress-dirdeep.c \ stress-dnotify.c \ @@ -786,7 +787,8 @@ perf.o: perf.c perf-event.c @gcc -E perf-event.c | grep "PERF_COUNT" | sed 's/,/ /' | awk {'print "#define _SNG_" $$1 " (1)"'} > perf-event.h - $(CC) $(CFLAGS) -c -o $@ $< + @echo $(CC) $(CFLAGS) -c -o $@ $< + @$(CC) $(CFLAGS) -c -o $@ $< stress-wcstr.o: stress-wcstr.c @echo $(CC) $(CFLAGS) -fno-builtin -c -o $@ $< diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/stress-ng-0.08.01/example-jobs/device.job new/stress-ng-0.08.02/example-jobs/device.job --- old/stress-ng-0.08.01/example-jobs/device.job 2017-05-12 18:21:17.000000000 +0200 +++ new/stress-ng-0.08.02/example-jobs/device.job 2017-05-18 14:29:44.000000000 +0200 @@ -61,6 +61,16 @@ # # +# dev stressor options: +# start N workers that exercise the /dev devices. Each worker runs +# 5 concurrent threads that perform open(2), fstat(2), lseek(2), +# poll(2), fcntl(2), mmap(2), munmap(2), fsync(2) and close(2) on +# each device. Note that watchdog devices are not exercised. +# +dev 0 # 0 means 1 stressor per CPU +# dev-ops 1000000 # stop after 1000000 bogo ops + +# # full stressor options: # start N workers that exercise /dev/full. This attempts to write # to the device (which should always get error ENOSPC), to read diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/stress-ng-0.08.01/example-jobs/memory.job new/stress-ng-0.08.02/example-jobs/memory.job --- old/stress-ng-0.08.01/example-jobs/memory.job 2017-05-12 18:21:17.000000000 +0200 +++ new/stress-ng-0.08.02/example-jobs/memory.job 2017-05-18 14:29:44.000000000 +0200 @@ -204,6 +204,19 @@ # memfd-fds 256 # number of memfds to have open # +# memthrash stressor options: +# start N workers that thrash and exercise a 16MB buffer in vari‐ +# ous ways to try and trip thermal overrun. +# +memthrash 0 # 0 means 1 stressor per CPU +# memthrash-ops 1000000 # stop after 1000000 bogo ops +# memthrash-method all # all all memthrash methods, one can use: + # all, chunk1, chunk8, chunk64, chunk256 + # chunkpage, flip, flush, lock, matrix, + # memset, mfence, prefetch, random, + # spinread or spinwrite + +# # mergesort stressor options: # start N workers that sort 32 bit integers using the BSD merge‐ # sort. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/stress-ng-0.08.01/stress-dev.c new/stress-ng-0.08.02/stress-dev.c --- old/stress-ng-0.08.01/stress-dev.c 1970-01-01 01:00:00.000000000 +0100 +++ new/stress-ng-0.08.02/stress-dev.c 2017-05-18 14:29:44.000000000 +0200 @@ -0,0 +1,238 @@ +/* + * Copyright (C) 2013-2017 Canonical, Ltd. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * This code is a complete clean re-write of the stress tool by + * Colin Ian King <colin.k...@canonical.com> and attempts to be + * backwardly compatible with the stress tool by Amos Waterland + * <a...@rossby.metr.ou.edu> but has more stress tests and more + * functionality. + * + */ +#include "stress-ng.h" + +#if defined(HAVE_LIB_PTHREAD) && !defined(__sun__) + +#include <poll.h> + +#define MAX_DEV_THREADS (4) + +static volatile bool keep_running; +static sigset_t set; + +/* + * stress_dev_rw() + * exercise a dev entry + */ +static inline void stress_dev_rw( + const args_t *args, + const char *path) +{ + int fd, ret; + off_t off; + struct stat buf; + struct pollfd fds[1]; + fd_set rfds; + void *ptr; + + if ((fd = open(path, O_RDONLY | O_NONBLOCK)) < 0) + return; + + if (fstat(fd, &buf) < 0) { + pr_fail_err("stat"); + } else { + if ((buf.st_mode & (S_IFBLK | S_IFCHR)) == 0) { + pr_fail("%s: device entry '%s' is not " + "a block or char device\n", + args->name, path); + } + } + off = lseek(fd, 0, SEEK_SET); + (void)off; + + FD_ZERO(&rfds); + fds[0].fd = fd; + fds[0].events = POLLIN; + ret = poll(fds, 1, 0); + (void)ret; + +#if defined(F_GETFD) + ret = fcntl(fd, F_GETFD, NULL); + (void)ret; +#endif +#if defined(F_GETFL) + ret = fcntl(fd, F_GETFL, NULL); + (void)ret; +#endif + ptr = mmap(NULL, args->page_size, PROT_READ, MAP_PRIVATE, fd, 0); + if (ptr != MAP_FAILED) + munmap(ptr, args->page_size); + (void)close(fd); + + if ((fd = open(path, O_RDONLY | O_NONBLOCK)) < 0) + return; + ptr = mmap(NULL, args->page_size, PROT_WRITE, MAP_PRIVATE, fd, 0); + if (ptr != MAP_FAILED) + munmap(ptr, args->page_size); + + ret = fsync(fd); + (void)ret; + + (void)close(fd); +} + +/* + * stress_dev_thread + * keep exercising a /dev entry until + * controlling thread triggers an exit + */ +static void *stress_dev_thread(void *arg) +{ + static void *nowt = NULL; + uint8_t stack[SIGSTKSZ + STACK_ALIGNMENT]; + pthread_args_t *pa = (pthread_args_t *)arg; + + /* + * Block all signals, let controlling thread + * handle these + */ + (void)sigprocmask(SIG_BLOCK, &set, NULL); + + /* + * According to POSIX.1 a thread should have + * a distinct alternative signal stack. + * However, we block signals in this thread + * so this is probably just totally unncessary. + */ + (void)memset(stack, 0, sizeof(stack)); + if (stress_sigaltstack(stack, SIGSTKSZ) < 0) + return &nowt; + + while (keep_running && g_keep_stressing_flag) + stress_dev_rw(pa->args, (const char *)pa->data); + + return &nowt; +} + +/* + * stress_proc_sys_threads() + * create a bunch of threads to thrash read a sys entry + */ +static void stress_dev_threads(const args_t *args, const char *path) +{ + size_t i; + pthread_t pthreads[MAX_DEV_THREADS]; + int ret[MAX_DEV_THREADS]; + pthread_args_t pa; + + pa.args = args; + pa.data = (void *)path; + + (void)memset(ret, 0, sizeof(ret)); + + keep_running = true; + + for (i = 0; i < MAX_DEV_THREADS; i++) { + ret[i] = pthread_create(&pthreads[i], NULL, + stress_dev_thread, &pa); + } + for (i = 0; i < 8; i++) { + if (!g_keep_stressing_flag) + break; + stress_dev_rw(args, path); + } + keep_running = false; + + for (i = 0; i < MAX_DEV_THREADS; i++) { + if (ret[i] == 0) + pthread_join(pthreads[i], NULL); + } +} + +/* + * stress_dev_dir() + * read directory + */ +static void stress_dev_dir( + const args_t *args, + const char *path, + const bool recurse, + const int depth) +{ + DIR *dp; + struct dirent *d; + + if (!g_keep_stressing_flag) + return; + + /* Don't want to go too deep */ + if (depth > 20) + return; + + dp = opendir(path); + if (dp == NULL) + return; + + while ((d = readdir(dp)) != NULL) { + char filename[PATH_MAX]; + + if (!g_keep_stressing_flag) + break; + if (!strcmp(d->d_name, ".") || + !strcmp(d->d_name, "..")) + continue; + switch (d->d_type) { + case DT_DIR: + if (recurse) { + (void)snprintf(filename, sizeof(filename), + "%s/%s", path, d->d_name); + stress_dev_dir(args, filename, recurse, + depth + 1); + } + break; + case DT_BLK: + case DT_CHR: + (void)snprintf(filename, sizeof(filename), + "%s/%s", path, d->d_name); + if (!strstr(filename, "watchdog")) + stress_dev_threads(args, filename); + break; + default: + break; + } + } + (void)closedir(dp); +} + +/* + * stress_dev + * stress reading all of /dev + */ +int stress_dev(const args_t *args) +{ + do { + stress_dev_dir(args, "/dev", true, 0); + inc_counter(args); + } while (keep_stressing()); + + return EXIT_SUCCESS; +} +#else +int stress_dev(const args_t *args) +{ + return stress_not_implemented(args); +} +#endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/stress-ng-0.08.01/stress-memthrash.c new/stress-ng-0.08.02/stress-memthrash.c --- old/stress-ng-0.08.01/stress-memthrash.c 2017-05-12 18:21:17.000000000 +0200 +++ new/stress-ng-0.08.02/stress-memthrash.c 2017-05-18 14:29:44.000000000 +0200 @@ -53,7 +53,7 @@ #endif #endif -static void stress_memthrash_random_chunk(const size_t chunk_size, size_t mem_size) +static inline HOT OPTIMIZE3 void stress_memthrash_random_chunk(const size_t chunk_size, size_t mem_size) { uint32_t i; const uint32_t max = mwc16(); @@ -65,38 +65,41 @@ for (i = 0; !thread_terminate && (i < max); i++) { const size_t chunk = mwc32() % chunks; const size_t offset = chunk * chunk_size; - +#if defined(__GNUC__) + __builtin_memset((void *)mem + offset, mwc8(), chunk_size); +#else memset((void *)mem + offset, mwc8(), chunk_size); +#endif } } -static void stress_memthrash_random_chunkpage(const args_t *args, size_t mem_size) +static void HOT OPTIMIZE3 stress_memthrash_random_chunkpage(const args_t *args, size_t mem_size) { stress_memthrash_random_chunk(args->page_size, mem_size); } -static void stress_memthrash_random_chunk256(const args_t *args, size_t mem_size) +static void HOT OPTIMIZE3 stress_memthrash_random_chunk256(const args_t *args, size_t mem_size) { (void)args; stress_memthrash_random_chunk(256, mem_size); } -static void stress_memthrash_random_chunk64(const args_t *args, size_t mem_size) +static void HOT OPTIMIZE3 stress_memthrash_random_chunk64(const args_t *args, size_t mem_size) { (void)args; stress_memthrash_random_chunk(64, mem_size); } -static void stress_memthrash_random_chunk8(const args_t *args, size_t mem_size) +static void HOT OPTIMIZE3 stress_memthrash_random_chunk8(const args_t *args, size_t mem_size) { (void)args; stress_memthrash_random_chunk(8, mem_size); } -static void stress_memthrash_random_chunk1(const args_t *args, size_t mem_size) +static void HOT OPTIMIZE3 stress_memthrash_random_chunk1(const args_t *args, size_t mem_size) { (void)args; @@ -107,23 +110,27 @@ { (void)args; +#if defined(__GNUC__) + __builtin_memset((void *)mem, mwc8(), mem_size); +#else memset((void *)mem, mwc8(), mem_size); +#endif } -static void stress_memthrash_flip_mem(const args_t *args, size_t mem_size) +static void HOT OPTIMIZE3 stress_memthrash_flip_mem(const args_t *args, size_t mem_size) { (void)args; uint64_t *ptr = (uint64_t *)mem; const uint64_t *end = (uint64_t *)(mem + mem_size); - while (ptr < end) { + while (LIKELY(ptr < end)) { *ptr = *ptr ^ ~0ULL; ptr++; } } -static void stress_memthrash_matrix(const args_t *args, size_t mem_size) +static void HOT OPTIMIZE3 stress_memthrash_matrix(const args_t *args, size_t mem_size) { (void)args; (void)mem_size; @@ -143,7 +150,7 @@ } } -static void stress_memthrash_prefetch(const args_t *args, size_t mem_size) +static void HOT OPTIMIZE3 stress_memthrash_prefetch(const args_t *args, size_t mem_size) { uint32_t i; const uint32_t max = mwc16(); @@ -155,11 +162,12 @@ volatile uint8_t *ptr = mem + offset; __builtin_prefetch((void *)ptr, 1, 1); + //(void)*ptr; *ptr = i & 0xff; } } -static void stress_memthrash_flush(const args_t *args, size_t mem_size) +static void HOT OPTIMIZE3 stress_memthrash_flush(const args_t *args, size_t mem_size) { uint32_t i; const uint32_t max = mwc16(); @@ -175,7 +183,7 @@ } } -static void stress_memthrash_mfence(const args_t *args, size_t mem_size) +static void HOT OPTIMIZE3 stress_memthrash_mfence(const args_t *args, size_t mem_size) { uint32_t i; const uint32_t max = mwc16(); @@ -192,7 +200,7 @@ } #if defined(MEM_LOCK) -static void stress_memthrash_lock(const args_t *args, size_t mem_size) +static void HOT OPTIMIZE3 stress_memthrash_lock(const args_t *args, size_t mem_size) { uint32_t i; @@ -207,7 +215,7 @@ } #endif -static void stress_memthrash_spinread(const args_t *args, size_t mem_size) +static void HOT OPTIMIZE3 stress_memthrash_spinread(const args_t *args, size_t mem_size) { uint32_t i; const size_t offset = mwc32() % mem_size; @@ -216,19 +224,19 @@ (void)args; for (i = 0; !thread_terminate && (i < 65536); i++) { - *ptr; - *ptr; - *ptr; - *ptr; + (void)*ptr; + (void)*ptr; + (void)*ptr; + (void)*ptr; - *ptr; - *ptr; - *ptr; - *ptr; + (void)*ptr; + (void)*ptr; + (void)*ptr; + (void)*ptr; } } -static void stress_memthrash_spinwrite(const args_t *args, size_t mem_size) +static void HOT OPTIMIZE3 stress_memthrash_spinwrite(const args_t *args, size_t mem_size) { uint32_t i; const size_t offset = mwc32() % mem_size; @@ -285,7 +293,7 @@ } while (!thread_terminate && (time_now() - t < 0.01)); i++; - if (i >= SIZEOF_ARRAY(memthrash_methods)) + if (UNLIKELY(i >= SIZEOF_ARRAY(memthrash_methods))) i = 1; } @@ -388,7 +396,6 @@ } } - /* * stress_memthrash() * stress by creating pthreads @@ -397,11 +404,11 @@ { const stress_memthrash_method_info_t *memthrash_method = &memthrash_methods[0]; const uint32_t max_threads = stress_memthrash_max(args->num_instances); - uint32_t i; pthread_t pthreads[max_threads]; int ret[max_threads]; pthread_args_t pargs; memthrash_func_t func; + pid_t pid; (void)get_setting("memthrash-method", &memthrash_method); func = memthrash_method->func; @@ -414,45 +421,84 @@ memset(pthreads, 0, sizeof(pthreads)); memset(ret, 0, sizeof(ret)); - mem = mmap(NULL, MEM_SIZE, PROT_READ | PROT_WRITE, - MAP_SHARED | MAP_ANONYMOUS, -1, 0); - if (mem == MAP_FAILED) { - pr_fail("mmap"); - return EXIT_NO_RESOURCE; - } - - for (i = 0; i < max_threads; i++) { - ret[i] = pthread_create(&pthreads[i], NULL, - stress_memthrash_func, (void *)&pargs); - if (ret[i]) { - /* Just give up and go to next thread */ - if (ret[i] == EAGAIN) - continue; - /* Something really unexpected */ - pr_fail_errno("pthread create", ret[i]); - goto reap; +again: + if (!g_keep_stressing_flag) + return EXIT_SUCCESS; + pid = fork(); + if (pid < 0) { + if (errno == EAGAIN) + goto again; + pr_err("%s: fork failed: errno=%d: (%s)\n", + args->name, errno, strerror(errno)); + } else if (pid > 0) { + int status, waitret; + + /* Parent, wait for child */ + (void)setpgid(pid, g_pgrp); + waitret = waitpid(pid, &status, 0); + if (waitret < 0) { + if (errno != EINTR) + pr_dbg("%s: waitpid(): errno=%d (%s)\n", + args->name, errno, strerror(errno)); + (void)kill(pid, SIGTERM); + (void)kill(pid, SIGKILL); + (void)waitpid(pid, &status, 0); + } else if (WIFSIGNALED(status)) { + pr_dbg("%s: child died: %s (instance %d)\n", + args->name, stress_strsignal(WTERMSIG(status)), + args->instance); + /* If we got killed by OOM killer, re-start */ + if (WTERMSIG(status) == SIGKILL) { + log_system_mem_info(); + pr_dbg("%s: assuming killed by OOM killer, " + "restarting again (instance %d)\n", + args->name, args->instance); + goto again; + } } - if (!g_keep_stressing_flag) - goto reap; - } + } else if (pid == 0) { + uint32_t i; + mem = mmap(NULL, MEM_SIZE, PROT_READ | PROT_WRITE, +#if defined(MAP_POPULATE) + MAP_POPULATE | +#endif + MAP_SHARED | MAP_ANONYMOUS, -1, 0); + if (mem == MAP_FAILED) { + pr_fail("mmap"); + return EXIT_NO_RESOURCE; + } - (void)sigfillset(&set); + for (i = 0; i < max_threads; i++) { + ret[i] = pthread_create(&pthreads[i], NULL, + stress_memthrash_func, (void *)&pargs); + if (ret[i]) { + /* Just give up and go to next thread */ + if (ret[i] == EAGAIN) + continue; + /* Something really unexpected */ + pr_fail_errno("pthread create", ret[i]); + goto reap; + } + if (!g_keep_stressing_flag) + goto reap; + } - /* Wait for SIGALRM or SIGINT/SIGHUP etc */ - pause(); + (void)sigfillset(&set); + /* Wait for SIGALRM or SIGINT/SIGHUP etc */ + pause(); reap: - thread_terminate = true; - for (i = 0; i < max_threads; i++) { - if (!ret[i]) { - ret[i] = pthread_join(pthreads[i], NULL); - if (ret[i]) - pr_fail_errno("pthread join", ret[i]); + thread_terminate = true; + for (i = 0; i < max_threads; i++) { + if (!ret[i]) { + ret[i] = pthread_join(pthreads[i], NULL); + if (ret[i]) + pr_fail_errno("pthread join", ret[i]); + } } + (void)munmap((void *)mem, MEM_SIZE); } - (void)munmap((void *)mem, MEM_SIZE); - return EXIT_SUCCESS; } #else diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/stress-ng-0.08.01/stress-ng.1 new/stress-ng-0.08.02/stress-ng.1 --- old/stress-ng-0.08.01/stress-ng.1 2017-05-12 18:21:17.000000000 +0200 +++ new/stress-ng-0.08.02/stress-ng.1 2017-05-18 14:29:44.000000000 +0200 @@ -323,6 +323,7 @@ .B \-t N, \-\-timeout N stop stress test after N seconds. One can also specify the units of time in seconds, minutes, hours, days or years with the suffix s, m, h, d or y. +Note: A timeout of 0 will run stress-ng without any timeouts (run forever). .TP .B \-\-timer\-slack N adjust the per process timer slack to N nanoseconds (Linux only). Increasing @@ -989,6 +990,15 @@ .B \-\-dentries N create N dentries per dentry thrashing loop, default is 2048. .TP +.B \-\-dev N +start N workers that exercise the /dev devices. Each worker runs 5 +concurrent threads that perform open(2), fstat(2), lseek(2), poll(2), +fcntl(2), mmap(2), munmap(2), fsync(2) and close(2) on each device. +Note that watchdog devices are not exercised. +.TP +.B \-\-dev\-ops N +stop dev workers after N bogo device exercising operations. +.TP .B \-\-dir N start N workers that create and remove directories using mkdir and rmdir. .TP diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/stress-ng-0.08.01/stress-ng.c new/stress-ng-0.08.02/stress-ng.c --- old/stress-ng-0.08.01/stress-ng.c 2017-05-12 18:21:17.000000000 +0200 +++ new/stress-ng-0.08.02/stress-ng.c 2017-05-18 14:29:44.000000000 +0200 @@ -64,7 +64,7 @@ /* Globals */ int32_t g_opt_sequential = DEFAULT_SEQUENTIAL; /* # of sequential stressors */ int32_t g_opt_parallel = DEFAULT_PARALLEL; /* # of parallel stressors */ -uint64_t g_opt_timeout = 0; /* timeout in seconds */ +uint64_t g_opt_timeout = TIMEOUT_NOT_SET; /* timeout in seconds */ uint64_t g_opt_flags = PR_ERROR | PR_INFO | OPT_FLAGS_MMAP_MADVISE; volatile bool g_keep_stressing_flag = true; /* false to exit stressor */ volatile bool g_caught_sigint = false; /* true if stopped by SIGINT */ @@ -214,6 +214,7 @@ STRESSOR(daemon, DAEMON, CLASS_SCHEDULER | CLASS_OS), STRESSOR(dccp, DCCP, CLASS_NETWORK | CLASS_OS), STRESSOR(dentry, DENTRY, CLASS_FILESYSTEM | CLASS_OS), + STRESSOR(dev, DEV, CLASS_DEV | CLASS_OS), STRESSOR(dir, DIR, CLASS_FILESYSTEM | CLASS_OS), STRESSOR(dirdeep, DIRDEEP, CLASS_FILESYSTEM | CLASS_OS), STRESSOR(dnotify, DNOTIFY, CLASS_FILESYSTEM | CLASS_SCHEDULER | CLASS_OS), @@ -464,6 +465,8 @@ { "dentry-ops", 1, 0, OPT_DENTRY_OPS }, { "dentries", 1, 0, OPT_DENTRIES }, { "dentry-order",1, 0, OPT_DENTRY_ORDER }, + { "dev", 1, 0, OPT_DEV }, + { "dev-ops", 1, 0, OPT_DEV_OPS }, { "dir", 1, 0, OPT_DIR }, { "dir-ops", 1, 0, OPT_DIR_OPS }, { "dir-dirs", 1, 0, OPT_DIR_DIRS }, @@ -1024,6 +1027,8 @@ { NULL, "dentry-ops N", "stop after N dentry bogo operations" }, { NULL, "dentry-order O", "specify unlink order (reverse, forward, stride)" }, { NULL, "dentries N", "create N dentries per iteration" }, + { NULL, "dev", "start N device entry thrashing stressors" }, + { NULL, "dev-ops", "stop after N device thrashing bogo ops" }, { NULL, "dir N", "start N directory thrashing stressors" }, { NULL, "dir-ops N", "stop after N directory bogo operations" }, { NULL, "dir-dirs N", "select number of directories to exercise dir on" }, @@ -1999,7 +2004,7 @@ pr_dbg("starting stressors\n"); for (n_procs = 0; n_procs < total_procs; n_procs++) { for (proc_current = procs_list; proc_current; proc_current = proc_current->next) { - if (time_now() - time_start > g_opt_timeout) + if (g_opt_timeout && (time_now() - time_start > g_opt_timeout)) goto abort; j = proc_current->started_procs; @@ -2036,7 +2041,8 @@ if (g_opt_flags & OPT_FLAGS_TIMER_SLACK) stress_set_timer_slack(); - (void)alarm(g_opt_timeout); + if (g_opt_timeout) + (void)alarm(g_opt_timeout); mwc_reseed(); (void)snprintf(name, sizeof(name), "%s-%s", g_app_name, munge_underscore(proc_current->stressor->name)); @@ -2116,7 +2122,8 @@ } } (void)stress_set_handler("stress-ng", false); - (void)alarm(g_opt_timeout); + if (g_opt_timeout) + (void)alarm(g_opt_timeout); abort: pr_dbg("%d stressor%s spawned\n", n_procs, @@ -3252,10 +3259,11 @@ */ static void set_default_timeout(const uint64_t timeout) { - if (g_opt_timeout == 0) { + if (g_opt_timeout == TIMEOUT_NOT_SET) { g_opt_timeout = timeout; - pr_inf("defaulting to a %" PRIu64 " second run per stressor\n", - g_opt_timeout); + pr_inf("defaulting to a %" PRIu64 " second%s run per stressor\n", + g_opt_timeout, + duration_to_str((double)g_opt_timeout)); } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/stress-ng-0.08.01/stress-ng.h new/stress-ng-0.08.02/stress-ng.h --- old/stress-ng-0.08.01/stress-ng.h 2017-05-12 18:21:17.000000000 +0200 +++ new/stress-ng-0.08.02/stress-ng.h 2017-05-18 14:29:44.000000000 +0200 @@ -841,6 +841,7 @@ #define MAX_ZOMBIES (1000000) #define DEFAULT_ZOMBIES (8192) +#define TIMEOUT_NOT_SET (~0ULL) #define DEFAULT_TIMEOUT (60 * 60 * 24) #define DEFAULT_BACKOFF (0) #define DEFAULT_LINKS (8192) @@ -1172,6 +1173,7 @@ STRESS_DAEMON, STRESS_DCCP, STRESS_DENTRY, + STRESS_DEV, STRESS_DIR, STRESS_DIRDEEP, STRESS_DNOTIFY, @@ -1464,6 +1466,9 @@ OPT_DENTRIES, OPT_DENTRY_ORDER, + OPT_DEV, + OPT_DEV_OPS, + OPT_DIR, OPT_DIR_OPS, OPT_DIR_DIRS, @@ -2657,6 +2662,7 @@ STRESS(stress_daemon); STRESS(stress_dccp); STRESS(stress_dentry); +STRESS(stress_dev); STRESS(stress_dir); STRESS(stress_dirdeep); STRESS(stress_dnotify); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/stress-ng-0.08.01/stress-socketpair.c new/stress-ng-0.08.02/stress-socketpair.c --- old/stress-ng-0.08.01/stress-socketpair.c 2017-05-12 18:21:17.000000000 +0200 +++ new/stress-ng-0.08.02/stress-socketpair.c 2017-05-18 14:29:44.000000000 +0200 @@ -189,6 +189,8 @@ } else if (pid > 0) { int status, ret; + set_oom_adjustment(args->name, false); + /* Parent, wait for child */ (void)setpgid(pid, g_pgrp); ret = waitpid(pid, &status, 0);