Re: Question about memcpy

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Jul 10, 2018 at 10:51:34PM +0800, bing zhu wrote:
> 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.

Ok, and that is due to the fact that the kernel thread does not get
scheduled, unlike your userspace program.  So this means the kernel is
working as designed :)

greg k-h

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@xxxxxxxxxxxxxxxxx
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies



[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]

  Powered by Linux