Re: use video ram as system ram ?

From: Rick van Rein (vanrein@zonnet.nl)
Date: Wed Apr 05 2000 - 02:36:32 EST


Enrico:

> i've got on RivaTNT (onboard) with 16MB ram and i don't use it all.
> so is there a possibility to use it as system ram or as swap ?

It would be possible in theory to add it to the free_area structures from
which memory gets allocated for general use, by calling __free_page on each
MMU page that you'd like to access from within.

A problem you should solve (perhaps by proper MMU settings? I don't know if the
MMU is active in kernel mode...) is that the newly added memory should be
added behind the address range for `normal' memory, so that the translation
from address to (struct page *) as done in free_pages works. Either that, or
change the translation and risk (1) having to change a lot of code and (2)
cause a drop in system performance.

Interesting code to look at resides in mm/page_alloc.c and reads

void __free_page(struct page *page)
{
        __free_pages(page, 0);
}

void free_pages(unsigned long addr, unsigned long order)
{
        unsigned long map_nr = MAP_NR(addr);

        if (map_nr < max_mapnr)
                __free_pages(mem_map + map_nr, order);
}

Good luck,
 -Rick.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Fri Apr 07 2000 - 21:00:14 EST