public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jens Axboe <axboe@suse.de>
To: Alan Stern <stern@rowland.harvard.edu>
Cc: linux-kernel@vger.kernel.org
Subject: Re: How to allocate pages for a scatter-gather buffer?
Date: Sun, 9 Nov 2003 22:12:11 +0100	[thread overview]
Message-ID: <20031109211211.GS2831@suse.de> (raw)
In-Reply-To: <Pine.LNX.4.44L0.0311091533520.23369-100000@netrider.rowland.org>

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


      reply	other threads:[~2003-11-09 21:12 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-11-09 20:44 How to allocate pages for a scatter-gather buffer? Alan Stern
2003-11-09 21:12 ` Jens Axboe [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20031109211211.GS2831@suse.de \
    --to=axboe@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stern@rowland.harvard.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox