Re: Copy data from kernel to user space memory
From: Andrey Simonenko (simon_at_comsys.ntu-kpi.kiev.ua)
Date: 09/23/04
- Previous message: Niels Heinen: "Copy data from kernel to user space memory"
- In reply to: Niels Heinen: "Copy data from kernel to user space memory"
- Next in thread: Niels Heinen: "Re: Copy data from kernel to user space memory"
- Reply: Niels Heinen: "Re: Copy data from kernel to user space memory"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Thu, 23 Sep 2004 13:19:53 +0300 To: Niels Heinen <niels.heinen@gmail.com>
On Thu, Sep 23, 2004 at 11:38:28AM +0200, Niels Heinen wrote:
> The module buffers packets and currently copies it into user memory
> when its system call interface is used. At the moment my user space
> application is the one that allocates the memory. I want the memory
> to be allocated by the module in order to make things more efficient.
>
> I'd really appriciate it if someone could explain how this should be done
You can allocate OBJT_DEFAULT object with desired size, then map it to
the process' vmspace and copy packets from the module to this region
of process' memory, then tell process the start address of the mapped
object and its size. And don't forget to serialize access to the region
of memory.
Read documentation (or relevant sys/vm code) for vm_object_allocate(9),
vm_map_find(9), vm_map_remove(9).
I'm not sure that you get some performance with this method, usually
an application allocates memory, makes syscall and tells how many bytes
the kernel (the module) can store in this memory. But I don't see
the complete picture, so may be you can't use this standard approach.
_______________________________________________
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org"
- Previous message: Niels Heinen: "Copy data from kernel to user space memory"
- In reply to: Niels Heinen: "Copy data from kernel to user space memory"
- Next in thread: Niels Heinen: "Re: Copy data from kernel to user space memory"
- Reply: Niels Heinen: "Re: Copy data from kernel to user space memory"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|