User Tools

Site Tools


mywiki:linux:page_allocation

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
mywiki:linux:page_allocation [2016/05/18 10:38] – created shaoguohmywiki:linux:page_allocation [2019/09/15 18:55] (current) – external edit 127.0.0.1
Line 1: Line 1:
 | Reference |  | | Reference |  |
  
-Linux Page Allocation 
  
 +====== Address Conversion ======
 +===== page to Virtual address =====
 +<file>
 +struct page *page;
 +unsigned char *p;
 +p = page_address(page);
 +</file>
 +
 +Other APIs:
 +
 +  * kmap_atomic
 +  * __kunmap_atomic
 +====== Linux Page Allocation ======
  
 Allocate pages Allocate pages
Line 8: Line 20:
    struct page *page;    struct page *page;
    page = alloc_pages(gfp, order);    page = alloc_pages(gfp, order);
 +   
 +</file>   
 +
 +
 +Allocate one page
 +<file>
 +   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 );
        
 </file>    </file>   
mywiki/linux/page_allocation.1463539090.txt.gz · Last modified: (external edit)