public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Clemens Ladisch <clemens@ladisch.de>
To: Ian Molton <ian.molton@collabora.co.uk>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: Buffer allocation question
Date: Tue, 14 Sep 2010 08:52:56 +0200	[thread overview]
Message-ID: <4C8F1BC8.4010201@ladisch.de> (raw)
In-Reply-To: <4C8E4898.7090407@collabora.co.uk>

Ian Molton wrote:
> I need to allocate some fairly large buffers which will be transferred 
> via virtio to a hypervisor.
> 
> the pages dont have to be contiguous physically and aside from the first 
> page int he transfer, the kernel wont really care about the contents of 
> the buffer.
> 
> the pages do need to be mapped into userspace contiguously, however. 

See drivers/firewire/core-iso.c, which uses fixed-size buffers.

> They are also often dynamically resized.
> ...
> my first thought (before realising how limited vmalloc space is) was to 
> vmalloc() them in my mmap() function, but this approach ran into trouble 
> when I discovered that the mmap() call does not get called if the vma 
> grows, so I cant then hook in and allocate more vmalloc() space.

You can set vma->vm_ops.

> the buffers will usually be filled all in one go, so it seems silly to 
> fault them in a page at a time.

AFAICS you don't have a choice when resizing.


Regards,
Clemens

  reply	other threads:[~2010-09-14  6:52 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-13 15:51 Buffer allocation question Ian Molton
2010-09-14  6:52 ` Clemens Ladisch [this message]
2010-09-14 17:43   ` Ian Molton

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=4C8F1BC8.4010201@ladisch.de \
    --to=clemens@ladisch.de \
    --cc=ian.molton@collabora.co.uk \
    --cc=linux-kernel@vger.kernel.org \
    /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