<html><body>
<p>Below is an experimental patch I made  to mark the RTAS pages as PG_reserved.  Any comments/suggestions/corrections <br>
appreciated.<br>
<br>
Thanks,<br>
<br>
Linda<br>
<br>
<br>
<font face="Courier New">diff -purN linux-2.6.8/arch/ppc64/kernel/prom.c linux-2.6.8-linda/arch/ppc64/kernel/prom.c</font><br>
<font face="Courier New">--- linux-2.6.8/arch/ppc64/kernel/prom.c        1970-05-10 00:19:10.198944464 -0400</font><br>
<font face="Courier New">+++ linux-2.6.8-linda/arch/ppc64/kernel/prom.c        1970-05-10 00:20:02.905919168 -0400</font><br>
<font face="Courier New">@@ -15,7 +15,7 @@</font><br>
<font face="Courier New">  *      2 of the License, or (at your option) any later version.</font><br>
<font face="Courier New">  */</font><br>
<font face="Courier New"> </font><br>
<font face="Courier New">-#undef DEBUG_PROM</font><br>
<font face="Courier New">+#define DEBUG_PROM</font><br>
<font face="Courier New"> </font><br>
<font face="Courier New"> #include &lt;stdarg.h&gt;</font><br>
<font face="Courier New"> #include &lt;linux/config.h&gt;</font><br>
<font face="Courier New">@@ -646,6 +646,7 @@ static void __init prom_initialize_lmb(v</font><br>
<font face="Courier New"> static void __init</font><br>
<font face="Courier New"> prom_instantiate_rtas(void)</font><br>
<font face="Courier New"> {</font><br>
<font face="Courier New">+        unsigned long addr;</font><br>
<font face="Courier New">         unsigned long offset = reloc_offset();</font><br>
<font face="Courier New">         struct prom_t *_prom = PTRRELOC(&amp;prom);</font><br>
<font face="Courier New">         struct rtas_t *_rtas = PTRRELOC(&amp;rtas);</font><br>
<font face="Courier New">@@ -699,6 +700,15 @@ prom_instantiate_rtas(void)</font><br>
<font face="Courier New">                         RELOC(rtas_rmo_buf)</font><br>
<font face="Courier New">                                 = lmb_alloc_base(RTAS_RMOBUF_MAX, PAGE_SIZE,</font><br>
<font face="Courier New">                                                         rtas_region);</font><br>
<font face="Courier New">+                        prom_printf(&quot;%s: Mark rtas_rmo_buf as PG_reserved, b=0x%x, e=0x%x\n&quot;,</font><br>
<font face="Courier New">+                                __FUNCTION__, rtas_rmo_buf, rtas_rmo_buf + RTAS_RMOBUF_MAX);</font><br>
<font face="Courier New">+                        for (addr = (unsigned long)__va(rtas_rmo_buf); </font><br>
<font face="Courier New">+                                addr &lt; PAGE_ALIGN((unsigned long)__va(rtas_rmo_buf) + RTAS_RMOBUF_MAX);</font><br>
<font face="Courier New">+                                addr += PAGE_SIZE) {</font><br>
<font face="Courier New">+                                        SetPageReserved(virt_to_page(addr));</font><br>
<font face="Courier New">+                        }</font><br>
<font face="Courier New">+                        prom_printf(&quot;%s: Mark rtas_rmo_buf as PG_reserved, b=0x%x, e=0x%x done!\n&quot;,</font><br>
<font face="Courier New">+                                __FUNCTION__, rtas_rmo_buf, rtas_rmo_buf + RTAS_RMOBUF_MAX);</font><br>
<font face="Courier New">                 }</font><br>
<font face="Courier New"> </font><br>
<font face="Courier New">                 if (_rtas-&gt;entry &lt;= 0) {</font><br>
<br>
<img src="cid:10__=08BBE58EDF8979818f9e8a93df938@us.ibm.com" width="16" height="16" alt="Inactive hide details for John Rose &lt;johnrose@austin.ibm.com&gt;">John Rose &lt;johnrose@austin.ibm.com&gt;<br>
<br>
<br>

<table V5DOTBL=true width="100%" border="0" cellspacing="0" cellpadding="0">
<tr valign="top"><td width="1%"><img src="cid:20__=08BBE58EDF8979818f9e8a93df938@us.ibm.com" border="0" height="1" width="72" alt=""><br>
</td><td style="background-image:url(cid:30__=08BBE58EDF8979818f9e8a93df938@us.ibm.com); background-repeat: no-repeat; " width="1%"><img src="cid:20__=08BBE58EDF8979818f9e8a93df938@us.ibm.com" border="0" height="1" width="225" alt=""><br>

<ul>
<ul>
<ul>
<ul><b><font size="2">John Rose &lt;johnrose@austin.ibm.com&gt;</font></b>
<p><font size="2">09/27/2004 05:34 PM</font></ul>
</ul>
</ul>
</ul>
</td><td width="100%"><img src="cid:20__=08BBE58EDF8979818f9e8a93df938@us.ibm.com" border="0" height="1" width="1" alt=""><br>
<font size="1" face="Arial">        </font><br>
<font size="2">        To:        </font><font size="2">Benjamin Herrenschmidt &lt;benh@kernel.crashing.org&gt;</font><br>
<font size="2">        cc:        </font><font size="2">External List &lt;linuxppc64-dev@ozlabs.org&gt;, Linda Xie/Austin/IBM@IBMUS</font><br>
<font size="2">        Subject:        </font><font size="2">Re: when to mark reserved low memory pages</font></td></tr>
</table>
<br>
<br>
<tt>Hi Linda-<br>
<br>
You might consider posting your patch to the external list, in response<br>
to ben's note here, like you did in the bug text. &nbsp;I haven't had much<br>
luck getting responses from Paul or Anton lately :(<br>
<br>
Just a thought..<br>
<br>
Thanks-<br>
John<br>
<br>
<br>
On Mon, 2004-09-27 at 17:27, Benjamin Herrenschmidt wrote:<br>
&gt; On Tue, 2004-09-28 at 01:11, John Rose wrote:<br>
&gt; &gt; On Fri, 2004-09-24 at 21:15, Benjamin Herrenschmidt wrote:<br>
&gt; &gt; &gt; Why ? because they get freed when you mmap them and later quit the<br>
&gt; &gt; &gt; userland process ? In this case, the option of marking them reserved<br>
&gt; &gt; &gt; might lead to an ever increasing page count (or not), make very sure<br>
&gt; &gt; &gt; of that, as get_page() will increase count but free_page() will not<br>
&gt; &gt; &gt; decrease it for a reserved page.<br>
&gt; &gt; <br>
&gt; &gt; Ok retry :) &nbsp;If you were in a hypothetical situation where page count<br>
&gt; &gt; wasn't the issue, and you specifically needed the pages marked reserved,<br>
&gt; &gt; where would you do it?<br>
&gt; <br>
&gt; Some time right after mem_init() I suppose...<br>
&gt; <br>
&gt; &gt; And how to handle the discontig case?<br>
&gt; <br>
&gt; Not too sure<br>
&gt; <br>
&gt; Ben.<br>
&gt; <br>
&gt; <br>
&gt; <br>
<br>
</tt>

</body></html>