Mapping kernel memory to user space from within a system call

From: Venetis Ioannis (venetis@ceid.upatras.gr)
Date: Wed Mar 22 2000 - 09:24:24 EST


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/



This archive was generated by hypermail 2b29 : Thu Mar 23 2000 - 21:00:36 EST