1<html><head><meta http-equiv="Content-Type" content="text/html; charset=ANSI_X3.4-1968"><title>get_user_pages_fast</title><meta name="generator" content="DocBook XSL Stylesheets V1.78.1"><link rel="home" href="index.html" title="The Linux Kernel API"><link rel="up" href="mm.html#idp1123724580" title="The Slab Cache"><link rel="prev" href="API-memdup-user.html" title="memdup_user"><link rel="next" href="ch04s02.html" title="User Space Memory Access"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center"><span class="phrase">get_user_pages_fast</span></th></tr><tr><td width="20%" align="left"><a accesskey="p" href="API-memdup-user.html">Prev</a>&#160;</td><th width="60%" align="center">The Slab Cache</th><td width="20%" align="right">&#160;<a accesskey="n" href="ch04s02.html">Next</a></td></tr></table><hr></div><div class="refentry"><a name="API-get-user-pages-fast"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>get_user_pages_fast &#8212; 
2     pin user pages in memory
3 </p></div><div class="refsynopsisdiv"><h2>Synopsis</h2><div class="funcsynopsis"><table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr><td><code class="funcdef">int <b class="fsfunc">get_user_pages_fast </b>(</code></td><td>unsigned long <var class="pdparam">start</var>, </td></tr><tr><td>&#160;</td><td>int <var class="pdparam">nr_pages</var>, </td></tr><tr><td>&#160;</td><td>int <var class="pdparam">write</var>, </td></tr><tr><td>&#160;</td><td>struct page ** <var class="pdparam">pages</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer">&#160;</div></div></div><div class="refsect1"><a name="idp1123880812"></a><h2>Arguments</h2><div class="variablelist"><dl class="variablelist"><dt><span class="term"><em class="parameter"><code>start</code></em></span></dt><dd><p>
4     starting user address
5    </p></dd><dt><span class="term"><em class="parameter"><code>nr_pages</code></em></span></dt><dd><p>
6     number of pages from start to pin
7    </p></dd><dt><span class="term"><em class="parameter"><code>write</code></em></span></dt><dd><p>
8     whether pages will be written to
9    </p></dd><dt><span class="term"><em class="parameter"><code>pages</code></em></span></dt><dd><p>
10     array that receives pointers to the pages pinned.
11     Should be at least nr_pages long.
12    </p></dd></dl></div></div><div class="refsect1"><a name="idp1123885588"></a><h2>Description</h2><p>
13   Returns number of pages pinned. This may be fewer than the number
14   requested. If nr_pages is 0 or negative, returns 0. If no pages
15   were pinned, returns -errno.
16   </p><p>
17
18   get_user_pages_fast provides equivalent functionality to get_user_pages,
19   operating on current and current-&gt;mm, with force=0 and vma=NULL. However
20   unlike get_user_pages, it must be called without mmap_sem held.
21   </p><p>
22
23   get_user_pages_fast may take mmap_sem and page table locks, so no
24   assumptions can be made about lack of locking. get_user_pages_fast is to be
25   implemented in a way that is advantageous (vs <code class="function">get_user_pages</code>) when the
26   user memory area is already faulted in and present in ptes. However if the
27   pages have to be faulted in, it may turn out to be slightly slower so
28   callers need to carefully consider what to use. On many architectures,
29   get_user_pages_fast simply falls back to get_user_pages.
30</p></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="API-memdup-user.html">Prev</a>&#160;</td><td width="20%" align="center"><a accesskey="u" href="mm.html#idp1123724580">Up</a></td><td width="40%" align="right">&#160;<a accesskey="n" href="ch04s02.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top"><span class="phrase">memdup_user</span>&#160;</td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top">&#160;User Space Memory Access</td></tr></table></div></body></html>
31