qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
To: Richard Henderson <rth@twiddle.net>
Cc: qemu-devel@nongnu.org, pbonzini@redhat.com, qemu-arm@nongnu.org,
	vijay.kilari@gmail.com, peter.maydell@linaro.org
Subject: Re: [Qemu-devel] [PATCH 2/7] cutils: Export only buffer_is_zero
Date: Wed, 24 Aug 2016 09:37:55 +0100	[thread overview]
Message-ID: <20160824083754.GB2032@work-vm> (raw)
In-Reply-To: <1472012279-20581-3-git-send-email-rth@twiddle.net>

* Richard Henderson (rth@twiddle.net) wrote:
> Since the two users don't make use of the returned offset,
> beyond ensuring that the entire buffer is zero, consider the
> can_use_buffer_find_nonzero_offset and buffer_find_nonzero_offset
> functions internal.
> 
> Signed-off-by: Richard Henderson <rth@twiddle.net>

Thanks, I've wanted to kill that off for a while.

Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>

> ---
>  include/qemu/cutils.h | 2 --
>  migration/ram.c       | 2 +-
>  migration/rdma.c      | 5 +----
>  util/cutils.c         | 8 ++++----
>  4 files changed, 6 insertions(+), 11 deletions(-)
> 
> diff --git a/include/qemu/cutils.h b/include/qemu/cutils.h
> index 3e4ea23..ca58577 100644
> --- a/include/qemu/cutils.h
> +++ b/include/qemu/cutils.h
> @@ -168,8 +168,6 @@ int64_t qemu_strtosz_suffix_unit(const char *nptr, char **end,
>  /* used to print char* safely */
>  #define STR_OR_NULL(str) ((str) ? (str) : "null")
>  
> -bool can_use_buffer_find_nonzero_offset(const void *buf, size_t len);
> -size_t buffer_find_nonzero_offset(const void *buf, size_t len);
>  bool buffer_is_zero(const void *buf, size_t len);
>  
>  /*
> diff --git a/migration/ram.c b/migration/ram.c
> index a3d70c4..a6e1c63 100644
> --- a/migration/ram.c
> +++ b/migration/ram.c
> @@ -73,7 +73,7 @@ static const uint8_t ZERO_TARGET_PAGE[TARGET_PAGE_SIZE];
>  
>  static inline bool is_zero_range(uint8_t *p, uint64_t size)
>  {
> -    return buffer_find_nonzero_offset(p, size) == size;
> +    return buffer_is_zero(p, size);
>  }
>  
>  /* struct contains XBZRLE cache and a static page
> diff --git a/migration/rdma.c b/migration/rdma.c
> index 5110ec8..88bdb64 100644
> --- a/migration/rdma.c
> +++ b/migration/rdma.c
> @@ -1934,10 +1934,7 @@ retry:
>               * memset() + madvise() the entire chunk without RDMA.
>               */
>  
> -            if (can_use_buffer_find_nonzero_offset((void *)(uintptr_t)sge.addr,
> -                                                   length)
> -                   && buffer_find_nonzero_offset((void *)(uintptr_t)sge.addr,
> -                                                    length) == length) {
> +            if (buffer_is_zero((void *)(uintptr_t)sge.addr, length)) {
>                  RDMACompress comp = {
>                                          .offset = current_addr,
>                                          .value = 0,
> diff --git a/util/cutils.c b/util/cutils.c
> index 1c8635c..621ca67 100644
> --- a/util/cutils.c
> +++ b/util/cutils.c
> @@ -327,9 +327,9 @@ static bool avx2_support(void)
>      return b & bit_AVX2;
>  }
>  
> -bool can_use_buffer_find_nonzero_offset(const void *buf, size_t len) \
> +static bool can_use_buffer_find_nonzero_offset(const void *buf, size_t len) \
>           __attribute__ ((ifunc("can_use_buffer_find_nonzero_offset_ifunc")));
> -size_t buffer_find_nonzero_offset(const void *buf, size_t len) \
> +static size_t buffer_find_nonzero_offset(const void *buf, size_t len) \
>           __attribute__ ((ifunc("buffer_find_nonzero_offset_ifunc")));
>  
>  static void *buffer_find_nonzero_offset_ifunc(void)
> @@ -350,12 +350,12 @@ static void *can_use_buffer_find_nonzero_offset_ifunc(void)
>  }
>  #pragma GCC pop_options
>  #else
> -bool can_use_buffer_find_nonzero_offset(const void *buf, size_t len)
> +static bool can_use_buffer_find_nonzero_offset(const void *buf, size_t len)
>  {
>      return can_use_buffer_find_nonzero_offset_inner(buf, len);
>  }
>  
> -size_t buffer_find_nonzero_offset(const void *buf, size_t len)
> +static size_t buffer_find_nonzero_offset(const void *buf, size_t len)
>  {
>      return buffer_find_nonzero_offset_inner(buf, len);
>  }
> -- 
> 2.7.4
> 
> 
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK

  reply	other threads:[~2016-08-24  8:38 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-24  4:17 [Qemu-devel] [PATCH 0/7] Improve buffer_is_zero Richard Henderson
2016-08-24  4:17 ` [Qemu-devel] [PATCH 1/7] cutils: Remove SPLAT macro Richard Henderson
2016-08-24  4:17 ` [Qemu-devel] [PATCH 2/7] cutils: Export only buffer_is_zero Richard Henderson
2016-08-24  8:37   ` Dr. David Alan Gilbert [this message]
2016-08-24  4:17 ` [Qemu-devel] [PATCH 3/7] cutils: Rearrange buffer_is_zero acceleration Richard Henderson
2016-08-24  4:17 ` [Qemu-devel] [PATCH 4/7] cutils: Add generic prefetch Richard Henderson
2016-08-24  4:17 ` [Qemu-devel] [PATCH 5/7] cutils: Rewrite x86 buffer zero checking Richard Henderson
2016-08-24  4:17 ` [Qemu-devel] [PATCH 6/7] cutils: Rewrite aarch64 " Richard Henderson
2016-08-24  4:17 ` [Qemu-devel] [PATCH 7/7] cutils: Rewrite ppc " Richard Henderson
2016-08-24  4:30 ` [Qemu-devel] [PATCH 0/7] Improve buffer_is_zero no-reply
2016-08-24  4:38   ` Paolo Bonzini
2016-08-24 14:53     ` Richard Henderson
2016-08-24 14:59       ` Paolo Bonzini
2016-08-24  8:34 ` Dr. David Alan Gilbert
2016-08-24 10:26   ` Adam Richter
2016-08-24 10:52     ` Peter Maydell
2016-08-24 11:45       ` Paolo Bonzini
2016-08-24 12:22         ` Peter Maydell
2016-08-25  6:37 ` Vijay Kilari
2016-08-25  8:04   ` Vijay Kilari

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=20160824083754.GB2032@work-vm \
    --to=dgilbert@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=rth@twiddle.net \
    --cc=vijay.kilari@gmail.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 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).