From: "Martin Frey" <frey@scs.ch>
To: linux-mm@kvack.org
Cc: baettig@scs.ch
Subject: Questions on mmap()
Date: Tue, 23 Jan 2001 14:45:12 -0500 [thread overview]
Message-ID: <000201c08575$01127ab0$10401c10@SCHLEPPDOWN> (raw)
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/
next reply other threads:[~2001-01-23 19:45 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-01-23 19:45 Martin Frey [this message]
2001-01-23 19:56 ` Christoph Hellwig
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='000201c08575$01127ab0$10401c10@SCHLEPPDOWN' \
--to=frey@scs.ch \
--cc=baettig@scs.ch \
--cc=frey@cxau.zko.dec.com \
--cc=linux-mm@kvack.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox