From: Eli Cohen <mlxk@mellanox.co.il>
To: linux-kernel@vger.kernel.org
Subject: locking user space memory in kernel
Date: Sun, 21 Mar 2004 13:18:34 +0200 [thread overview]
Message-ID: <405D7A0A.2000408@mellanox.co.il> (raw)
Hi,
I need to be able to lock memory allocated in user space and passed to
my driver, in order to pass it to a dma controller that can maintain a
translation table for each process. The obvious thing is to use
sys_mlock() (and sys_munlock() for unlocking) but this function is not
exported anymore, nore is sys_call_table. I considered marking the
relevant vma->vm_flags with VM_LOCKED and calling get_user_pages but
that could be overkill if I want to lock just a portion of the VMA.
Currently I do some hacking to find the addresses of sys_mlock/sys_munlock.
I also need to maintain a reference count on the locking /unlocking such
that a region that has been locked twice will really be unlocked after
unlocking twice. This needs to support partly overlapping regions. To
cope with this I have implemented some code on top of calls to
sys_mlock/sys_munlock to provide this functionality.
Are there more standard ways to get this functionality from the kernel?
Any help is appreciated.
Thanks
Eli
next reply other threads:[~2004-03-21 11:17 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-03-21 11:18 Eli Cohen [this message]
2004-03-21 11:35 ` Arjan van de Ven
2004-03-21 11:31 Manfred Spraul
2004-03-21 14:12 ` Manfred Spraul
2004-03-21 16:40 ` Roland Dreier
2004-03-21 17:15 ` Manfred Spraul
2004-03-21 18:18 ` Roland Dreier
2004-03-22 13:15 ` Eli Cohen
2004-03-22 15:22 ` Eli Cohen
2004-03-22 19:34 ` Manfred Spraul
2004-04-08 0:45 Libor Michalek
2004-04-08 5:22 ` Manfred Spraul
2004-04-08 6:20 Ross Dickson
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=405D7A0A.2000408@mellanox.co.il \
--to=mlxk@mellanox.co.il \
--cc=linux-kernel@vger.kernel.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
Powered by JetHome