linux - alloc_pages() is paired by __free_pages() -
I "Linux kernel development read" book, and finds some functions that let me confused, as mentioned is:
struct page * alloc_pages (gfp_t gfp_mask, unsigned int order) zero __free_pages (struct page * page, unsigned int order) unsigned long __get_free_pages (gfp_t gfp_mask, unsigned int order) zero Mukt_prisht ( Unsigned long-term, unsigned int order)
Education is the function used for the two outlined in name and function how to add. 1. What happens when the Linux kernel draws two under its function name? 2. Why alloc_pages have been linked with __free_pages, but not free_pages?
As you may notice are:
alloc_pages () / __free_pages ( ) takes as an argument "page *" (page Disiptr) they want to manipulate some general kernel is used internally by the code, such as page fault handler, the page descriptor rather than the memory block content. The
Assign Using __ takes get_free_pages () / free_pages () can be used by the access code as the virtual address) argues "unsigned long" (memory block that memory block Afterwards, you can read / write this memory block.
Their name and double underscore "__", you do not have to worry too much. Sometimes the kernel functions were named carelessly without paying too much attention, when they were written for the first time. And that the name is not appropriate when people think, but these functions are already used wildly in the kernel, and are too lazy to just change people's colonel.
Comments
Post a Comment