[PATCH] btreplay: Fix typo in scaling up the dynamic cpu set size.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Josef Cejka <jcejka@xxxxxxxx>

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@xxxxxxxx>
Signed-off-by: Jeff Mahoney <jeffm@xxxxxxxx>
---

 btreplay/btreplay.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/btreplay/btreplay.c
+++ b/btreplay/btreplay.c
@@ -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");


-- 
Jeff Mahoney
SUSE Labs
--
To unsubscribe from this list: send the line "unsubscribe linux-btrace" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Netdev]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux