<?xml version="1.0" encoding="ANSI_X3.4-1968" standalone="no"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"><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.75.2" /><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="re178.html" title="get_user_pages" /><link rel="next" href="re180.html" title="vm_insert_pfn" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center"><span>vm_insert_page</span></th></tr><tr><td width="20%" align="left"><a accesskey="p" href="re178.html">Prev</a> </td><th width="60%" align="center">More Memory Management Functions</th><td width="20%" align="right"> <a accesskey="n" href="re180.html">Next</a></td></tr></table><hr /></div><div class="refentry" title="vm_insert_page"><a id="API-vm-insert-page"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>vm_insert_page — insert single page into user vma </p></div><div class="refsynopsisdiv" title="Synopsis"><h2>Synopsis</h2><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" class="funcprototype-table"><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> </td><td>unsigned long <var class="pdparam">addr</var>, </td></tr><tr><td> </td><td>struct page * <var class="pdparam">page</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div></div></div><div class="refsect1" title="Arguments"><a id="id2645553"></a><h2>Arguments</h2><div class="variablelist"><dl><dt><span class="term"><em class="parameter"><code>vma</code></em></span></dt><dd><p> user vma to map to </p></dd><dt><span class="term"><em class="parameter"><code>addr</code></em></span></dt><dd><p> target user address of this page </p></dd><dt><span class="term"><em class="parameter"><code>page</code></em></span></dt><dd><p> source kernel page </p></dd></dl></div></div><div class="refsect1" title="Description"><a id="id2645614"></a><h2>Description</h2><p> This allows drivers to insert individual pages they've allocated into a user vma. </p><p> The page has to be a nice clean _individual_ kernel allocation. If you allocate a compound page, you need to have marked it as such (__GFP_COMP), or manually just split the page up yourself (see <code class="function">split_page</code>). </p><p> NOTE! Traditionally this was done with <span class="quote">“<span class="quote"><code class="function">remap_pfn_range</code></span>”</span> which took an arbitrary page protection parameter. This doesn't allow that. Your vma protection will have to be set up correctly, which means that if you want a shared writable mapping, you'd better ask for a shared writable mapping! </p><p> The page does not need to be reserved. </p></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="re178.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="ch04s03.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="re180.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top"><span>get_user_pages</span> </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> <span>vm_insert_pfn</span></td></tr></table></div></body></html>