Thank you ,I use this func for both kernel and user ,result are same. void *memcpy(void *dest, const void *src, size_t n) { long d0, d1, d2; asm volatile( "rep ; movsq\n\t" "movq %4,%%rcx\n\t" "rep ; movsb\n\t" : "=&c" (d0), "=&D" (d1), "=&S" (d2) : "0" (n >> 3), "g" (n & 7), "1" (dest), "2" (src) : "memory");
return dest; } kernel is indeed faster than user. 2018-07-10 14:22 GMT+08:00 Greg KH <g...@kroah.com>: > On Tue, Jul 10, 2018 at 12:50:21PM +0800, bing zhu wrote: > > I agree !,just i think the problem is still there,memcpy is indeed > faster in > > kernel than in user,i've tried both ways . > > Make sure you are actually using the same code for memcpy in both > places. Do not rely on your libc or the kernel library for such a > thing, otherwise you are not comparing the same code exactly. > > > schedule might be to blame. > > Lots of things "might be to blame", but first off, try to work out > exactly what you are trying to test, and why, and work on that. > > good luck! > > greg k-h >
_______________________________________________ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies