From: Simon Richter <Simon.Richter@hogyros.de>
To: Ravi Gupta <dceravigupta@gmail.com>
Cc: linuxppc-dev@lists.ozlabs.org
Subject: Re: Memory Mapping Buffers smaller than page size?
Date: Wed, 28 Jul 2010 16:21:40 +0200 [thread overview]
Message-ID: <20100728142140.GA9494@richter> (raw)
In-Reply-To: <AANLkTikVrftUUC2W+NgWyZi6cc4H4c+mPza9MfsDKuxF@mail.gmail.com>
Hi,
On Wed, Jul 28, 2010 at 06:44:10PM +0530, Ravi Gupta wrote:
> I am new to linux device drivers development. I have created 16 buffers of
> size 256 bytes each(using kmalloc()) in my device driver code. I want to
> memory map these buffers to user space. Now is it possible to memory map
> these buffer(16*256 = 4096 = 1 page on 32 bit linux) into a single page in
> user space OR i have to map them in individual pages in user space? Note,
> all the buffers may not be stored in continuous memory location.
Pages are the smallest unit for mappings, so each buffer would end up in
its own mapping. If you want the buffers to be accessible without an
offset, then you cannot have them in continuous locations, as you cannot
map memory from the middle of a page to the beginning either.
So your options are: one page per buffer (wasteful, but gives you
granular access control), or allocating all the buffers as a single
block.
Simon
next prev parent reply other threads:[~2010-07-28 14:49 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-07-28 13:14 Memory Mapping Buffers smaller than page size? Ravi Gupta
2010-07-28 14:21 ` Simon Richter [this message]
2010-07-29 6:15 ` Ravi Gupta
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=20100728142140.GA9494@richter \
--to=simon.richter@hogyros.de \
--cc=dceravigupta@gmail.com \
--cc=linuxppc-dev@lists.ozlabs.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;
as well as URLs for NNTP newsgroup(s).