memcpy_toio on i386 using byte writes even when n%2==0
A message that is not in the archive (sent off-list or not yet received): [email protected]
A message that is not in the archive (sent off-list or not yet received): [email protected]
A message that is not in the archive (sent off-list or not yet received): [email protected]
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 20 lines · linux-os (Dick Johnson)
If byte writes are used, they should always be last for any odd byte. I think you found a bug in spite of the fact that whoever made the revision to memcpy probably thinks they did something 'cool'. This is an example of cute code causing problems. The classic example of a proper
memcpy()that uses the ix86 built-in macros runs like this:(quoted diff) +0
-0pushl %esi # Save precious registers pushl %edi movl COUNT(%esp),%ecx movl SOURCE(%esp),%esi movl DEST(%esp),%edi cld shrl $1,%ecx # Make WORDS, possibly set carry rep movsw # Copy the words adcl %ecx,%ecx # Any spare byte rep movsb # Copy any spare byte popl %edi # Restore precious registers popl %esi
Quoted 2 lines
Note that there isn't any code for moving dwords because the chances of gaining anything are slim (alignment may hurt).
I'd say the chances of gaining something from executing half as many instructions on copying a large block of memory are very good indeed..
Signature · 3 lines
Robert Hancock Saskatoon, SK, Canada To email, remove "nospam" from [email protected] Home Page: http://www.roberthancock.com/
Followup to: <[email protected]> By author: Robert Hancock <[email protected]> In newsgroup: linux.dev.kernel
Quoted 7 lines
Quoted 3 lines
Note that there isn't any code for moving dwords because the chances of gaining anything are slim (alignment may hurt).
I'd say the chances of gaining something from executing half as many instructions on copying a large block of memory are very good indeed..
For something that generates I/O transactions, it's imperative to generate the smallest possible number of transactions. Furthermore, smaller than dword transactions aren't burstable, except at the beginning and end of a burst.
-hpa