Re: pmd_offset vs pmd_alloc

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 14 Jul 2004, Cristina Rivera wrote:

> I'm coding a syscall that requests pages to the operating system, and,
> searching for macros to use I've found these two that are very similar. I've
> read what is doing each one of the two but I really don't find them very
> different.

pmd_offset() searches for offset in 2nd level pagetable (and is called by 
pmd_alloc()), on the other hand pmd_alloc() first allocates space for 
middle directory and then returns, using pmd_offset(), the offset in the 
pagetable directory, for the particular address.

> Another doubt, I need to find at what vma belongs a given address, having
> known the address and the mm descriptor with (current->mm). I've read about
> find_vma( ) and  that there's a possibility of obtaining a vma that doesn't
> include address because this function searches the first vma that has vm_end
> field greater than address.  How can I be sure that the vma that I'm getting
> is really the vma that I'm searching for?

You can look at fields vm_start and vm_end of acutal vm_area_struct.  
However, I can see only two possibilities when you, using find_vma(), find
vma which doesn't contain the specified address

- the address is not present in any vma (which really is worth checking)
- you have overlapping vmas, which is bug

-- 
JiKos.

--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux