Re: Short question about the mmap method

From: Steffen Persvold (sp@scali.no)
Date: Fri Jan 04 2002 - 21:56:48 EST


Steffen Persvold wrote:
>
> Tommy Reynolds wrote:
> >
> > Uttered "Steffen Persvold" <sp@scali.no>, spoke thus:
> >
> > > Hi lkml readers,
> > >
> > > I have a question regarding drivers implementing the mmap and nopage methods.
> > > In some references I've read that pages in kernel allocated memory (either
> > > allocated with kmalloc, vmalloc or__get_free_pages) should be set to reserved
> > > (mem_map_reserve or set_bit(PG_reserved, page->flags) before they can be
> > > mmap'ed to guarantee that they can't be swapped out. Is this true ?
> >
> > [kv]malloc memory is _never_ subject to paging and can be mmap'ed with a
> > vengeance without resorting to mucking about with marking pages or the like.
> >
> > You're working too hard ;-)
> >

Another thing, when allocating memory with vmalloc, how can I be sure that the pages I get is
adressable within 4GB (i.e I wan't to call pci_map_sg on this buffer for my 32bit PCI device without
having to use bounce buffers ) ? On systems with less that 4GB of physical memory there's no
problem, but what happens if you have more (lets say an IA64 server with 16GB of RAM) and don't have
an IOMMU (like alpha and sparc) ?

I noticed a vmalloc_32 in linux/vmalloc.h (the comment says "32bit PA addressable pages - eg for PCI
32bit devices"), but is that one platform independent (I see that it is only using GFP_KERNEL, while
vmalloc is using GFP_KERNEL | __GFP_HIGHMEM) ? This issue goes for __get_free_pages too I guess.

Regards,

-- 
  Steffen Persvold   | Scalable Linux Systems |   Try out the world's best   
 mailto:sp@scali.no  |  http://www.scali.com  | performing MPI implementation:
Tel: (+47) 2262 8950 |   Olaf Helsets vei 6   |      - ScaMPI 1.12.2 -         
Fax: (+47) 2262 8951 |   N0621 Oslo, NORWAY   | >300MBytes/s and <4uS latency
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Mon Jan 07 2002 - 21:00:27 EST