Memory Management API: vmalloc_user details, apivmalloc_user

Source: Internet
Author: User

Memory Management API: vmalloc_user details, apivmalloc_user

Memory Management API: vmalloc_user details

Void * vmalloc_user (unsigned long size) is used to apply for memory of a virtual address for user space. Generally, this virtual memory is in the current process space, so a flag of VM_USERMAP is added to it. Prevent kernelspace data from being exposed to user space. the source code analysis is as follows: void * vmalloc_user (unsigned long size) {void * ret; # first, apply for a virtual memory ret = _ vmalloc (size, GFP_KERNEL | _ GFP_ZERO, PAGE_KERNEL); if (ret) {struct vm_area_struct * vma; down_write (random t-> mm-> mmap_sem ); # search for this virtual space in the current process space. Generally, you can find it, or use VM_USERMAPvma = find_vma (current-> mm, (unsigned long) ret ); if (vma) vma-> vm_flags | = VM_USERMAP; up_write (volume t-> mm-> mmap_sem);} # returns the virtual address. if r fails, returns nullreturn ret ;}

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.