From: Avi Kivity <avi@redhat.com>
To: Lai Jiangshan <laijs@cn.fujitsu.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>,
LKML <linux-kernel@vger.kernel.org>,
kvm@vger.kernel.org
Subject: Re: [PATCH] kvm: don not fail when cache is sufficient
Date: Wed, 21 Apr 2010 11:45:26 +0300 [thread overview]
Message-ID: <4BCEBB26.1060308@redhat.com> (raw)
In-Reply-To: <4BC9790F.1070403@cn.fujitsu.com>
On 04/17/2010 12:02 PM, Lai Jiangshan wrote:
> cleanup: don not fail when cache is sufficient
>
> Signed-off-by: Lai Jiangshan<laijs@cn.fujitsu.com>
> ---
> diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c
> index c8c074c..90f666e 100644
> --- a/arch/x86/kvm/mmu.c
> +++ b/arch/x86/kvm/mmu.c
> @@ -304,7 +304,7 @@ static int mmu_topup_memory_cache(struct kvm_mmu_memory_cache *cache,
> while (cache->nobjs< ARRAY_SIZE(cache->objects)) {
> obj = kmem_cache_zalloc(base_cache, GFP_KERNEL);
> if (!obj)
> - return -ENOMEM;
> + return cache->nobjs>= min ? 0 : -ENOMEM;
> cache->objects[cache->nobjs++] = obj;
> }
> return 0;
> @@ -326,7 +326,7 @@ static int mmu_topup_memory_cache_page(struct kvm_mmu_memory_cache *cache,
> while (cache->nobjs< ARRAY_SIZE(cache->objects)) {
> page = alloc_page(GFP_KERNEL);
> if (!page)
> - return -ENOMEM;
> + return cache->nobjs>= min ? 0 : -ENOMEM;
> set_page_private(page, 0);
> cache->objects[cache->nobjs++] = page_address(page);
> }
>
>
Have you ever observed this? My feeling is that if we're a few pages
from -ENOMEM, it doesn't really matter if we die now or a few calls
away. Note alloc_page() can call back into kvm via the shrinker to free
pages, so an OOM will be external to kvm and we won't really be able to
handle it.
--
error compiling committee.c: too many arguments to function
prev parent reply other threads:[~2010-04-21 8:45 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-04-17 9:02 [PATCH] kvm: don not fail when cache is sufficient Lai Jiangshan
2010-04-21 8:45 ` Avi Kivity [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=4BCEBB26.1060308@redhat.com \
--to=avi@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=laijs@cn.fujitsu.com \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox