Memory Management API: get_zeroed_page, apiget_zeroed_page

Source: Internet
Author: User

Memory Management API: get_zeroed_page, apiget_zeroed_page

Unsigned long get_zeroed_page (gfp_t gfp_mask) is used to apply for a page and its content will be cleared. the source code analysis is as follows: unsigned long get_zeroed_page (gfp_t gfp_mask) {# You can see that a flags ,__ GFP_ZERO is added here. This flag clears the applied page with return _ get_free_pages (gfp_mask | _ GFP_ZERO, 0);} unsigned long _ get_free_pages (gfp_t gfp_mask, unsigned int order) {struct page * page;/** _ get_free_pages () returns a 32-bit address, which cannot represent * a highmem page */# You can see that this function cannot apply for high-end memory VM_BUG_ON (gfp_mask & _ GFP_HIGHMEM )! = 0); # The order here is zero. Apply for a pagepage = alloc_pages (gfp_mask, order); if (! Page) return 0; # convert the page into a virtual address and return it to the user return (unsigned long) page_address (page );}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.