1. Vma->vm_pgoff is the offset of the VM area in the page size in map file. /* Offset (within vm_file) in page_size*/
For example, 4 Vm_area map to a file
1) 0-----4096
2) 5*4096------7*4096
3) 9*4096------10*4096
4) 15*4096-----20*4096
So the 4 VMA Vm_pgoff were 0,5,9, 15.
It is not related to the physical page number.
and the physical page number you see is a special case and a coincidence.
2, the Remap_pfn_range function is driven by the call (CD drivers grep-r REMAP_PFN *)
Used to "
All"Physical memory is mapped into
aFile (Driver/mem.c See).
At this point, Vm_pgoff is related to the physical page number. is a special case and a coincidence.
Vm_pgoff's intent is independent of the physical page number.
That's what I'm talking about. (See mm.h Description of a sentence: Offset (within Vm_file) in Page_size)
/* Remap-pfn-range would mark the range Vm_io and vm_reserved * *
if (Remap_pfn_range (VMA,
Vma->vm_start,
Vma->vm_pgoff, Size
Vma->vm_page_prot)) {
Return-eagain;
}
return 0;
}
#ifdef CONFIG_DEVKMEM
static int Mmap_kmem (struct file *file, struct vm_area_struct *vma)
{
unsigned long PFN;
/* Turn a kernel-virtual address into a physical page frame * *
PFN = __pa (u64) vma->vm_pgoff << page_shift) >> page_shift;
/*
* Red-pen:on Some architectures there are more mapped memory
* Available in Mem_map which pfn_valid checks for. Perhaps should add a
* New macro here.
*
* Red-pen:vmalloc is isn't supported right now.
*/
if (!pfn_valid (PFN))
Return-eio;
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