1<html><head><meta http-equiv="Content-Type" content="text/html; charset=ANSI_X3.4-1968"><title>alloc_contig_range</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-set-pfnblock-flags-mask.html" title="set_pfnblock_flags_mask"><link rel="next" href="API-mempool-destroy.html" title="mempool_destroy"></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">alloc_contig_range</span></th></tr><tr><td width="20%" align="left"><a accesskey="p" href="API-set-pfnblock-flags-mask.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-mempool-destroy.html">Next</a></td></tr></table><hr></div><div class="refentry"><a name="API-alloc-contig-range"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>alloc_contig_range &#8212; 
2     - tries to allocate given range of pages
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">alloc_contig_range </b>(</code></td><td>unsigned long <var class="pdparam">start</var>, </td></tr><tr><td>&#160;</td><td>unsigned long <var class="pdparam">end</var>, </td></tr><tr><td>&#160;</td><td>unsigned <var class="pdparam">migratetype</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer">&#160;</div></div></div><div class="refsect1"><a name="idp1124651388"></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     start PFN to allocate
5    </p></dd><dt><span class="term"><em class="parameter"><code>end</code></em></span></dt><dd><p>
6     one-past-the-last PFN to allocate
7    </p></dd><dt><span class="term"><em class="parameter"><code>migratetype</code></em></span></dt><dd><p>
8     migratetype of the underlaying pageblocks (either
9     #MIGRATE_MOVABLE or #MIGRATE_CMA).  All pageblocks
10     in range must have the same migratetype and it must
11     be either of the two.
12    </p></dd></dl></div></div><div class="refsect1"><a name="idp1124655220"></a><h2>Description</h2><p>
13   The PFN range does not have to be pageblock or MAX_ORDER_NR_PAGES
14   aligned, however it's the caller's responsibility to guarantee that
15   we are the only thread that changes migrate type of pageblocks the
16   pages fall in.
17   </p><p>
18
19   The PFN range must belong to a single zone.
20   </p><p>
21
22   Returns zero on success or negative error code.  On success all
23   pages which PFN is in [start, end) are allocated for the caller and
24   need to be freed with <code class="function">free_contig_range</code>.
25</p></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="API-set-pfnblock-flags-mask.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-mempool-destroy.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top"><span class="phrase">set_pfnblock_flags_mask</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">mempool_destroy</span></td></tr></table></div></body></html>
26