1<html><head><meta http-equiv="Content-Type" content="text/html; charset=ANSI_X3.4-1968"><title>vm_insert_page</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="ch04s03.html" title="More Memory Management Functions"><link rel="prev" href="API-zap-vma-ptes.html" title="zap_vma_ptes"><link rel="next" href="API-vm-insert-pfn.html" title="vm_insert_pfn"></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">vm_insert_page</span></th></tr><tr><td width="20%" align="left"><a accesskey="p" href="API-zap-vma-ptes.html">Prev</a>&#160;</td><th width="60%" align="center">More Memory Management Functions</th><td width="20%" align="right">&#160;<a accesskey="n" href="API-vm-insert-pfn.html">Next</a></td></tr></table><hr></div><div class="refentry"><a name="API-vm-insert-page"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>vm_insert_page &#8212; 
2     insert single page into user vma
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">vm_insert_page </b>(</code></td><td>struct vm_area_struct * <var class="pdparam">vma</var>, </td></tr><tr><td>&#160;</td><td>unsigned long <var class="pdparam">addr</var>, </td></tr><tr><td>&#160;</td><td>struct page * <var class="pdparam">page</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer">&#160;</div></div></div><div class="refsect1"><a name="idp1124275804"></a><h2>Arguments</h2><div class="variablelist"><dl class="variablelist"><dt><span class="term"><em class="parameter"><code>vma</code></em></span></dt><dd><p>
4     user vma to map to
5    </p></dd><dt><span class="term"><em class="parameter"><code>addr</code></em></span></dt><dd><p>
6     target user address of this page
7    </p></dd><dt><span class="term"><em class="parameter"><code>page</code></em></span></dt><dd><p>
8     source kernel page
9    </p></dd></dl></div></div><div class="refsect1"><a name="idp1124279460"></a><h2>Description</h2><p>
10   This allows drivers to insert individual pages they've allocated
11   into a user vma.
12   </p><p>
13
14   The page has to be a nice clean _individual_ kernel allocation.
15   If you allocate a compound page, you need to have marked it as
16   such (__GFP_COMP), or manually just split the page up yourself
17   (see <code class="function">split_page</code>).
18   </p><p>
19
20   NOTE! Traditionally this was done with <span class="quote">&#8220;<span class="quote"><code class="function">remap_pfn_range</code></span>&#8221;</span> which
21   took an arbitrary page protection parameter. This doesn't allow
22   that. Your vma protection will have to be set up correctly, which
23   means that if you want a shared writable mapping, you'd better
24   ask for a shared writable mapping!
25   </p><p>
26
27   The page does not need to be reserved.
28   </p><p>
29
30   Usually this function is called from f_op-&gt;<code class="function">mmap</code> handler
31   under mm-&gt;mmap_sem write-lock, so it can change vma-&gt;vm_flags.
32   Caller must set VM_MIXEDMAP on vma if it wants to call this
33   function from other places, for example from page-fault handler.
34</p></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="API-zap-vma-ptes.html">Prev</a>&#160;</td><td width="20%" align="center"><a accesskey="u" href="ch04s03.html">Up</a></td><td width="40%" align="right">&#160;<a accesskey="n" href="API-vm-insert-pfn.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top"><span class="phrase">zap_vma_ptes</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;<span class="phrase">vm_insert_pfn</span></td></tr></table></div></body></html>
35