damingzi
damingzi

Reputation: 716

performance of copy_from_user / copy_to_user when process and kernel is busy

Is it possible the performance of copy_from_user() and copy_to_user() really gets bad when the process is busy doing something or the kernel is heavy loaded? How is the performance for copy_from/to_user in regular circumstances, several microseconds for copying several hundred bytes? Is it possible it take several milliseconds to do so when system is busy?

If comparing copy_from_user with memcpy, how much faster memcpy will be since it doesn't have the sanity check and lockups?

thanks!

Upvotes: 0

Views: 1265

Answers (1)

user4822941
user4822941

Reputation:

You mean lookups, not lockups?

Said primitives don't do much more than memcpy does and you are going to measure any "savings" by switching to mere memcpy (which you should not do), you are already doing something wrong.

copy_to_user/whatever in the common case does not do almost anything more than memcpy. The one case where they end up being expensive is taking a page fault when accessing userspace buffers. But if this primitive happens to take one, memcpy would also have to do it - the data is not in ram after all (or it has to be unshared, whatever).

Tl;dr your question is very fishy and switching to memcpy cannot possibly help whatever problem you have

What and how did you measure to ask about these primitives?

Upvotes: 1

Related Questions