New demand page function

From: User & (
Date: Mon Feb 10 2003 - 12:57:44 EST

Hi , i done one function for demand page.
This do almost the same thing of the others functions , the diffence is in
when do the page allocations.
This still need some tests , but iīd like to know your opinions.

struct page *f_a_page(unsigned int gfp_mask,zone_t *zone,pte_t pte)
 struct page *page;
 struct page *new;
 char *kaddr;
 int i,j;
 /* Teste if there are many pages to alloc and try to alloc just one page*/

reload: if((zone->free_pages >= zone->pages_min)) {
         page = alloc_page(gfp_mask,0);
                         return NOPAGE_OOM;
 /*Map alloced page*/
        kaddr = (char *)kmap(page);

        return page;
 /*If there arenīt no much pages , try to free some pages*/

     else {
        i = 0;
        do {
                 j = 2*2*i;
                }while((j > zone->pages_min));
                new = pte_page(pte);
                if(new) {
                        if(new->count !=0)
                                goto reload;

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

This archive was generated by hypermail 2b29 : Sat Feb 15 2003 - 22:00:29 EST