btreplay: Fix typo in scaling up the dynamic cpu set size.
authorJosef Cejka <jcejka@suse.com>
Thu, 20 Aug 2015 15:52:51 +0000 (11:52 -0400)
committerJens Axboe <axboe@fb.com>
Thu, 20 Aug 2015 15:58:08 +0000 (08:58 -0700)
In get_ncpus, we default to using 4096 CPUs if _SC_NPROCESSORS_CONF isn't
enabled.  If that is insufficient, sched_getaffinity will fail and we
retry after doubling the size of the cpu_set_t allocation.  There's a typo
in there that means we don't actually double the size and will loop
forever allocating the same sized cpu_set_t instead.

Signed-off-by: Josef Cejka <jcejka@suse.com>
Signed-off-by: Jeff Mahoney <jeffm@suse.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
btreplay/btreplay.c

index 54440103e25fdb6efa430df2c2f46efd26e47a8e..f76227979ebccfedd85ab93a88bbb44ae67da2ec 100644 (file)
@@ -516,7 +516,7 @@ realloc:
        if (sched_getaffinity(getpid(), size, cpus)) {
                if( errno == EINVAL && nrcpus < (4096<<4) ) {
                        CPU_FREE(cpus);
-                       nrcpus <= 1;
+                       nrcpus <<= 1;
                        goto realloc;
                }
                fatal("sched_getaffinity", ERR_SYSCALL, "Can't get CPU info\n");