Hello community,

here is the log from the commit of package stress-ng for openSUSE:Factory 
checked in at 2018-04-16 12:48:03
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/stress-ng (Old)
 and      /work/SRC/openSUSE:Factory/.stress-ng.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "stress-ng"

Mon Apr 16 12:48:03 2018 rev:40 rq:595704 version:0.09.24

Changes:
--------
--- /work/SRC/openSUSE:Factory/stress-ng/stress-ng.changes      2018-03-31 
15:37:32.732257001 +0200
+++ /work/SRC/openSUSE:Factory/.stress-ng.new/stress-ng.changes 2018-04-16 
12:48:08.306968884 +0200
@@ -1,0 +2,16 @@
+Wed Apr 11 12:48:02 UTC 2018 - mar...@gmx.de
+
+- Update to version 0.09.24
+  * Makefile: bump version
+  * Misc small fixes detected by static analysis (LP: #1762848)
+  * stress-fcntl: use | rather than |= to get new_flags
+  * stress-tmpfs: clear mnts and check if mnts[i] is null
+  * stress-sync-file: fix incorrect placement of break statement
+  * stress-af-alkg: check for more NULL cmsg pointers
+  * stress-pipe: ensure no uninitialized data is written to pipe
+  * stress-fcntl: use | rather than |= to get new_flags
+  * test/test-posix-memalign.c: free allocated buffer
+  * test/test-fanotify.c: free buffer
+  * stress-mmapfailed: check for null return from mremap
+
+-------------------------------------------------------------------

Old:
----
  stress-ng-0.09.23.tar.xz

New:
----
  stress-ng-0.09.24.tar.xz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ stress-ng.spec ++++++
--- /var/tmp/diff_new_pack.3O01lj/_old  2018-04-16 12:48:09.634920576 +0200
+++ /var/tmp/diff_new_pack.3O01lj/_new  2018-04-16 12:48:09.638920431 +0200
@@ -18,7 +18,7 @@
 
 
 Name:           stress-ng
-Version:        0.09.23
+Version:        0.09.24
 Release:        0
 Summary:        Tool to load and stress a computer
 License:        GPL-2.0-only

++++++ stress-ng-0.09.23.tar.xz -> stress-ng-0.09.24.tar.xz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/stress-ng-0.09.23/Makefile 
new/stress-ng-0.09.24/Makefile
--- old/stress-ng-0.09.23/Makefile      2018-03-28 11:41:12.000000000 +0200
+++ new/stress-ng-0.09.24/Makefile      2018-04-11 10:59:25.000000000 +0200
@@ -16,7 +16,7 @@
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 
USA.
 #
 
-VERSION=0.09.23
+VERSION=0.09.24
 #
 # Codename "portable pressure producer"
 #
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/stress-ng-0.09.23/ignite-cpu.c 
new/stress-ng-0.09.24/ignite-cpu.c
--- old/stress-ng-0.09.23/ignite-cpu.c  2018-03-28 11:41:12.000000000 +0200
+++ new/stress-ng-0.09.24/ignite-cpu.c  2018-04-11 10:59:25.000000000 +0200
@@ -114,7 +114,7 @@
                (void)setpgid(0, g_pgrp);
                stress_parent_died_alarm();
 
-               for (;;) {
+               while (g_keep_stressing_flag) {
                        for (i = 0; settings[i].path; i++) {
                                if (settings[i].ignore)
                                        continue;
@@ -124,6 +124,7 @@
                        }
                        sleep(1);
                }
+               exit(0);
        } else {
                /* Parent */
                (void)setpgid(pid, g_pgrp);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/stress-ng-0.09.23/setting.c 
new/stress-ng-0.09.24/setting.c
--- old/stress-ng-0.09.23/setting.c     2018-03-28 11:41:12.000000000 +0200
+++ new/stress-ng-0.09.24/setting.c     2018-04-11 10:59:25.000000000 +0200
@@ -52,11 +52,16 @@
        setting_tail = NULL;
 }
 
+
 /*
- *  set_setting()
+ *  set_setting_generic()
  *     set a new setting;
  */
-void set_setting(const char *name, const type_id_t type_id, const void *value)
+static void set_setting_generic(
+       const char *name,
+       const type_id_t type_id,
+       const void *value,
+       const bool global)
 {
        setting_t *setting;
 
@@ -71,11 +76,14 @@
        setting->name = strdup(name);
        setting->proc = proc_current;
        setting->type_id = type_id;
+       setting->global = global;
        if (!setting->name) {
                free(setting);
                goto err;
        }
 
+       DBG("%s: %s, global = %s\n", __func__, name, global ? "true" : "false");
+
        switch (type_id) {
        case TYPE_ID_UINT8:
                setting->u.uint8 = *(const uint8_t *)value;
@@ -169,6 +177,31 @@
 }
 
 /*
+ *  set_setting()
+ *     set a new setting;
+ */
+void set_setting(
+       const char *name,
+       const type_id_t type_id,
+       const void *value)
+{
+       set_setting_generic(name, type_id, value, false);
+}
+
+/*
+ *  set_setting_global()
+ *     set a new global setting;
+ */
+void set_setting_global(
+       const char *name,
+       const type_id_t type_id,
+       const void *value)
+{
+       set_setting_generic(name, type_id, value, true);
+}
+
+
+/*
  *  get_setting()
  *     get an existing setting;
  */
@@ -183,7 +216,7 @@
        for (setting = setting_head; setting; setting = setting->next) {
                if (setting->proc == proc_current)
                        found = true;
-               if (found && (setting->proc != proc_current))
+               if (found && ((setting->proc != proc_current) && 
(!setting->global)))
                        break;
 
                if (!strcmp(setting->name, name)) {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/stress-ng-0.09.23/stress-af-alg.c 
new/stress-ng-0.09.24/stress-af-alg.c
--- old/stress-ng-0.09.23/stress-af-alg.c       2018-03-28 11:41:12.000000000 
+0200
+++ new/stress-ng-0.09.24/stress-af-alg.c       2018-04-11 10:59:25.000000000 
+0200
@@ -274,6 +274,8 @@
 
                        /* Set up random Initialization Vector */
                        cmsg = CMSG_NXTHDR(&msg, cmsg);
+                       if (!cmsg)
+                               break;
                        cmsg->cmsg_level = SOL_ALG;
                        cmsg->cmsg_type = ALG_SET_IV;
                        cmsg->cmsg_len = CMSG_LEN(4) + CMSG_LEN(iv_size);
@@ -303,6 +305,8 @@
 
                        /* Chosen operation - DECRYPT */
                        cmsg = CMSG_FIRSTHDR(&msg);
+                       if (!cmsg)
+                               break;
                        cmsg->cmsg_level = SOL_ALG;
                        cmsg->cmsg_type = ALG_SET_OP;
                        cmsg->cmsg_len = CMSG_LEN(4);
@@ -311,6 +315,9 @@
 
                        /* Set up random Initialization Vector */
                        cmsg = CMSG_NXTHDR(&msg, cmsg);
+                       if (!cmsg)
+                               break;
+                               
                        cmsg->cmsg_level = SOL_ALG;
                        cmsg->cmsg_type = ALG_SET_IV;
                        cmsg->cmsg_len = CMSG_LEN(4) + CMSG_LEN(iv_size);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/stress-ng-0.09.23/stress-cpu.c 
new/stress-ng-0.09.24/stress-cpu.c
--- old/stress-ng-0.09.23/stress-cpu.c  2018-03-28 11:41:12.000000000 +0200
+++ new/stress-ng-0.09.24/stress-cpu.c  2018-04-11 10:59:25.000000000 +0200
@@ -567,7 +567,7 @@
  */
 static uint32_t HOT OPTIMIZE3 jenkin(const uint8_t *data, const size_t len)
 {
-       register uint8_t i;
+       register size_t i;
        register uint32_t h = 0;
 
        for (i = 0; i < len; i++) {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/stress-ng-0.09.23/stress-fcntl.c 
new/stress-ng-0.09.24/stress-fcntl.c
--- old/stress-ng-0.09.23/stress-fcntl.c        2018-03-28 11:41:12.000000000 
+0200
+++ new/stress-ng-0.09.24/stress-fcntl.c        2018-04-11 10:59:25.000000000 
+0200
@@ -100,7 +100,7 @@
                if (old_flags > -1) {
                        int new_flags, ret;
 
-                       new_flags = old_flags |= O_CLOEXEC;
+                       new_flags = old_flags | O_CLOEXEC;
                        ret = fcntl(fd, F_SETFD, new_flags);
                        check_return(args, ret, "F_SETFD");
 
@@ -123,7 +123,7 @@
                if (old_flags > -1) {
                        int new_flags, ret;
 
-                       new_flags = old_flags |= O_APPEND;
+                       new_flags = old_flags | O_APPEND;
                        ret = fcntl(fd, F_SETFL, new_flags);
                        check_return(args, ret, "F_SETFL");
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/stress-ng-0.09.23/stress-mmapfixed.c 
new/stress-ng-0.09.24/stress-mmapfixed.c
--- old/stress-ng-0.09.23/stress-mmapfixed.c    2018-03-28 11:41:12.000000000 
+0200
+++ new/stress-ng-0.09.24/stress-mmapfixed.c    2018-04-11 10:59:25.000000000 
+0200
@@ -73,7 +73,7 @@
                        newbuf = mremap(buf, sz, sz,
                                        MREMAP_FIXED | MREMAP_MAYMOVE,
                                        (void *)newaddr);
-                       if (newbuf != MAP_FAILED)
+                       if (newbuf && (newbuf != MAP_FAILED))
                                buf = newbuf;
 
                        (void)madvise_random(buf, sz);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/stress-ng-0.09.23/stress-ng.1 
new/stress-ng-0.09.24/stress-ng.1
--- old/stress-ng-0.09.23/stress-ng.1   2018-03-28 11:41:12.000000000 +0200
+++ new/stress-ng-0.09.24/stress-ng.1   2018-04-11 10:59:25.000000000 +0200
@@ -2859,6 +2859,14 @@
 stop after N stream bogo operations, where a bogo operation is one round
 of copy, scale, add and triad operations.
 .TP
+.B \-\-stream\-index N
+specify number of stream indices used to index into the data arrays a, b and
+c.  This adds indirection into the data lookup by using randomly shuffled
+indexing into the three data arrays. Level 0 (no indexing) is the default,
+and 3 is where all 3 arrays are indexed via 3 different randomly shuffled
+indexes. The higher the index setting the more impact this has on L1, L2
+and L3 caching and hence forces higher memory read/write latencies.
+.TP
 .B \-\-stream\-l3\-size N
 Specify the CPU Level 3 cache size in bytes.  One can specify the size in
 units of Bytes, KBytes, MBytes and GBytes using the suffix b, k, m or g.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/stress-ng-0.09.23/stress-ng.c 
new/stress-ng-0.09.24/stress-ng.c
--- old/stress-ng-0.09.23/stress-ng.c   2018-03-28 11:41:12.000000000 +0200
+++ new/stress-ng-0.09.24/stress-ng.c   2018-04-11 10:59:25.000000000 +0200
@@ -897,6 +897,7 @@
        { "stressors",  0,      0,      OPT_STRESSORS },
        { "stream",     1,      0,      OPT_STREAM },
        { "stream-ops", 1,      0,      OPT_STREAM_OPS },
+       { "stream-index",1,     0,      OPT_STREAM_INDEX },
        { "stream-l3-size",1,   0,      OPT_STREAM_L3_SIZE },
        { "stream-madvise",1,   0,      OPT_STREAM_MADVISE },
        { "swap",       1,      0,      OPT_SWAP },
@@ -1501,6 +1502,7 @@
        { NULL,         "str-ops N",            "stop after N bogo string 
operations" },
        { NULL,         "stream N",             "start N workers exercising 
memory bandwidth" },
        { NULL,         "stream-ops N",         "stop after N bogo stream 
operations" },
+       { NULL,         "stream-index",         "specify number of indices into 
the data (0..3)" },
        { NULL,         "stream-l3-size N",     "specify the L3 cache size of 
the CPU" },
        { NULL,         "stream-madvise M",     "specify mmap'd stream buffer 
madvise advice" },
        { NULL,         "swap N",               "start N workers exercising 
swapon/swapoff" },
@@ -2991,7 +2993,7 @@
                        break;
                case OPT_BACKOFF:
                        i64 = (int64_t)get_uint64(optarg);
-                       set_setting("backoff", TYPE_ID_INT64, &i64);
+                       set_setting_global("backoff", TYPE_ID_INT64, &i64);
                        break;
                case OPT_BIGHEAP_GROWTH:
                        stress_set_bigheap_growth(optarg);
@@ -3116,7 +3118,7 @@
                        stress_set_epoll_port(optarg);
                        break;
                case OPT_EXCLUDE:
-                       set_setting("exclude", TYPE_ID_STR, (void *)optarg);
+                       set_setting_global("exclude", TYPE_ID_STR, (void 
*)optarg);
                        break;
                case OPT_EXEC_MAX:
                        stress_set_exec_max(optarg);
@@ -3185,7 +3187,7 @@
                        stress_set_itimer_freq(optarg);
                        break;
                case OPT_JOB:
-                       set_setting("job", TYPE_ID_STR, (void *)optarg);
+                       set_setting_global("job", TYPE_ID_STR, (void *)optarg);
                        break;
                case OPT_KEEP_NAME:
                        g_opt_flags |= OPT_FLAGS_KEEP_NAME;
@@ -3200,7 +3202,7 @@
                        g_opt_flags |= OPT_FLAGS_LOG_BRIEF;
                        break;
                case OPT_LOG_FILE:
-                       set_setting("log-file", TYPE_ID_STR, (void *)optarg);
+                       set_setting_global("log-file", TYPE_ID_STR, (void 
*)optarg);
                        break;
                case OPT_LSEARCH_SIZE:
                        stress_set_lsearch_size(optarg);
@@ -3355,11 +3357,11 @@
                        break;
                case OPT_SCHED:
                        i32 = get_opt_sched(optarg);
-                       set_setting("sched", TYPE_ID_INT32, &i32);
+                       set_setting_global("sched", TYPE_ID_INT32, &i32);
                        break;
                case OPT_SCHED_PRIO:
                        i32 = get_int32(optarg);
-                       set_setting("sched-prio", TYPE_ID_INT32, &i32);
+                       set_setting_global("sched-prio", TYPE_ID_INT32, &i32);
                        break;
                case OPT_SCTP_PORT:
                        stress_set_sctp_port(optarg);
@@ -3436,6 +3438,9 @@
                        if (stress_set_str_method(optarg) < 0)
                                return EXIT_FAILURE;
                        break;
+               case OPT_STREAM_INDEX:
+                       stress_set_stream_index(optarg);
+                       break;
                case OPT_STREAM_L3_SIZE:
                        stress_set_stream_L3_size(optarg);
                        break;
@@ -3572,7 +3577,7 @@
                                return EXIT_FAILURE;
                        break;
                case OPT_YAML:
-                       set_setting("yaml", TYPE_ID_STR, (void *)optarg);
+                       set_setting_global("yaml", TYPE_ID_STR, (void *)optarg);
                        break;
                case OPT_ZLIB_METHOD:
 #if defined(HAVE_LIB_Z)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/stress-ng-0.09.23/stress-ng.h 
new/stress-ng-0.09.24/stress-ng.h
--- old/stress-ng-0.09.23/stress-ng.h   2018-03-28 11:41:12.000000000 +0200
+++ new/stress-ng-0.09.24/stress-ng.h   2018-04-11 10:59:25.000000000 +0200
@@ -203,7 +203,7 @@
 
 
 #define STRESS_FD_MAX          (65536)         /* Max fds if we can't figure 
it out */
-#define STRESS_PROCS_MAX       (4096)          /* Max number of processes per 
stressor */
+#define STRESS_PROCS_MAX       (8192)          /* Max number of processes per 
stressor */
 
 #define DCCP_BUF               (1024)          /* DCCP I/O buffer size */
 #define SOCKET_BUF             (8192)          /* Socket I/O buffer size */
@@ -354,6 +354,7 @@
        pproc_info_t    proc;
        char *name;                     /* name of setting */
        type_id_t       type_id;        /* setting type */
+       bool            global;         /* true if global */
        union {                         /* setting value */
                uint8_t         uint8;
                int8_t          int8;
@@ -2100,6 +2101,7 @@
 
        OPT_STREAM,
        OPT_STREAM_OPS,
+       OPT_STREAM_INDEX,
        OPT_STREAM_L3_SIZE,
        OPT_STREAM_MADVISE,
 
@@ -2321,6 +2323,7 @@
  *  stressor option value handling
  */
 extern void set_setting(const char *name, const type_id_t type_id, const void 
*value);
+extern void set_setting_global(const char *name, const type_id_t type_id, 
const void *value);
 extern bool get_setting(const char *name, void *value);
 extern void free_settings(void);
 
@@ -2773,6 +2776,7 @@
 extern void stress_set_splice_bytes(const char *opt);
 extern int  stress_set_str_method(const char *name);
 extern void stress_set_stream_L3_size(const char *opt);
+extern void stress_set_stream_index(const char *opt);
 extern int  stress_set_stream_madvise(const char *opt);
 extern void stress_set_sync_file_bytes(const char *opt);
 extern void stress_set_timer_freq(const char *opt);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/stress-ng-0.09.23/stress-pipe.c 
new/stress-ng-0.09.24/stress-pipe.c
--- old/stress-ng-0.09.23/stress-pipe.c 2018-03-28 11:41:12.000000000 +0200
+++ new/stress-ng-0.09.24/stress-pipe.c 2018-04-11 10:59:25.000000000 +0200
@@ -223,7 +223,8 @@
                        inc_counter(args);
                } while (keep_stressing());
 
-               (void)shim_strlcpy(buf, PIPE_STOP, pipe_data_size);
+               (void)memset(buf, 0, sizeof(buf));
+               (void)memcpy(buf, PIPE_STOP, sizeof(PIPE_STOP));
                if (write(pipefds[1], buf, sizeof(buf)) <= 0) {
                        if (errno != EPIPE)
                                pr_fail_dbg("termination write");
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/stress-ng-0.09.23/stress-resources.c 
new/stress-ng-0.09.24/stress-resources.c
--- old/stress-ng-0.09.23/stress-resources.c    2018-03-28 11:41:12.000000000 
+0200
+++ new/stress-ng-0.09.24/stress-resources.c    2018-04-11 10:59:25.000000000 
+0200
@@ -273,7 +273,9 @@
                        info[i].pty_slave = -1;
                        if (info[i].pty_master >= 0) {
                                const char *slavename = 
ptsname(info[i].pty_master);
-                               info[i].pty_slave = open(slavename, O_RDWR | 
flag);
+
+                               if (slavename)
+                                       info[i].pty_slave = open(slavename, 
O_RDWR | flag);
                        }
                }
 #endif
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/stress-ng-0.09.23/stress-stream.c 
new/stress-ng-0.09.24/stress-stream.c
--- old/stress-ng-0.09.23/stress-stream.c       2018-03-28 11:41:12.000000000 
+0200
+++ new/stress-ng-0.09.24/stress-stream.c       2018-04-11 10:59:25.000000000 
+0200
@@ -87,7 +87,16 @@
        return -1;
 }
 
-static inline void OPTIMIZE3 stress_stream_copy(
+void stress_set_stream_index(const char *opt)
+{
+       uint32_t stream_index;
+
+       stream_index = get_int32(opt);
+       check_range("stream-index", stream_index, 0, 3);
+       set_setting("stream-index", TYPE_ID_UINT32, &stream_index);
+}
+
+static inline void OPTIMIZE3 stress_stream_copy_index0(
        double *RESTRICT c,
        const double *RESTRICT a,
        const uint64_t n)
@@ -98,7 +107,46 @@
                c[i] = a[i];
 }
 
-static inline void OPTIMIZE3 stress_stream_scale(
+static inline void OPTIMIZE3 stress_stream_copy_index1(
+       double *RESTRICT c,
+       const double *RESTRICT a,
+       size_t *RESTRICT idx1,
+       const uint64_t n)
+{
+       register uint64_t i;
+
+       for (i = 0; i < n; i++)
+               c[idx1[i]] = a[idx1[i]];
+}
+
+static inline void OPTIMIZE3 stress_stream_copy_index2(
+       double *RESTRICT c,
+       const double *RESTRICT a,
+       size_t *RESTRICT idx1,
+       size_t *RESTRICT idx2,
+       const uint64_t n)
+{
+       register uint64_t i;
+
+       for (i = 0; i < n; i++)
+               c[idx1[i]] = a[idx2[i]];
+}
+
+static inline void OPTIMIZE3 stress_stream_copy_index3(
+       double *RESTRICT c,
+       const double *RESTRICT a,
+       size_t *RESTRICT idx1,
+       size_t *RESTRICT idx2,
+       size_t *RESTRICT idx3,
+       const uint64_t n)
+{
+       register uint64_t i;
+
+       for (i = 0; i < n; i++)
+               c[idx3[idx1[i]]] = a[idx2[i]];
+}
+
+static inline void OPTIMIZE3 stress_stream_scale_index0(
        double *RESTRICT b,
        const double *RESTRICT c,
        const double q,
@@ -110,7 +158,49 @@
                b[i] = q * c[i];
 }
 
-static inline void OPTIMIZE3 stress_stream_add(
+static inline void OPTIMIZE3 stress_stream_scale_index1(
+       double *RESTRICT b,
+       const double *RESTRICT c,
+       const double q,
+       size_t *RESTRICT idx1,
+       const uint64_t n)
+{
+       register uint64_t i;
+
+       for (i = 0; i < n; i++)
+               b[idx1[i]] = q * c[idx1[i]];
+}
+
+static inline void OPTIMIZE3 stress_stream_scale_index2(
+       double *RESTRICT b,
+       const double *RESTRICT c,
+       const double q,
+       size_t *RESTRICT idx1,
+       size_t *RESTRICT idx2,
+       const uint64_t n)
+{
+       register uint64_t i;
+
+       for (i = 0; i < n; i++)
+               b[idx1[i]] = q * c[idx2[i]];
+}
+
+static inline void OPTIMIZE3 stress_stream_scale_index3(
+       double *RESTRICT b,
+       const double *RESTRICT c,
+       const double q,
+       size_t *RESTRICT idx1,
+       size_t *RESTRICT idx2,
+       size_t *RESTRICT idx3,
+       const uint64_t n)
+{
+       register uint64_t i;
+
+       for (i = 0; i < n; i++)
+               b[idx3[idx1[i]]] = q * c[idx2[i]];
+}
+
+static inline void OPTIMIZE3 stress_stream_add_index0(
        const double *RESTRICT a,
        const double *RESTRICT b,
        double *RESTRICT c,
@@ -122,7 +212,49 @@
                c[i] = a[i] + b[i];
 }
 
-static inline void OPTIMIZE3 stress_stream_triad(
+static inline void OPTIMIZE3 stress_stream_add_index1(
+       const double *RESTRICT a,
+       const double *RESTRICT b,
+       double *RESTRICT c,
+       size_t *RESTRICT idx1,
+       const uint64_t n)
+{
+       register uint64_t i;
+
+       for (i = 0; i < n; i++)
+               c[idx1[i]] = a[idx1[i]] + b[idx1[i]];
+}
+
+static inline void OPTIMIZE3 stress_stream_add_index2(
+       const double *RESTRICT a,
+       const double *RESTRICT b,
+       double *RESTRICT c,
+       size_t *RESTRICT idx1,
+       size_t *RESTRICT idx2,
+       const uint64_t n)
+{
+       register uint64_t i;
+
+       for (i = 0; i < n; i++)
+               c[idx1[i]] = a[idx2[i]] + b[idx1[i]];
+}
+
+static inline void OPTIMIZE3 stress_stream_add_index3(
+       const double *RESTRICT a,
+       const double *RESTRICT b,
+       double *RESTRICT c,
+       size_t *RESTRICT idx1,
+       size_t *RESTRICT idx2,
+       size_t *RESTRICT idx3,
+       const uint64_t n)
+{
+       register uint64_t i;
+
+       for (i = 0; i < n; i++)
+               c[idx1[i]] = a[idx2[i]] + b[idx3[i]];
+}
+
+static inline void OPTIMIZE3 stress_stream_triad_index0(
        double *RESTRICT a,
        const double *RESTRICT b,
        const double *RESTRICT c,
@@ -135,6 +267,51 @@
                a[i] = b[i] + (c[i] * q);
 }
 
+static inline void OPTIMIZE3 stress_stream_triad_index1(
+       double *RESTRICT a,
+       const double *RESTRICT b,
+       const double *RESTRICT c,
+       const double q,
+       size_t *RESTRICT idx1,
+       const uint64_t n)
+{
+       register uint64_t i;
+
+       for (i = 0; i < n; i++)
+               a[idx1[i]] = b[idx1[i]] + (c[idx1[i]] * q);
+}
+
+static inline void OPTIMIZE3 stress_stream_triad_index2(
+       double *RESTRICT a,
+       const double *RESTRICT b,
+       const double *RESTRICT c,
+       const double q,
+       size_t *RESTRICT idx1,
+       size_t *RESTRICT idx2,
+       const uint64_t n)
+{
+       register uint64_t i;
+
+       for (i = 0; i < n; i++)
+               a[idx1[i]] = b[idx2[i]] + (c[idx1[i]] * q);
+}
+
+static inline void OPTIMIZE3 stress_stream_triad_index3(
+       double *RESTRICT a,
+       const double *RESTRICT b,
+       const double *RESTRICT c,
+       const double q,
+       size_t *RESTRICT idx1,
+       size_t *RESTRICT idx2,
+       size_t *RESTRICT idx3,
+       const uint64_t n)
+{
+       register uint64_t i;
+
+       for (i = 0; i < n; i++)
+               a[idx1[i]] = b[idx2[i]] + (c[idx3[i]] * q);
+}
+
 static void stress_stream_init_data(
        double *RESTRICT data,
        const uint64_t n)
@@ -223,6 +400,25 @@
        return cache_size;
 }
 
+static void stress_stream_init_index(
+       size_t *RESTRICT idx,
+       const uint64_t n)
+{
+       uint64_t i;
+
+       for (i = 0; i < n; i++) 
+               idx[i] = i;
+
+       for (i = 0; i < n; i++) {
+               register uint64_t j = mwc64() % n;
+               register uint64_t tmp;
+
+               tmp = idx[i];
+               idx[i] = idx[j];
+               idx[j] = tmp;
+       }
+}
+
 /*
  *  stress_stream()
  *     stress cache/memory/CPU with stream stressors
@@ -231,9 +427,11 @@
 {
        int rc = EXIT_FAILURE;
        double *a, *b, *c;
+       size_t *idx1 = NULL, *idx2 = NULL, *idx3 = NULL;
        const double q = 3.0;
        double mb_rate, mb, fp_rate, fp, t1, t2, dt;
-       uint64_t L3, sz, n;
+       uint32_t stream_index = 0;
+       uint64_t L3, sz, n, sz_idx;
        uint64_t stream_L3_size = DEFAULT_STREAM_L3_SIZE;
        bool guess = false;
 
@@ -242,6 +440,8 @@
        else
                L3 = get_stream_L3_size(args);
 
+       (void)get_setting("stream-index", &stream_index);
+
        /* Have to take a hunch and badly guess size */
        if (!L3) {
                guess = true;
@@ -285,16 +485,65 @@
        if (c == MAP_FAILED)
                goto err_c;
 
+       sz_idx = n * sizeof(size_t);
+       switch (stream_index) {
+       case 3:
+               idx3 = stress_stream_mmap(args, sz_idx);
+               if (idx3 == MAP_FAILED)
+                       goto err_idx3;
+               stress_stream_init_index(idx3, n);
+               CASE_FALLTHROUGH;
+       case 2:
+               idx2 = stress_stream_mmap(args, sz_idx);
+               if (idx2 == MAP_FAILED)
+                       goto err_idx2;
+               stress_stream_init_index(idx2, n);
+               CASE_FALLTHROUGH;
+       case 1:
+               idx1 = stress_stream_mmap(args, sz_idx);
+               if (idx1 == MAP_FAILED)
+                       goto err_idx1;
+               stress_stream_init_index(idx1, n);
+               CASE_FALLTHROUGH;
+       case 0:
+       default:
+               break;
+               
+       }
+
        stress_stream_init_data(a, n);
        stress_stream_init_data(b, n);
        stress_stream_init_data(c, n);
 
        t1 = time_now();
        do {
-               stress_stream_copy(c, a, n);
-               stress_stream_scale(b, c, q, n);
-               stress_stream_add(c, b, a, n);
-               stress_stream_triad(a, b, c, q, n);
+               switch (stream_index) {
+               case 3:
+                       stress_stream_copy_index3(c, a, idx1, idx2, idx3, n);
+                       stress_stream_scale_index3(b, c, q, idx1, idx2, idx3, 
n);
+                       stress_stream_add_index3(c, b, a, idx1, idx2, idx3, n);
+                       stress_stream_triad_index3(a, b, c, q, idx1, idx2, 
idx3, n);
+                       break;
+               case 2:
+                       stress_stream_copy_index2(c, a, idx1, idx2, n);
+                       stress_stream_scale_index2(b, c, q, idx1, idx2, n);
+                       stress_stream_add_index2(c, b, a, idx1, idx2, n);
+                       stress_stream_triad_index2(a, b, c, q, idx1, idx2, n);
+                       break;
+               case 1:
+                       stress_stream_copy_index1(c, a, idx1, n);
+                       stress_stream_scale_index1(b, c, q, idx1, n);
+                       stress_stream_add_index1(c, b, a, idx1, n);
+                       stress_stream_triad_index1(a, b, c, q, idx1, n);
+                       break;
+               case 0:
+               default:
+                       stress_stream_copy_index0(c, a, n);
+                       stress_stream_scale_index0(b, c, q, n);
+                       stress_stream_add_index0(c, b, a, n);
+                       stress_stream_triad_index0(a, b, c, q, n);
+                       break;
+               }
                inc_counter(args);
        } while (keep_stressing());
        t2 = time_now();
@@ -315,6 +564,15 @@
 
        rc = EXIT_SUCCESS;
 
+       if (idx3)
+               (void)munmap((void *)idx3, sz_idx);
+err_idx3:
+       if (idx2)
+               (void)munmap((void *)idx2, sz_idx);
+err_idx2:
+       if (idx1)
+               (void)munmap((void *)idx1, sz_idx);
+err_idx1:
        (void)munmap((void *)c, sz);
 err_c:
        (void)munmap((void *)b, sz);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/stress-ng-0.09.23/stress-sync-file.c 
new/stress-ng-0.09.24/stress-sync-file.c
--- old/stress-ng-0.09.23/stress-sync-file.c    2018-03-28 11:41:12.000000000 
+0200
+++ new/stress-ng-0.09.24/stress-sync-file.c    2018-04-11 10:59:25.000000000 
+0200
@@ -165,8 +165,8 @@
                        offset = (mwc64() % sync_file_bytes) & ~((128 * KB) - 
1);
                        ret = shim_sync_file_range(fd, offset, 128 * KB, mode);
                        if (ret < 0) {
-                               break;
                                pr_fail_err("sync_file_range (random)");
+                               break;
                        }
                }
                inc_counter(args);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/stress-ng-0.09.23/stress-sysinfo.c 
new/stress-ng-0.09.24/stress-sysinfo.c
--- old/stress-ng-0.09.23/stress-sysinfo.c      2018-03-28 11:41:12.000000000 
+0200
+++ new/stress-ng-0.09.24/stress-sysinfo.c      2018-04-11 10:59:25.000000000 
+0200
@@ -49,6 +49,8 @@
        int n_mounts;
        char *mnts[128];
 
+       memset(mnts, 0, sizeof(mnts));
+
        n_mounts = mount_get(mnts, SIZEOF_ARRAY(mnts));
        if (n_mounts < 0) {
                pr_err("%s: failed to get mount points\n", args->name);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/stress-ng-0.09.23/stress-tmpfs.c 
new/stress-ng-0.09.24/stress-tmpfs.c
--- old/stress-ng-0.09.23/stress-tmpfs.c        2018-03-28 11:41:12.000000000 
+0200
+++ new/stress-ng-0.09.24/stress-tmpfs.c        2018-04-11 10:59:25.000000000 
+0200
@@ -62,6 +62,8 @@
        char *mnts[MAX_MOUNTS];
        int i, n, fd = -1;
 
+       (void)memset(mnts, 0, sizeof(mnts));
+
        *len = 0;
        n = mount_get(mnts, SIZEOF_ARRAY(mnts));
        if (n < 0)
@@ -72,6 +74,8 @@
        for (i = 0; i < n; i++) {
                struct statfs buf;
 
+               if (!mnts[i])
+                       continue;
                /* Some paths should be avoided... */
                if (!strncmp(mnts[i], "/dev", 4))
                        continue;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/stress-ng-0.09.23/stress-vm.c 
new/stress-ng-0.09.24/stress-vm.c
--- old/stress-ng-0.09.23/stress-vm.c   2018-03-28 11:41:12.000000000 +0200
+++ new/stress-ng-0.09.24/stress-vm.c   2018-04-11 10:59:25.000000000 +0200
@@ -2078,7 +2078,7 @@
                                                args->max_ops << VM_BOGO_SHIFT);
 
                        if (vm_hang == 0) {
-                               for (;;) {
+                               while (keep_stressing_vm(args)) {
                                        (void)sleep(3600);
                                }
                        } else if (vm_hang != DEFAULT_VM_HANG) {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/stress-ng-0.09.23/test/test-fanotify.c 
new/stress-ng-0.09.24/test/test-fanotify.c
--- old/stress-ng-0.09.23/test/test-fanotify.c  2018-03-28 11:41:12.000000000 
+0200
+++ new/stress-ng-0.09.24/test/test-fanotify.c  2018-04-11 10:59:25.000000000 
+0200
@@ -85,8 +85,10 @@
                return -1;
 
        fan_fd = fanotify_init(0, 0);
-       if (fan_fd < 0)
+       if (fan_fd < 0) {
+               free(buffer);
                return -1;
+       }
 
        ret = fanotify_mark(fan_fd, FAN_MARK_ADD | FAN_MARK_MOUNT,
                FAN_ACCESS| FAN_MODIFY | FAN_OPEN | FAN_CLOSE |
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/stress-ng-0.09.23/test/test-posix-memalign.c 
new/stress-ng-0.09.24/test/test-posix-memalign.c
--- old/stress-ng-0.09.23/test/test-posix-memalign.c    2018-03-28 
11:41:12.000000000 +0200
+++ new/stress-ng-0.09.24/test/test-posix-memalign.c    2018-04-11 
10:59:25.000000000 +0200
@@ -27,6 +27,9 @@
 int main(void)
 {
        void *alloc_buf;
+       int ret;
 
-       return posix_memalign((void **)&alloc_buf, 64, (size_t)1024);
+       ret = posix_memalign((void **)&alloc_buf, 64, (size_t)1024);
+       if (!ret)
+               free(alloc_buf);
 }


Reply via email to