I am doing a project related to thread scheduling. This project needs
communication between kernel and user-level applications. Basically, the
user-level application sets or unset a bit in a bit vector, according to the
application''s status (this part is not related to this question, so I
skip
it). Then the kernel reads the bit vector everytime it schedules a thread.
My question is where to allocate the bit vector.
1. If I allocate the bit vector in user-level, then everytime the kernel
wants to read the bit vector, I has to do a copy_from_user(). I tried this
solution, this incurs a lot of overhead and also crash the os. Since the
copy_from_user() needs to look up the virtual address which corresponds to
the starting address of bit-vector, it will cause paging in the middle of
scheduling. Is there any other way that the kernel can directly access
user-level space without doing copying and address translation?
2. If I allocate the bit vector directly in the kernel space. How can I do
this? Is it possible to create an extra system call that allows user-level
program to allocate a kernel buffer?
Could anyone help me out on this? Thanks!
--
Addr: 1025N, 23rd str, APT 33,
Lincoln, NE, 68503
Phone: (402)310-9826
WWW: cse.unl.edu/~fxian
On Thu, Dec 06, 2007 at 03:06:54PM -0600, Feng Xian wrote: > I am doing a project related to thread scheduling. This project needs > communication between kernel and user-level applications. Basically, the > user-level application sets or unset a bit in a bit vector, according to the > application''s status (this part is not related to this question, so I skip > it). Then the kernel reads the bit vector everytime it schedules a thread. > My question is where to allocate the bit vector. > 1. If I allocate the bit vector in user-level, then everytime the kernel > wants to read the bit vector, I has to do a copy_from_user(). I tried this > solution, this incurs a lot of overhead and also crash the os. Since the > copy_from_user() needs to look up the virtual address which corresponds to > the starting address of bit-vector, it will cause paging in the middle of > scheduling. Is there any other way that the kernel can directly access > user-level space without doing copying and address translation? > > 2. If I allocate the bit vector directly in the kernel space. How can I do > this? Is it possible to create an extra system call that allows user-level > program to allocate a kernel buffer? > > Could anyone help me out on this? Thanks! Try the kernelnewbies list at http://kernelnewbies.org/ML or linux-kernel@vger.kernel.org. Your problem isn''t related specifically to the Fedora kernel, so is off-topic here. Dave -- http://www.codemonkey.org.uk