On Wed, 19 Nov 2003, Jens Axboe wrote:

> On Wed, Nov 19 2003, Kai Makisara wrote:
...
> > As usual, I am against this 512-byte alignment (thinking as st
> > maintainer). Don't default to more strict aligment requirements than is
> > necessary. It creates hidden performance problems for character device
> > drivers.
>
> But you have to honor hardware restrictions, though. Where is the
> performance impact?
>
Yes, I agree that we must not try to do things the hardware does not
allow. On i386, most SCSI adapter accept any alignment. It is a waste to
require 512-byte alignment with these adapters just because USB requires
that. I think there should be a way for the high-level drivers to know
about the absolutely necessary alignment requirements for the actual
adapter being used with a device.

If the user buffer is not aligned according to the required rules, the
driver must copy the data into a temporary buffer for i/o. This consumes
bandwidth and with the current faster tape drives this leads to
significant waste of cpu cycles (according to measurements).

The software using tapes tends to malloc() the buffers and then the
alignment is not guaranteed to 512 byte boundaries. Other Unices don't
have alignment requirements for tape buffers and I think we should avoid
requiring this in Linux if possible.

Someone may think that this is theory. I checked one common low-end backup
program tar (from SuSE 9.0). In the first test (tar cb 64 xxx) the user
buffer address was 0806e508 except in one write it was 08051000. A test
with dd gave the address 0806e508. cpio used the addresses 0806e508 and
08057cd8.

-- 
Kai


-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive?  Does it
help you create better code?  SHARE THE LOVE, and help us help
YOU!  Click Here: http://sourceforge.net/donate/
_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to