All of lore.kernel.org
 help / color / mirror / Atom feed
From: Aurelien Jarno <aurelien@aurel32.net>
To: Richard Henderson <rth@twiddle.net>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 2/2] cputlb: Tidy memset of arrays
Date: Sun, 22 Dec 2013 19:04:56 +0100	[thread overview]
Message-ID: <20131222180456.GG4326@ohm.rr44.fr> (raw)
In-Reply-To: <1386366292-5340-2-git-send-email-rth@twiddle.net>

On Sat, Dec 07, 2013 at 10:44:52AM +1300, Richard Henderson wrote:
> Don't duplicate the array length computation in the memset
> when plain sizeof can produce the correct results.
> 
> Signed-off-by: Richard Henderson <rth@twiddle.net>
> ---
>  cputlb.c        | 2 +-
>  translate-all.c | 5 ++---
>  2 files changed, 3 insertions(+), 4 deletions(-)
> 
> diff --git a/cputlb.c b/cputlb.c
> index d2da404..9270055 100644
> --- a/cputlb.c
> +++ b/cputlb.c
> @@ -57,7 +57,7 @@ void tlb_flush(CPUArchState *env, int flush_global)
>      cpu->current_tb = NULL;
>  
>      memset(env->tlb_table, -1, sizeof(env->tlb_table));
> -    memset(env->tb_jmp_cache, 0, TB_JMP_CACHE_SIZE * sizeof (void *));
> +    memset(env->tb_jmp_cache, 0, sizeof(env->tb_jmp_cache));
>  
>      env->tlb_flush_addr = -1;
>      env->tlb_flush_mask = 0;
> diff --git a/translate-all.c b/translate-all.c
> index aeda54d..66755b1 100644
> --- a/translate-all.c
> +++ b/translate-all.c
> @@ -699,11 +699,10 @@ void tb_flush(CPUArchState *env1)
>      CPU_FOREACH(cpu) {
>          CPUArchState *env = cpu->env_ptr;
>  
> -        memset(env->tb_jmp_cache, 0, TB_JMP_CACHE_SIZE * sizeof(void *));
> +        memset(env->tb_jmp_cache, 0, sizeof(env->tb_jmp_cache));
>      }
>  
> -    memset(tcg_ctx.tb_ctx.tb_phys_hash, 0,
> -            CODE_GEN_PHYS_HASH_SIZE * sizeof(void *));
> +    memset(tcg_ctx.tb_ctx.tb_phys_hash, 0, sizeof(tcg_ctx.tb_ctx.tb_phys_hash));
>      page_flush_tb();
>  
>      tcg_ctx.code_gen_ptr = tcg_ctx.code_gen_buffer;

Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>

-- 
Aurelien Jarno                          GPG: 1024D/F1BCDB73
aurelien@aurel32.net                 http://www.aurel32.net

  reply	other threads:[~2013-12-22 18:05 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-06 21:44 [Qemu-devel] [PATCH 1/2] cputlb: Use memset when flushing entries Richard Henderson
2013-12-06 21:44 ` [Qemu-devel] [PATCH 2/2] cputlb: Tidy memset of arrays Richard Henderson
2013-12-22 18:04   ` Aurelien Jarno [this message]
2013-12-22 18:04 ` [Qemu-devel] [PATCH 1/2] cputlb: Use memset when flushing entries Aurelien Jarno
2013-12-23 14:37   ` Andreas Färber

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=20131222180456.GG4326@ohm.rr44.fr \
    --to=aurelien@aurel32.net \
    --cc=qemu-devel@nongnu.org \
    --cc=rth@twiddle.net \
    /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.