From: Hugh Dickins <hugh@veritas.com>
To: Timur Tabi <timur.tabi@ammasso.com>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: get_user_pages() and shared memory question
Date: Tue, 21 Jun 2005 19:02:26 +0100 (BST) [thread overview]
Message-ID: <Pine.LNX.4.61.0506211840210.5784@goblin.wat.veritas.com> (raw)
In-Reply-To: <42B82DF2.2050708@ammasso.com>
On Tue, 21 Jun 2005, Timur Tabi wrote:
>
> Is it possible for a page of memory that's been "grabbed" with
> get_user_pages() to ever be allocated to another process? I'm assuming the
> answer is no, but I have a specific case I want to ask about.
>
> Let's say an application allocates some shared memory, and then calls into a
> driver which calls get_user_pages(). The driver exits without releasing the
> pages, so they now have a reference count on them. Then the application
> deallocates the shared memory. At this point, the virtual addresses
> disappear, and no process owns them, but the pages still have a reference
> count.
>
> Another process now tries to allocate a shared memory buffer. Is there any
> way that this new buffer can contain those pages that were grabbed with
> get_user_pages() (i.e. that already have a reference count)?
It depends on what you mean by allocate and deallocate. If the second
process is attaching the same shared memory segment as the first process
had attached, then yes, its buffer will contain those very pages which
the driver erroneously failed to release.
> Until 2.6.7, there was a bug in the VM where a page that was grabbed with
> get_user_pages() could be swapped out. Those of you familar with the OpenIB
> work know what I'm talking about. Would that bug affect anything I'm talking
> about?
No. That was a bug peculiar to anonymous memory,
whereas shared memory is treated like file cache.
Hugh
next prev parent reply other threads:[~2005-06-21 18:01 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-06-21 15:10 Timur Tabi
2005-06-21 17:33 ` Roland Dreier
2005-06-21 18:02 ` Hugh Dickins [this message]
2005-06-21 18:21 ` Timur Tabi
2005-06-21 19:38 ` Hugh Dickins
2005-06-21 19:43 ` Brice Goglin
2005-06-21 19:55 ` Timur Tabi
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=Pine.LNX.4.61.0506211840210.5784@goblin.wat.veritas.com \
--to=hugh@veritas.com \
--cc=linux-kernel@vger.kernel.org \
--cc=timur.tabi@ammasso.com \
/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
all inboxes | Powered by JetHome®