All of lore.kernel.org
 help / color / mirror / Atom feed
From: Avi Kivity <avi@redhat.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Takuya Yoshikawa <takuya.yoshikawa@gmail.com>,
	mtosatti@redhat.com, kvm@vger.kernel.org,
	yoshikawa.takuya@oss.ntt.co.jp
Subject: Re: [PATCH] KVM: Avoid wasting pages for small lpage_info arrays
Date: Wed, 16 May 2012 12:26:40 +0300	[thread overview]
Message-ID: <4FB372D0.9030801@redhat.com> (raw)
In-Reply-To: <20120515132551.b204110e.akpm@linux-foundation.org>

On 05/15/2012 11:25 PM, Andrew Morton wrote:
> On Tue, 15 May 2012 11:02:17 +0300
> Avi Kivity <avi@redhat.com> wrote:
>
> > On 05/14/2012 04:29 PM, Takuya Yoshikawa wrote:
> > > On Sun, 13 May 2012 13:20:46 +0300
> > > Avi Kivity <avi@redhat.com> wrote:
> > >
> > > > I don't feel that the savings is worth the extra complication.  We save
> > > > two pages per memslot here.
> > >
> > > Using a 4KB vmalloced page for a 16B array is ...
> > >
> > > Actually I felt like you before and did not do this, but recently there
> > > was a talk about creating hundreds of memslots.
> > >
> > > > What about using kvmalloc() instead of vmalloc()?  It's in
> > > > security/apparmor now, but can be made generic.
> > >
> > > Andrew once, maybe some times, rejected making such an API generic saying
> > > that there should not be a generic criterion by which we can decide which
> > > function - vmalloc() or kmalloc() - to use.
> > >
> > > So each caller should decide by its own criteria.
> > >
> > > In this case, we need to implement kvm specific kvmalloc().
> > > BTW, we are already doing this for dirty_bitmap.
> > 
> > Okay, a local kvmalloc() is better than open-coding the logic.
> > 
> > Andrew, prepare yourself for some code duplication.
>
> There are reasons for avoiding vmalloc().
>
> The kernel does not run in a virtual memory environment.  It is a
> harsh, low-level environment and kernel code should be robust. 

This is about downgrading an existing vmalloc() to kmalloc(), when the
sizes permit, to reduce wastage.  Not about upgrading a kmalloc() to
vmalloc().

> Assuming that you can allocate vast amounts of contiguous memory is not
> robust.  Robust code will implement data structures which avoid this
> weakness.

This is true on some architectures.  On others vast amounts of
contiguous memory _are_ available, and implementing software radix trees
to replace the hardware radix trees is not going to improve things.

-- 
error compiling committee.c: too many arguments to function


      reply	other threads:[~2012-05-16  9:26 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-10 14:33 [PATCH] KVM: Avoid wasting pages for small lpage_info arrays Takuya Yoshikawa
2012-05-13 10:20 ` Avi Kivity
2012-05-14 13:29   ` Takuya Yoshikawa
2012-05-15  8:02     ` Avi Kivity
2012-05-15 20:25       ` Andrew Morton
2012-05-16  9:26         ` 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=4FB372D0.9030801@redhat.com \
    --to=avi@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=kvm@vger.kernel.org \
    --cc=mtosatti@redhat.com \
    --cc=takuya.yoshikawa@gmail.com \
    --cc=yoshikawa.takuya@oss.ntt.co.jp \
    /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.