Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 23 Feb 2003 02:17:23 -0800
From:      Terry Lambert <tlambert2@mindspring.com>
To:        Christoph Hellwig <hch@infradead.org>
Cc:        Byunghyun Oh <octphial@postech.ac.kr>, freebsd-hackers@freebsd.org
Subject:   Re: Replacement for get_user_pages() of Linux
Message-ID:  <3E589FB3.46C1AAB2@mindspring.com>
References:  <20030223163746.A19421@shell.postech.ac.kr> <3E588B1B.484C4D61@mindspring.com> <20030223094958.A15347@infradead.org>

next in thread | previous in thread | raw e-mail | index | archive | help
Christoph Hellwig wrote:
> On Sun, Feb 23, 2003 at 12:49:31AM -0800, Terry Lambert wrote:
> > I've been unable to find any documentation on get_user_pages(),
> > and you didn't provide a link to any.
> >
> > But looking at the source code, the reason for doing this is to
> > permit DMA directly into user pages.
> >
> > I don't understand what you mean by "pin", in this context.
> 
> get_user_pages() does the following:
> (1) force all pages into physical memory if they weren't before
> (2) increment the usage count on the to avoid paging them out
> 
> The latter is usually called page pinning.

OK, you mean "make non-pageable".

The question, I guess, is "why?".  Are you trying to do a delayed
operation that will complete when the process has otherwise been
swapped out?

Is this something that's going to be initiated by the process itself,
or does it have to work on a process that is not the current process
(e.g. P1 sets up the operation to happen to pages in P2, vs. P1 sets
up the operation to happen to pages in P1, and P2 sets up the operation
to happen to pages in P2)?

In other words, are you trying to pin pages that have resident mappings
at the time you want pin them, or are you trying to pin pages that may
not have resident mappings at the time you want to pin them?


> > You are aware that FreeBSD has a unified VM and buffer cache, and
> > all user pages for the current process are automatically visible
> > in th kernel address space, with no need to call something like
> > get_user_pages() to establish a mapping, right?
> 
> get_user_pages() does not establish a mapping, in Linux you don't need
> a kernel mapping to perform DMA on memory.

In FreeBSD, you generally do.  First off, the VM and buffer cache is
unified.  That means that's there's no such thing as a buffer that
exists seperately from the VM system.

Second off, you aren't really telling us who is doing the DMA; if it's
something for which there's an existing device driver, like a disk or
whatever, then that's the way it is.

Thirdly, when you do demand paged I/O, you always do it into a mapped
page, which is then COW mapped into the process (e.g. via mmap(), or
mapped directly because it's a page in a process).  In other words,
there's no such thing as an uncached page.

Mabe it would be useful for you to tell us what problem you were
trying to solve; I'm sure if you were to do that, then you would
get a lot of suggestions of how to go about solving it.

-- Terry

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3E589FB3.46C1AAB2>