data transfer from kernel to user space

Amit Nagal helloin.amit at gmail.com
Tue Jul 12 02:56:35 EDT 2011


On Tue, Jul 12, 2011 at 11:51 AM, Tirtha Ghosh <gtirtha at gmail.com> wrote:
> Use a shared memory between user space and kernel space.
> The same physical memory can be translated as user-space virtual address as
> well as kernel space.
> See more about mmap, io_remap_pfn_range etc. and you will get an idea.
> The main advantage with this u can avoid copying data between two spaces but
> disadvantage associated is u need to request  a fixed memory chunk from
> kernel for this purpose.
>
>
Thanx for reply . Regarding mmap usage , As per  LDD3 , page 423 :
"Not every device lends itself to the mmap abstraction; it makes no
sense, for instance, for serial ports and other stream-oriented
devices." .

why mmap is not useful for stream-oriented devices ?
After all even for stream-oriented device (as in my case ) , we need
to copy data from kernel buffer to user-space buffer ,
and if copy can be avoided via any mechanism , it will be much faster  .

Regards
Amit Nagal



More information about the Kernelnewbies mailing list