public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Chris Friesen <cfriesen@nortelnetworks.com>
To: Linux kernel <linux-kernel@vger.kernel.org>
Subject: looking for help with details of mapping pages to kernel and userspace
Date: Tue, 07 Sep 2004 11:47:49 -0400	[thread overview]
Message-ID: <413DD825.9000405@nortelnetworks.com> (raw)

I have a box with 1.5GB of memory and HIGHMEM enabled.

I would like to have a page of memory accessable from userspace, regular kernel 
space, and late asm code on return from exceptions with no valid C context.  As 
far as I can see, this implies that the page tables need to be in lowmem since 
having to do a kmap_atomic in asm would be painful.

It has been suggested that we could do something like the following, where this 
is running on behalf of userspace which passed in a desired mapping address:

mypage =  __get_free_page(GFP_KERNEL);
SetPageReserved(virt_to_page(mypage));
remap_page_range(vma->vm_start, virt_to_phys((void *) mypage), PAGE_SIZE, 
vma->vm_page_prot);

This seems to work, but I'm concerned about cleanup.  When the task dies, how 
much cleanup will be done on the page?  Does the memory subsystem handle 
everything, or do I need to explicitly do something like:

reservedClearPageReserved(virt_to_page(mypage));
free_page(mypage);

Is there a better way of doing this?  I had considered mmap(), but I think that 
could give me pages with their page tables up in high memory.


Thanks,

Chris

                 reply	other threads:[~2004-09-07 17:49 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=413DD825.9000405@nortelnetworks.com \
    --to=cfriesen@nortelnetworks.com \
    --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