* New demand page function
@ 2003-02-10 17:57 User &
0 siblings, 0 replies; only message in thread
From: User & @ 2003-02-10 17:57 UTC (permalink / raw)
To: linux-kernel
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);
if(!page)
return NOPAGE_OOM;
/*Map alloced page*/
kaddr = (char *)kmap(page);
if(!kaddr)
return;
return page;
}
/*If there aren´t no much pages , try to free some pages*/
else {
i = 0;
do {
i++;
j = 2*2*i;
}while((j > zone->pages_min));
new = pte_page(pte);
if(new) {
if(new->count !=0)
spin_lock(&zone->lock);
__free_pages(new,i);
spin_unlock(&zone->lock);
goto reload;
}
}
thanks
Breno
----------------------
WebMail Bandnet.com.br
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2003-02-10 17:45 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-02-10 17:57 New demand page function User &
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).