From: Xiao Guangrong <xiaoguangrong@linux.vnet.ibm.com>
To: Avi Kivity <avi@redhat.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>,
LKML <linux-kernel@vger.kernel.org>, KVM <kvm@vger.kernel.org>
Subject: Re: [PATCH v2 3/3] KVM: remove dummy pages
Date: Thu, 26 Jul 2012 17:25:07 +0800 [thread overview]
Message-ID: <50110CF3.4070308@linux.vnet.ibm.com> (raw)
In-Reply-To: <5011062F.3080505@redhat.com>
On 07/26/2012 04:56 PM, Avi Kivity wrote:
> On 07/26/2012 06:58 AM, Xiao Guangrong wrote:
>> Currently, kvm allocates some pages and use them as error indicators,
>> it wastes memory and is not good for scalability
>>
>> Base on Avi's suggestion, we use the error codes instead of these pages
>> to indicate the error conditions
>>
>>
>> +static pfn_t get_bad_pfn(void)
>> +{
>> + return -ENOENT;
>> +}
>> +
>> +pfn_t get_fault_pfn(void)
>> +{
>> + return -EFAULT;
>> +}
>> +EXPORT_SYMBOL_GPL(get_fault_pfn);
>> +
>> +static pfn_t get_hwpoison_pfn(void)
>> +{
>> + return -EHWPOISON;
>> +}
>> +
>
> Would be better as #defines
Okay.
>
>> int is_hwpoison_pfn(pfn_t pfn)
>> {
>> - return pfn == hwpoison_pfn;
>> + return pfn == -EHWPOISON;
>> }
>> EXPORT_SYMBOL_GPL(is_hwpoison_pfn);
>>
>> int is_noslot_pfn(pfn_t pfn)
>> {
>> - return pfn == bad_pfn;
>> + return pfn == -ENOENT;
>> }
>> EXPORT_SYMBOL_GPL(is_noslot_pfn);
>>
>> int is_invalid_pfn(pfn_t pfn)
>> {
>> - return pfn == hwpoison_pfn || pfn == fault_pfn;
>> + return !is_noslot_pfn(pfn) && is_error_pfn(pfn);
>> }
>> EXPORT_SYMBOL_GPL(is_invalid_pfn);
>>
>
> So is_*_pfn() could go away and be replaced by ==.
>
Okay.
>>
>> EXPORT_SYMBOL_GPL(gfn_to_page);
>>
>> void kvm_release_page_clean(struct page *page)
>> {
>> - kvm_release_pfn_clean(page_to_pfn(page));
>> + if (!is_error_page(page))
>> + kvm_release_pfn_clean(page_to_pfn(page));
>> }
>> EXPORT_SYMBOL_GPL(kvm_release_page_clean);
>
> Note, we can remove calls to kvm_release_page_clean() from error paths
> now, so in the future we can drop the test.
>
Right, since the release path (kvm_release_page_clean) is used in many place
and on many architectures, i did the change as small as possible for good
review.
> Since my comments are better done as a separate patch,
Yes, i will make a patch to apply all your comments. Thank you, Avi!
prev parent reply other threads:[~2012-07-26 9:25 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-07-26 3:56 [PATCH v2 0/3] KVM: remove dummy pages Xiao Guangrong
2012-07-26 3:57 ` [PATCH v2 1/3] KVM: MMU: use kvm_release_pfn_clean to release pfn Xiao Guangrong
2012-07-26 3:58 ` [PATCH v2 2/3] KVM: use kvm_release_page_clean to release the page Xiao Guangrong
2012-07-26 3:58 ` [PATCH v2 3/3] KVM: remove dummy pages Xiao Guangrong
2012-07-26 8:56 ` Avi Kivity
2012-07-26 9:20 ` Takuya Yoshikawa
2012-07-26 9:35 ` Xiao Guangrong
2012-07-26 9:52 ` Takuya Yoshikawa
2012-07-26 9:25 ` Xiao Guangrong [this message]
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=50110CF3.4070308@linux.vnet.ibm.com \
--to=xiaoguangrong@linux.vnet.ibm.com \
--cc=avi@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mtosatti@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 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.