Re: Copy data from kernel to user space memory

From: Andrey Simonenko (simon_at_comsys.ntu-kpi.kiev.ua)
Date: 09/23/04

  • Next message: Niels Heinen: "Re: Copy data from kernel to user space memory"
    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"


  • Next message: Niels Heinen: "Re: Copy data from kernel to user space memory"

    Relevant Pages

    • Re: Framework 2.0 array redim unsatisfactory performance
      ... implementation details of Redim, Redim Preserve, and List. ... significantly higher object allocated overhead then List. ... ReDim simply allocates a new ... but I do not even attempt to test its memory ...
      (microsoft.public.dotnet.languages.vb)
    • Re: CE6.0 Driver Pointer Marshalling - passing pointers out only?
      ... This is an array of pointers to buffers that get set up ... the driver allocates the buffers (via an internal allocation ... routine from its own block of reserved memory). ... So I can map ...
      (microsoft.public.windowsce.platbuilder)
    • Re: CE6.0 Driver Pointer Marshalling - passing pointers out only?
      ... I've got a pretty complex driver I'm porting up at the moment ... This is an array of pointers to buffers that get set up ... the driver allocates the buffers (via an internal allocation ... routine from its own block of reserved memory). ...
      (microsoft.public.windowsce.platbuilder)
    • Re : Re : memory allocation and freeing memory
      ... This means that the caller ... >> never frees memory, and the callee always frees all its ... then the caller allocates it and pass it ... > void ExprDestroy(Expr *expr) { ...
      (comp.lang.c)
    • Re: simplest dynamic memory manager / allocator
      ... You might find that 4tH doesn't reserve much memory for dynamic ... memory is allocated at the heap, ... 768 allocates 64 bytes. ... Every fragment is represented by a cell in the HAT. ...
      (comp.lang.forth)