Re: kmap query

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

 



Hi Fawad,

My understanding differs from you. See my responses
inline.

--- Fawad Lateef <fawadlateef@xxxxxxxxx> wrote:

> On 9/6/05, sanjay kumar <tousanjay@xxxxxxxxxxx>
> wrote:
> 
> > I am writing a kernel module in which i am
> allocating
> > pages using "alloc_pages(mask,order)" interface.
> > This interface return a pointer to the first
> page's
> > page structure.
> > 
> 
> > Now to access the page data, i have to get the
> virtual
> > address of the page using "kmap" (page can be in
> high
> > mem zone).
> 
> The page pointer returned by the alloc_pages will
> already be mapped on
> to the lower memory (ZONE_NORMAL)
> 

No its not the case. Only if allocated pages comes
from normal zone,they are already mapped (what we call
direct mapping). This is not true for pages allocated
from High memory zone.

> > 
> > My query is if i pass an order>0 to alloc_pages,
> do i
> > need to "kmap" all the pages individually or
> mapping
> > only the first page will map other pages also.
> > 
> 
> AFAIK, No need to map the pages, they are already
> mapped if in highmemory ..... 

Pages are not already mapped if in high memory, they
need to be explicitly mapped using "kmap" or
"kmap_atomic" to get their virutal addresses. 
Here in my module, pages can come from normal zone or
high memory zone (I have passed GFP_HIGHUSER to
alloc_pages())and so I need to explicitly kmap them.

Sanjay

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



	

	
		
__________________________________________________________ 
Yahoo! India Matrimony: Find your partner online. Go to http://yahoo.shaadi.com

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