All of lore.kernel.org
 help / color / mirror / Atom feed
From: Oliver Upton <oliver.upton@linux.dev>
To: Anish Moorthy <amoorthy@google.com>
Cc: pbonzini@redhat.com, kvm@vger.kernel.org, jthoughton@google.com,
	seanjc@google.com
Subject: Re: [PATCH] selftests/kvm: Fix bug in how demand_paging_test calculates paging rate
Date: Thu, 16 Feb 2023 20:13:10 +0000	[thread overview]
Message-ID: <Y+6OVtw1kEO99Gah@linux.dev> (raw)
In-Reply-To: <20230216200218.1028943-1-amoorthy@google.com>

The shortlog doesn't give any hint as to what the bug actually is.
Maybe:

  KVM: selftests: Fix nsec to sec conversion in demand_paging_test

On Thu, Feb 16, 2023 at 08:02:18PM +0000, Anish Moorthy wrote:
> The current denominator is 1E8, not 1E9 as it should be.

  demand_paging_test uses 1E8 as the denominator to convert nanoseconds
  to seconds, which is wrong. Use NSEC_PER_SEC instead to fix the issue
  and make the conversion obvious.

> Reported-by: James Houghton <jthoughton@google.com>
> Signed-off-by: Anish Moorthy <amoorthy@google.com>

Bikeshedding aside:

Reviewed-by: Oliver Upton <oliver.upton@linux.dev>

> ---
>  tools/testing/selftests/kvm/demand_paging_test.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tools/testing/selftests/kvm/demand_paging_test.c b/tools/testing/selftests/kvm/demand_paging_test.c
> index b0e1fc4de9e29..2439c4043fed6 100644
> --- a/tools/testing/selftests/kvm/demand_paging_test.c
> +++ b/tools/testing/selftests/kvm/demand_paging_test.c
> @@ -194,7 +194,7 @@ static void run_test(enum vm_guest_mode mode, void *arg)
>  		ts_diff.tv_sec, ts_diff.tv_nsec);
>  	pr_info("Overall demand paging rate: %f pgs/sec\n",
>  		memstress_args.vcpu_args[0].pages * nr_vcpus /
> -		((double)ts_diff.tv_sec + (double)ts_diff.tv_nsec / 100000000.0));
> +		((double)ts_diff.tv_sec + (double)ts_diff.tv_nsec / NSEC_PER_SEC));
>  
>  	memstress_destroy_vm(vm);
>  
> -- 
> 2.39.2.637.g21b0678d19-goog
> 

-- 
Thanks,
Oliver

  reply	other threads:[~2023-02-16 20:13 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-16 20:02 [PATCH] selftests/kvm: Fix bug in how demand_paging_test calculates paging rate Anish Moorthy
2023-02-16 20:13 ` Oliver Upton [this message]
2023-02-16 20:17   ` Sean Christopherson
2023-02-16 20:24     ` [PATCH] selftests/kvm: Fix nsec to sec conversion in demand_paging_test Anish Moorthy
2023-02-16 20:33       ` Sean Christopherson

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=Y+6OVtw1kEO99Gah@linux.dev \
    --to=oliver.upton@linux.dev \
    --cc=amoorthy@google.com \
    --cc=jthoughton@google.com \
    --cc=kvm@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=seanjc@google.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.