linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Zenek <zenblu@wp.pl>
To: linux-mm@kvack.org
Subject: Re: vmapping user pages - feasible?
Date: Thu, 25 Feb 2010 21:22:42 +0000 (UTC)	[thread overview]
Message-ID: <hm6pn2$rqp$2@dough.gmane.org> (raw)
In-Reply-To: alpine.DEB.2.00.1002251455550.18861@router.home


Thank you for your response,

although I'm not sure I've understood...


On Thu, 25 Feb 2010 14:58:52 -0600, Christoph Lameter wrote:

> On Thu, 25 Feb 2010, Zenek wrote:

>> I will be writing to it using the CPU only, in kernel mode.
>>
> Thats possible already.

What about in the interrupt context?

>> I understand that:
>> - no page pinning is required (as only the CPU will be writing to that
>> area)
> 
> Page pinning is required if the access from the kernel is asynchrononous
> to user space.

Because simultaneous page faults can happen?
 
>> There will be no multithreaded access to that memory.
> 
> The kernel and userspace are not concurrently accessing the memory?

Could we take into account both cases?
1. not concurrently accessing the memory (e.g. ioctl() call, write by 
kernel, return - no more kernel access after return). I can just use the 
user mapping, right? What about page faults?
2. concurrently (e.g. ioctl() call, save the pointer in the kernel, 
return, asynchronous write by kernel). What then? What happens if user 
process calls free() on that area?

>> How should I go about it? Get the user's vm_area_struct, go through all
>> the pages, construct an array of struct *page and vmap it?
> 
> Do a get_user_pages() on the range?

Right... so do a get_user_pages(), pass them to vmap(), and write away... 
if the process messes up the mapping or dies, it's its fault anyway and 
it doesn't get the data, but everything is safe until I call vunmap... 
right?

The pages won't get swapped out until I vunmap, and after that even if 
they do, they data will get swapped and later restored correctly, right?

Thank you again!
Zenek

--
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-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  reply	other threads:[~2010-02-25 21:23 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-25 20:05 vmapping user pages - feasible? Zenek
2010-02-25 20:58 ` Christoph Lameter
2010-02-25 21:22   ` Zenek [this message]
2010-02-25 21:38   ` Zenek

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='hm6pn2$rqp$2@dough.gmane.org' \
    --to=zenblu@wp.pl \
    --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;
as well as URLs for NNTP newsgroup(s).