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

Konstantin Belousov kostikbel at
Tue Mar 3 00:25:42 UTC 2015

On Mon, Mar 02, 2015 at 04:17:03PM -0800, Adrian Chadd wrote:
> On 2 March 2015 at 16:12, K. Macy <kmacy at> 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

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.

More information about the freebsd-current mailing list