Shared Memory copy is slow

John Paul Kannampilly 1 Reputation point
2022-01-17T16:24:09.87+00:00

Memory is created on Kernal space using MmAllocatePagesForMdl() in Kernel driver. It is mapped to user space using MmMapLockedPagesSpecifyCache and shared with process in user space using custom IOCTL enums via DeviceIoControl calls. Memcpy from this mapped memory to another memory location in User space is taking ~20 milliseconds for 190Kb. Copy of same memory allocated in user space is taking 0 millisecond.

Is there a way to speed-up the copy operation?

Windows Hardware Performance
Windows Hardware Performance
Windows: A family of Microsoft operating systems that run across personal computers, tablets, laptops, phones, internet of things devices, self-contained mixed reality headsets, large collaboration screens, and other devices.Hardware Performance: Delivering / providing hardware or hardware systems or adjusting / adapting hardware or hardware systems.
1,613 questions
{count} votes

1 answer

Sort by: Most helpful
  1. John Paul Kannampilly 1 Reputation point
    2022-03-17T08:14:30.353+00:00

    Caching of Kernel memory improves speed of copy from Kernel to User space memory. Caching is enabled while creating Kernel memory in driver. MmAllocatePagesForMdlEx is used with caching option - MmCached; instead of MmAllocatePagesForMdl

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.