From: Avi Kivity <avi@redhat.com>
To: Takuya Yoshikawa <takuya.yoshikawa@gmail.com>
Cc: mtosatti@redhat.com, kvm@vger.kernel.org
Subject: Re: [PATCH 3/4] KVM: Simplify ifndef conditional usage in __kvm_set_memory_region()
Date: Sun, 29 Jan 2012 18:09:50 +0200 [thread overview]
Message-ID: <4F256F4E.10300@redhat.com> (raw)
In-Reply-To: <20120129213007.5ef934bf771bf73bb3355264@gmail.com>
On 01/29/2012 02:30 PM, Takuya Yoshikawa wrote:
> From: Takuya Yoshikawa <yoshikawa.takuya@oss.ntt.co.jp>
>
> Narrow down the controlled text inside the conditional so that it will
> include lpage_info and rmap stuff only.
>
> For this we change the way we check whether the slot is being created
> from "if (npages && !new.rmap)" to "if (npages && !old.npages)".
>
> static struct kvm_memory_slot *
> search_memslots(struct kvm_memslots *slots, gfn_t gfn)
> @@ -828,23 +828,20 @@ int __kvm_set_memory_region(struct kvm *kvm,
> r = -ENOMEM;
>
> /* Allocate if a slot is being created */
> + if (npages && !old.npages) {
> + new.user_alloc = user_alloc;
> + if (user_alloc)
> + new.userspace_addr = mem->userspace_addr;
This if () is new, is it not? ah, I see it was in the S390 path. Better
to remove it.
> #ifndef CONFIG_S390
> - if (npages && !new.rmap) {
> - new.rmap = vzalloc(npages * sizeof(*new.rmap));
> -
> - if (!new.rmap)
> + if (!new.rmap) {
Why this new test? Can we have a new slot that does have an rmap?
> + new.rmap = vzalloc(npages * sizeof(*new.rmap));
> + if (!new.rmap)
> + goto out_free;
> + }
> + if (create_lpage_info(&new, npages))
> goto out_free;
> -
> - new.user_alloc = user_alloc;
> - new.userspace_addr = mem->userspace_addr;
> +#endif /* not defined CONFIG_S390 */
> }
> - if (!npages)
> - goto skip_lpage;
> -
> - if (create_lpage_info(&new, npages))
> - goto out_free;
> -
> -skip_lpage:
>
> /* Allocate page dirty bitmap if needed */
> if ((new.flags & KVM_MEM_LOG_DIRTY_PAGES) && !new.dirty_bitmap) {
> @@ -852,11 +849,6 @@ skip_lpage:
> goto out_free;
> /* destroy any largepage mappings for dirty tracking */
> }
> -#else /* not defined CONFIG_S390 */
> - new.user_alloc = user_alloc;
> - if (user_alloc)
> - new.userspace_addr = mem->userspace_addr;
> -#endif /* not defined CONFIG_S390 */
>
> if (!npages) {
> struct kvm_memory_slot *slot;
--
error compiling committee.c: too many arguments to function
next prev parent reply other threads:[~2012-01-29 16:09 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-01-29 12:26 [PATCH 0/4] KVM: Introduce kvm_memory_slot::arch Takuya Yoshikawa
2012-01-29 12:27 ` [PATCH 1/4] KVM: Introduce gfn_to_index() which returns the index for a given level Takuya Yoshikawa
2012-01-29 12:28 ` [PATCH 2/4] KVM: Split lpage_info creation out from __kvm_set_memory_region() Takuya Yoshikawa
2012-01-29 12:30 ` [PATCH 3/4] KVM: Simplify ifndef conditional usage in __kvm_set_memory_region() Takuya Yoshikawa
2012-01-29 16:09 ` Avi Kivity [this message]
2012-01-29 12:31 ` [PATCH 4/4] KVM: Introduce kvm_memory_slot::arch and move lpage_info into it Takuya Yoshikawa
-- strict thread matches above, loose matches on Subject: below --
2012-02-08 3:58 [PATCH 0/4 v4] KVM: Introduce kvm_memory_slot::arch Takuya Yoshikawa
2012-02-08 4:01 ` [PATCH 3/4] KVM: Simplify ifndef conditional usage in __kvm_set_memory_region() Takuya Yoshikawa
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=4F256F4E.10300@redhat.com \
--to=avi@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=mtosatti@redhat.com \
--cc=takuya.yoshikawa@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