* [PATCH] btreplay: Fix typo in scaling up the dynamic cpu set size.
@ 2015-08-20 15:52 Jeff Mahoney
2015-08-20 15:59 ` Jens Axboe
0 siblings, 1 reply; 2+ messages in thread
From: Jeff Mahoney @ 2015-08-20 15:52 UTC (permalink / raw)
To: linux-btrace
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
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [PATCH] btreplay: Fix typo in scaling up the dynamic cpu set size.
2015-08-20 15:52 [PATCH] btreplay: Fix typo in scaling up the dynamic cpu set size Jeff Mahoney
@ 2015-08-20 15:59 ` Jens Axboe
0 siblings, 0 replies; 2+ messages in thread
From: Jens Axboe @ 2015-08-20 15:59 UTC (permalink / raw)
To: linux-btrace
On 08/20/2015 08:52 AM, Jeff Mahoney wrote:
> 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;
Hah, well that sucks. Looks like commit 0a915aabe88ff added that
problem, and wasn't caught in review.
Thanks, applied.
--
Jens Axboe
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-08-20 15:59 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-08-20 15:52 [PATCH] btreplay: Fix typo in scaling up the dynamic cpu set size Jeff Mahoney
2015-08-20 15:59 ` Jens Axboe
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).