lkml.org 
[lkml]   [2000]   [Mar]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectMapping kernel memory to user space from within a system call

Hi,

I am currently implementing a user-level threads library. I am adding also
a new system call to the kernel, which will be used by this threads
library. The system call must do the following :

a) Allocate a memory page in the kernel (I do it with
__get_free_page(GFP_KERNEL)).
b) Map this page to the processes address space.
c) Create some more kernel threads (I do this with do_fork() and the
CLONE_VM flag set and on top of these kernel threads I will execute
the user-level threads that my library implements).

The idea is to have a very fast communication path between the kernel and
my library. This path can be used to communicate requirements by the
library to the kernel (how many kernel threads do I need at any given
moment?) and scheduling decissions (preemptions of kernel threads) by the
kernel to the library. By setting the CLONE_VM flag in do_fork() I want
all the kernel threads of the application to be able to have access to
this page. I have made some tests and everything works fine except of the
mapping of that page to the processes address space. I have tried to use
do_mmap() after opening /dev/kmem. I also used
mem_map_reserve(MAP_NR(Pointer returned from __get_free_page())). This
works some times, some times I get oopses and also I think this is not
very elegant. Is there a better way to do the mapping (through the page
tables perhaps)? I also want that this page will never be swapped out, for
performance reasons.

Any help, links, comments and suggestions are appreciated.

Ioannis Venetis


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:57    [W:0.035 / U:0.064 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site