Re: Getting virtual address

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

 



On 20-11-07 18:23, Talib Alim wrote:

To make things clear for me and anybody reading this post (and please confirm).

I should not use
virtual_address = phys_to_virt(page_to_pfn(page) << PAGE_SHIFT);

(I assume this is what you meant by home grown)

Indeed. If you'd need this effect, you'd use page_address(), which is the same as the above for !CONFIG_HIGHMEM kernels and turns into to the above for lowmem pages even on a CONFIG_HIGHMEM kernel.

and should use

virtual_address = kmap_atomic(page, KM_USER0);

and when done, use
kunmap_atomic(virtual_address, KM_USER0);

Either that or somehow arrange that you'll never be passed a highmem page to begin with as highmem pages by their nature of not being permanently mapped do not _have_ a virtual address until after they're mapped.

is KM_USER0 correct ?

Yes, AFAIA that should be correct. And remember -- you can't sleep while holding the page.

Rene.


--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at 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