User Tools

Site Tools


mywiki:linux:page_allocation

This is an old revision of the document!


Reference

Address Conversion

page to Virtual address

struct page *page;
unsigned char *p;
p = page_address(page);

Other APIs:

  • kmap_atomic
  • __kunmap_atomic

Linux Page Allocation

Allocate pages

   struct page *page;
   page = alloc_pages(gfp, order);
   

Allocate one page

   struct page *page, *head;
   char *data="aljalf";
     
   /*allocate a page */
   page = alloc_page(gfp_mask);
   if (page) 
      memcpy(page_address(page),  data, strlen(data)+1 );
	
   /*free a page*/
   put_page(page );
   
mywiki/linux/page_allocation.1463623156.txt.gz · Last modified: (external edit)