when to mark reserved low memory pages

Linda Xie lxie at us.ibm.com
Tue Sep 28 15:50:27 EST 2004





Below is an experimental patch I made  to mark the RTAS pages as
PG_reserved.  Any comments/suggestions/corrections
appreciated.

Thanks,

Linda


diff -purN linux-2.6.8/arch/ppc64/kernel/prom.c
linux-2.6.8-linda/arch/ppc64/kernel/prom.c
--- linux-2.6.8/arch/ppc64/kernel/prom.c  1970-05-10 00:19:10.198944464
-0400
+++ linux-2.6.8-linda/arch/ppc64/kernel/prom.c  1970-05-10
00:20:02.905919168 -0400
@@ -15,7 +15,7 @@
  *      2 of the License, or (at your option) any later version.
  */

-#undef DEBUG_PROM
+#define DEBUG_PROM

 #include <stdarg.h>
 #include <linux/config.h>
@@ -646,6 +646,7 @@ static void __init prom_initialize_lmb(v
 static void __init
 prom_instantiate_rtas(void)
 {
+     unsigned long addr;
      unsigned long offset = reloc_offset();
      struct prom_t *_prom = PTRRELOC(&prom);
      struct rtas_t *_rtas = PTRRELOC(&rtas);
@@ -699,6 +700,15 @@ prom_instantiate_rtas(void)
                  RELOC(rtas_rmo_buf)
                        = lmb_alloc_base(RTAS_RMOBUF_MAX, PAGE_SIZE,
                                          rtas_region);
+                 prom_printf("%s: Mark rtas_rmo_buf as PG_reserved,
b=0x%x, e=0x%x\n",
+                       __FUNCTION__, rtas_rmo_buf, rtas_rmo_buf +
RTAS_RMOBUF_MAX);
+                 for (addr = (unsigned long)__va(rtas_rmo_buf);
+                       addr < PAGE_ALIGN((unsigned long)__va(rtas_rmo_buf)
+ RTAS_RMOBUF_MAX);
+                       addr += PAGE_SIZE) {
+                             SetPageReserved(virt_to_page(addr));
+                 }
+                 prom_printf("%s: Mark rtas_rmo_buf as PG_reserved,
b=0x%x, e=0x%x done!\n",
+                       __FUNCTION__, rtas_rmo_buf, rtas_rmo_buf +
RTAS_RMOBUF_MAX);
            }

            if (_rtas->entry <= 0) {



                                                                                                                                       
                      John Rose                                                                                                        
                      <johnrose at austin.        To:       Benjamin Herrenschmidt <benh at kernel.crashing.org>                             
                      ibm.com>                 cc:       External List <linuxppc64-dev at ozlabs.org>, Linda Xie/Austin/IBM at IBMUS         
                                               Subject:  Re: when to mark reserved low memory pages                                    
                      09/27/2004 05:34                                                                                                 
                      PM                                                                                                               
                                                                                                                                       




Hi Linda-

You might consider posting your patch to the external list, in response
to ben's note here, like you did in the bug text.  I haven't had much
luck getting responses from Paul or Anton lately :(

Just a thought..

Thanks-
John


On Mon, 2004-09-27 at 17:27, Benjamin Herrenschmidt wrote:
> On Tue, 2004-09-28 at 01:11, John Rose wrote:
> > On Fri, 2004-09-24 at 21:15, Benjamin Herrenschmidt wrote:
> > > Why ? because they get freed when you mmap them and later quit the
> > > userland process ? In this case, the option of marking them reserved
> > > might lead to an ever increasing page count (or not), make very sure
> > > of that, as get_page() will increase count but free_page() will not
> > > decrease it for a reserved page.
> >
> > Ok retry :)  If you were in a hypothetical situation where page count
> > wasn't the issue, and you specifically needed the pages marked
reserved,
> > where would you do it?
>
> Some time right after mem_init() I suppose...
>
> > And how to handle the discontig case?
>
> Not too sure
>
> Ben.
>
>
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://ozlabs.org/pipermail/linuxppc64-dev/attachments/20040928/76d22c50/attachment.htm 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: graycol.gif
Type: image/gif
Size: 105 bytes
Desc: not available
Url : http://ozlabs.org/pipermail/linuxppc64-dev/attachments/20040928/76d22c50/attachment.gif 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ecblank.gif
Type: image/gif
Size: 45 bytes
Desc: not available
Url : http://ozlabs.org/pipermail/linuxppc64-dev/attachments/20040928/76d22c50/attachment-0001.gif 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pic09202.gif
Type: image/gif
Size: 1255 bytes
Desc: not available
Url : http://ozlabs.org/pipermail/linuxppc64-dev/attachments/20040928/76d22c50/attachment-0002.gif 


More information about the Linuxppc64-dev mailing list