I’ve been diving into the overhead of copy_from_user
and copy_to_user
, but I’m having a hard time getting a clear understanding of how much more expensive they are compared to a simple memcpy
.
I’ve gone through the Linux documentation, but I got a bit lost. From what I gather, these functions involve some additional handling, but I’m curious to know the exact overhead involved when compared to memcpy
.
On a related note, I have a question about performance trade-offs when using copy_from_user
:
Is it better to perform a single large copy_from_user
for a large chunk of data (say, 1000 pages), or is it more/less/same efficiency to perform multiple smaller calls (say, 200 calls, each with 5 pages) for presumably non-contiguous data, leaving cache misses and prefetching aside?
While I suspect the single call would not be slower, I’m wondering if it will be significantly faster, or if the performance difference would be negligible.