From: "User &" <breno_silva@beta.bandnet.com.br>
To: linux-kernel@vger.kernel.org
Subject: New demand page function
Date: Mon, 10 Feb 2003 14:57:44 -0300 [thread overview]
Message-ID: <20030210175744.M61715@beta.bandnet.com.br> (raw)
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
reply other threads:[~2003-02-10 17:45 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20030210175744.M61715@beta.bandnet.com.br \
--to=breno_silva@beta.bandnet.com.br \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®