* Questions on mmap()
@ 2001-01-23 19:45 Martin Frey
2001-01-23 19:56 ` Christoph Hellwig
0 siblings, 1 reply; 2+ messages in thread
From: Martin Frey @ 2001-01-23 19:45 UTC (permalink / raw)
To: linux-mm; +Cc: baettig
Dear all,
I'm trying to write an example on how to export kmalloc()
and vmalloc() allocated areas from a device driver into
user space. The example is running so far, but I want to
make sure to have all the details right.
So here I have couple of questions:
- for kmalloc, I just call remap_page_range() in my drivers
mmap method. Do I have to grab any locks before doing
so (kernel 2.4.x), e.g. big kernel lock?
- Do I have to set any flags in vm_area_struct->vm_flags?
I see some drivers setting VM_LOCKED while others don't.
As far as I understand the kernel will try to swap the
area out starting in swp_out_mm, calling swp_out_vma.
If VM_LOCKED I will return if VM_LOCKED is set. If not,
I will fall into swap_out_pXX until I finally hit
the reserve bit of the page that should go out.
If I understand the code right, setting VM_LOCKED is
not necessary, I will be safe without. But performancewise
have VM_LOCKED set will make me fall out of the swap-out
attempt earlier. Is this correct?
- To map a vmalloc() allocated area, I set up my own
page fault handler (vm_ops). Again, are any flags
needed in the vm_flags field?
- In my pagefault handler I parse the pagetables as e.g.
done in uvirt_to_kva in the bttv-driver. Do I need
to grab a lock before doing so?
- What is the purpose and usage of the VMALLOC_VMADDR
macro?
Any help is appreciated.
Thanks and best regards,
Martin Frey
--
Supercomputing Systems AG email: frey@scs.ch
Martin Frey web: http://www.scs.ch/~frey/
at Compaq Computer Corporation phone: +1 603 884 4266
ZKO2-3N25, 110 Spit Brook Road, Nashua, NH 03062
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux.eu.org/Linux-MM/
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2001-01-23 19:56 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-01-23 19:45 Questions on mmap() Martin Frey
2001-01-23 19:56 ` Christoph Hellwig
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox