* How to allocate pages for a scatter-gather buffer?
@ 2003-11-09 20:44 Alan Stern
2003-11-09 21:12 ` Jens Axboe
0 siblings, 1 reply; 2+ messages in thread
From: Alan Stern @ 2003-11-09 20:44 UTC (permalink / raw)
To: Jens Axboe; +Cc: linux-kernel
Jens:
Thanks for your help in tracking down that problem with the usb-storage
sddr09 driver.
Now a slightly different question. Suppose I want to allocate some pages
as a scatter-gather buffer for I/O to a device. I've got the device's
dma_mask; what's the right way to convert that to a GFP bitmask for
alloc_pages() or get_free_pages()?
Also, assuming I'll have to use memcpy() to transfer data into or out of
the scatter-gather buffer (so it will have to get a kernel virtual mapping
at some point), am I better off using alloc_pages() followed by
kmap_atomic()/kunmap_atomic() or get_free_pages()? Or even kmalloc()?
Alan Stern
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: How to allocate pages for a scatter-gather buffer?
2003-11-09 20:44 How to allocate pages for a scatter-gather buffer? Alan Stern
@ 2003-11-09 21:12 ` Jens Axboe
0 siblings, 0 replies; 2+ messages in thread
From: Jens Axboe @ 2003-11-09 21:12 UTC (permalink / raw)
To: Alan Stern; +Cc: linux-kernel
On Sun, Nov 09 2003, Alan Stern wrote:
> Jens:
>
> Thanks for your help in tracking down that problem with the usb-storage
> sddr09 driver.
>
> Now a slightly different question. Suppose I want to allocate some pages
> as a scatter-gather buffer for I/O to a device. I've got the device's
> dma_mask; what's the right way to convert that to a GFP bitmask for
> alloc_pages() or get_free_pages()?
This is a bit problematic, unfortunately... There really is no good way
to do this, the best you can do is approximate.
> Also, assuming I'll have to use memcpy() to transfer data into or out of
> the scatter-gather buffer (so it will have to get a kernel virtual mapping
> at some point), am I better off using alloc_pages() followed by
> kmap_atomic()/kunmap_atomic() or get_free_pages()? Or even kmalloc()?
My suggestion would be to do page allocations (not kmalloc()). With kmap
that'll work just fine for you, and it's easy to extend to just use the
right gfp mask if/when we ever get something that works for this.
--
Jens Axboe
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2003-11-09 21:12 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-11-09 20:44 How to allocate pages for a scatter-gather buffer? Alan Stern
2003-11-09 21:12 ` Jens Axboe
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox