lkml.org 
[lkml]   [2000]   [Feb]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectKernel virtual addr to Physical page number.
Date
Hello.

Iam trying to see if there is a common method i can obtain physical page
numbers for memory allocated by kmem_alloc,
__get_free_pages() and vmalloc().

vmalloc() seems to follow the same method i use to lock and obtain physical
page numbers for user space addr. This is what i do.

pgd = pgd_offset(current->mm, addr);
pmd = pmd_offset(pgd, addr);
pte = pte_offset(pmd, addr);
phys_addr = pte_page(*pte);
phys_page_num = MAP_NR(phys_addr);


for kernel allocated memory, especially if its from kmem_alloc or
__get_free_pages, iam not able to use the above method. I need to use
__pa(addr)/PAGE_SIZE. Unfortunately if this is from a vmalloc, then
__pa(addr)/PAGE_SIZE does work.

1. Can someone suggest a common method to do this for all addr? both user
and kernel.

2. if not is there a method to distinguish if this is user, or kernel addr?
i thought i can use the PAGE_OFFSET
present in the addr.

3. if 1 and 2 is not possible, then in kernel allocated addr, can we have
some way to find if this is vmalloc() or
the other s(kmem_alloc, or get_free_pages variety)?

thanks
ashokr


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:56    [W:0.080 / U:0.116 seconds]
©2003-2011 Jasper Spaans. Advertise on this site