Re: issue about virt_to_page(addr) macro

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

 



Hi all,

I figured out. The following code helped me to answer my question.

page = alloc_page(GFP_KERNEL);

addr1 = page_address(page);
addr2 = addr1 + (PAGE_SIZE/2);

page = virt_to_page(addr1);
printk(KERN_DEBUG "Page address 1: %lx\n", (unsigned
long)page_address(page));

page = virt_to_page(addr2);
printk(KERN_DEBUG "Page address 2: %lx\n", (unsigned
long)page_address(page));

--- Mauricio Lin <mauriciolin2000@xxxxxxxxxxxx> escreveu:

> Hi all,
> 
> The virt_to_page(addr) macro gives the page descriptor associated
> with
> the linear address "addr".
> 
> Let's assume the initial and final linear address of a certain page
> are
> respectively A and B. If a value x, where A < x < B, is provided as
> the
> argument of virt_to_page() as virt_to_page(x), is the page descriptor
> the same as virt_to_page(A)?

As I have tested the code, the page descriptor is the same in this
case.

> 
> In this case, is there diffence in using virt_to_page(x) or
> virt_to_page(A)?
No difference, since the page descriptor points to the same page.

BR,

Mauricio Lin.


		
_______________________________________________________ 
Yahoo! Copa 2006: cobertura dos jogos em tempo real e tudo sobre a seleção brasileira! 
 
http://br.esportes.yahoo.com/copa2006/

--
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