You are in a twisty maze of passages. They all look alike. memcpy() Macro defined in which evaluates whether or not the amount of data to be copied is a constant, and branches to relevant function of __constant_memcpy or __memcpy (or if 3dnow, __constant_memcpy3d or __memcpy3d) __constant_memcpy3d() Sends copies < 512 bytes to __constant_memcpy others to _mmx_memcpy __memcpy3d() Sends copies < 512 bytes to __memcpy others to _mmx_memcpy __constant_memcpy() Uses a switch statement to choose fastest method to copy 0/1/2/3/4/6/8/12/16/20 bytes, uses rep movsl & movsw/movsb to copy the rest. __memcpy() rep movsl copier, with movsw & movsb to do the remainders. ---------------------------------------- _mmx_memcpy() Falls back to __memcpy if we're in an interrupt Uses prefetching, and movq to copy 64 byte chunks Tail copied with __memcpy fast_copy_page() K7 Uses prefetch, movq, and movntq to copy 4096 bytes (in two chunks, first 0->3775, then 3776->4096) This is done in two chunks as athlon prefetch can overshoot, and go past the memory area being copied. Non-K7 Uses prefetch & movq to copy 64 bytes at a time slow_copy_page() Copies mem with rep movsl mmx_copy_page() Calls slow_copy_page() if we're in an interrupt, fast_copy_page otherwise. ---------------------------------------- copy_to_user if argument is a constant, call __constant_copy_to_user otherwise, __generic_copy_to_user __copy_to_user if argument is a constant, call __constant_copy_to_user_nocheck otherwise, __generic_copy_to_user_nocheck (see also copy_from_user and __copy_from_user) __generic_copy_to_user_nocheck calls __copy_user __constant_copy_to_user prefetch, checks access, calls __constant_copy_user() __constant_copy_user rep mov based chunk copier __copy_user() rep mov based macro. ---------------------- __generic_copy_to_user does access_ok check, if mmx capable uses __copy_user() when size < 512bytes and mmx_copy_user when > 512bytes. Non-mmx version uses prefetch(), and __copy_user() < 512. __generic_copy_from_user does access_ok check, if mmx capable uses __copy_user_zeroing() when size < 512bytes and mmx_copy_user_zeroing when > 512bytes. Non-mmx version uses prefetchw(), and memset ---------------------- Notes: - prefetch() is problematic (See the workaround in fast_copy_page)