linux-btrace.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff Mahoney <jeffm@suse.com>
To: linux-btrace@vger.kernel.org
Subject: [PATCH] btreplay: Fix typo in scaling up the dynamic cpu set size.
Date: Thu, 20 Aug 2015 15:52:51 +0000	[thread overview]
Message-ID: <55D5F7D3.7090005@suse.com> (raw)

From: Josef Cejka <jcejka@suse.com>

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>
---

 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

             reply	other threads:[~2015-08-20 15:52 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-20 15:52 Jeff Mahoney [this message]
2015-08-20 15:59 ` [PATCH] btreplay: Fix typo in scaling up the dynamic cpu set size Jens Axboe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=55D5F7D3.7090005@suse.com \
    --to=jeffm@suse.com \
    --cc=linux-btrace@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).