mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
To: Bibo Mao <maobibo@loongson.cn>, Paolo Bonzini <pbonzini@redhat.com>
Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] KVM: Remove duplicated zero clear with dirty_bitmap buffer
Date: Thu, 13 Jun 2024 21:25:38 +0200	[thread overview]
Message-ID: <115973a9-caa6-4d53-a477-dea2d2291598@wanadoo.fr> (raw)
In-Reply-To: <20240613125407.1126587-1-maobibo@loongson.cn>

Le 13/06/2024 à 14:54, Bibo Mao a écrit :
> Since dirty_bitmap pointer is allocated with function __vcalloc(),
> there is __GFP_ZERO flag set in the implementation about this function
> __vcalloc_noprof(). It is not necessary to clear dirty_bitmap buffer
> with zero again.
> 
> Signed-off-by: Bibo Mao <maobibo@loongson.cn>
> ---
>   virt/kvm/kvm_main.c | 3 ---
>   1 file changed, 3 deletions(-)
> 

Hi,

> diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
> index 14841acb8b95..c7d4a041dcfa 100644
> --- a/virt/kvm/kvm_main.c
> +++ b/virt/kvm/kvm_main.c
> @@ -1669,9 +1669,6 @@ static int kvm_prepare_memory_region(struct kvm *kvm,
>   			r = kvm_alloc_dirty_bitmap(new);
>   			if (r)
>   				return r;
> -
> -			if (kvm_dirty_log_manual_protect_and_init_set(kvm))
> -				bitmap_set(new->dirty_bitmap, 0, new->npages);

unless I miss something obvious, this does not clear anything, but set 
all bits to 1.

0 is not for "write 0" (i.e. clear), but for "start at offset 0".
So all bits are set to 1 in this case.

CJ

>   		}
>   	}
>   
> 
> base-commit: 83a7eefedc9b56fe7bfeff13b6c7356688ffa670


  reply	other threads:[~2024-06-13 19:27 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-13 12:54 Bibo Mao
2024-06-13 19:25 ` Christophe JAILLET [this message]
2024-06-14  2:45   ` maobibo
2024-06-20 21:17     ` Paolo Bonzini
2024-06-21  1:59       ` maobibo

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=115973a9-caa6-4d53-a477-dea2d2291598@wanadoo.fr \
    --to=christophe.jaillet@wanadoo.fr \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maobibo@loongson.cn \
    --cc=pbonzini@redhat.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

all inboxes | Powered by JetHome®