Re: Doing zero-copy stuff in drivers, or "is vm_fault_quick_hold_pages() enough" ?

From: Konstantin Belousov <kostikbel_at_gmail.com>
Date: Tue, 3 Mar 2015 02:25:36 +0200
On Mon, Mar 02, 2015 at 04:17:03PM -0800, Adrian Chadd wrote:
> On 2 March 2015 at 16:12, K. Macy <kmacy_at_freebsd.org> wrote:
> >>> Right above vm_page_hold():
> >>> /*
> >>>  * Keep page from being freed by the page daemon
> >>>  * much of the same effect as wiring, except much lower
> >>>  * overhead and should be used only for *very* temporary
> >>>  * holding ("wiring").
> >>>  */
> >>
> >> What's the definition of "very temporary holding" ? What's the
> >> behavioural difference?
> >
> > Long enough to complete a DMA operation versus the lifetime of  an
> > executing program.
> 
> Ok, but is there a specific time length that this should be?
Difference between hold and wire is effectively that held pages are
still kept on the page queues, providing potentially uneccessary work
for pagedaemon to find them and skip. Wired pages are removed from the
queues.

This means that holding a page is much cheaper, by the cost of leaving
slightly more work to the system. Also, holding a page only requires the
page lock, while wiring contend on the page queue lock, in addition to
the page lock.

> 
> A DMA operation to a slow device could be up to hundreds of
> milliseconds; or seconds if things are really backed up.
> 
> Using wire instead of hold definitely made things work without having
> the page disappear from underneath it. Oleksander knows more about the
> details of that.

Page cannot 'disappear'. The only thing which could happen with the
memory page is reuse, when the page is removed from the previous object
and re-purposed for some other object, loosing old content.

Your terminology suggests that something unrelated happen.
Received on Mon Mar 02 2015 - 23:25:42 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:40:56 UTC