Hi all,
Latest linux scsi subsystem still tries to allocate huge physically
contiguous memory chunk. I know that large buffers are needed for devices
as CD-R, scanners and friends, since Linus^Hx does not allow to DMA from
userland. However, allocating large physically contiguous buffers should
_never_ have been the solution, because it is only guaranteed to succeed
at system start-up and it is wasting memory to pool huge buffers when they
are not used.
I have attached to this mail some _simple_ code that handles large buffers
as a scatterlist and that, for now, is just tested against trivial bugs
from userland. You may want to look into it and let me know if you think
that it is worth to continue this work by making the sg driver, the mt
driver and the SCSI_IOCTL_SEND_COMMAND rely on it.
Basically, the needed big buffers could be allocated at open() or on the
first IO after open() and freed on close(). For low-level drivers that
handle large scatterlists, only 1 PAGE allocations will be performed at a
time using the GFP_KERNEL priority that doesn't not require to be atomic.
(and obviously outside the nasty io_request lock)
The gain will be:
1 - guarantee to succeed for 'the 1 PAGE at a time' case, unless the
kernel is completely screwed-up.
2 - no memory wasting since no big buffers are allocated for devices that
are not open.
Regards,
G�rard.
simple scattered buffer management