From: Brian McGrew <brian@visionpro.com>
To: <linux-kernel@vger.kernel.org>
Subject: mmap vs. real memory
Date: Thu, 10 Sep 2009 15:38:11 -0700 [thread overview]
Message-ID: <C6CECDE3.13A4A%brian@visionpro.com> (raw)
Good afternoon all,
Right now, I'm in what appears [to me] to be a very tricky situation. We
have several programs that all need access to the same memory. Currently,
we use mmap and map to a file on disk like this:
const u_long kCommsegSize = 1024L * 1024L * 1024L;
const u_long kCommsegMappedAddress = 0xb0000000;
And then the code is:
char *cseg_addr = reinterpret_cast<char *>(mmap(
reinterpret_cast<char *>(kCommsegMappedAddress),
size,
PROT_READ | PROT_WRITE,
MAP_SHARED | MAP_FIXED,
fd,
0));
gShmemOffset = kCommsegMappedAddress - kCommseg;
return(cseg_addr);
And, all of this has worked great ever since we went from a physical shared
memory board on a vme bus to emulating shared memory on the computer. In
the beginning, kCommsegSize was only 4MB (4L * 1024L * 1024L).
Now that we are needing more and more shared memory, we're seeing random
performance issues. With 16MB, 64MB and 256MB (in recent past) all was
good. But now, trying to allocate 1GB of shared memory, we see it taking
anywhere from .6 to 9 SEONDS to access the file. No good!
What I'm wondering and needed to do is map a chunk of mymoery (1GB today,
maybe 2GB later on) so that all my apps can access it. Short of creating a
ramdisk and moving the mmap'ed file to ramdisk, what is the best way to do
this???
Thanks,
-brian
next reply other threads:[~2009-09-10 22:38 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-09-10 22:38 Brian McGrew [this message]
2009-09-10 23:16 ` mmap vs. real memory Chris Friesen
2009-09-11 9:25 ` Luciano Rocha
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=C6CECDE3.13A4A%brian@visionpro.com \
--to=brian@visionpro.com \
--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 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.