looking for help with details of mapping pages to kernel and userspace
From: Chris Friesen
Date: Tue Sep 07 2004 - 12:52:03 EST
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
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/