public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Gilad Ben-Yossef <gilad@benyossef.com>
To: Bhavana Nagendra <Bhavana.Nagendra@3dlabs.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: Alloc and lock down large amounts of memory
Date: 18 Aug 2002 15:09:44 +0300	[thread overview]
Message-ID: <1029672587.12504.88.camel@sake> (raw)
In-Reply-To: <23B25974812ED411B48200D0B774071701248520@exchusa03.intense3d.com>

On Fri, 2002-08-16 at 17:38, Bhavana Nagendra wrote:
> Hi,
> 
> I have a few questions with regards to alloc'ing and locking down memory.
> An example 
> would be very useful.  Please CC me on any responses.
> 
> 1. Is there a mechanism to lock down large amounts of memory (>128M, upto
> 256M).

>From user space? kernel space? The answer is yes to both but the
mechnism is different.

>     Can 256M be allocated using vmalloc, if so is it swappable?

It can be alloacted via vmalloc and AFAIK it is not swappable by
default. This doesn't sound like a very good idea though.

> 2. Is it possible for a user process and kernel to access the same shared
> memory?

Yes. See /proc/kcore for a very obvious example. Also "Linux device
drivers second edition" has many good exmaple on the subject in the
chapter devoted to mmap.

> 3. Can a shared memory have visibility across processes, i.e. can process A
> access 
> memory that was allocated by process B?

Of course. This is the definition of shared memeory...
Just one thing to keep in mind - 'allocating' memory really doesn't do
that much as you might think. Until the memory is *accessed* for the
first time, all you got for the most part are some entries in a table
somwehere...

> 4. When a process exits will it cause a close to occur on the device?

Depends how you got the shared memeory. With mmap() it's yes (for
regular files at least), with shmget/shmat it's no by default. For mmap
of non regulat files (e.g. device files) anything the device file writer
had in mind is the answer.

man shmget, shmat, shmat and finally mmap will help you a lot.

Gilad.

-- 
Gilad Ben-Yossef <gilad@benyossef.com>
Code mangler, senior coffee drinker and VP SIGSEGV
Qlusters ltd.

"You got an EMP device in the server room? That is so cool."
      -- from a hackers-il thread on paranoia




  reply	other threads:[~2002-08-18 12:08 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-08-16 14:38 Alloc and lock down large amounts of memory Bhavana Nagendra
2002-08-18 12:09 ` Gilad Ben-Yossef [this message]
2002-08-18 12:18   ` Alan Cox
2002-08-18 22:45     ` Gilad Ben-Yossef
2002-08-18 12:19   ` Gilad Ben-Yossef
2002-08-19 12:06   ` Bhavana Nagendra
2002-08-20  5:38     ` Gilad Ben-Yossef
  -- strict thread matches above, loose matches on Subject: below --
2002-08-20 14:51 Bhavana Nagendra
2002-08-21  5:27 ` Gilad Ben-Yossef
2002-08-20 20:08 Bhavana Nagendra
2002-08-20 20:47 ` Richard B. Johnson
     [not found] ` <Pine.LNX.3.95.1020820163301.27264A-100000@chaos.analogic.c om>
2002-08-21  4:43   ` Mike Galbraith
2002-08-21  5:29 ` Gilad Ben-Yossef
     [not found] <23B25974812ED411B48200D0B774071701248C6A@exchusa03.intense 3d.com>
2002-08-21  4:31 ` Mike Galbraith
2002-08-21 13:29   ` Roland Kuhn
2002-08-21 14:35     ` Mike Galbraith

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=1029672587.12504.88.camel@sake \
    --to=gilad@benyossef.com \
    --cc=Bhavana.Nagendra@3dlabs.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox