From: Arnd Bergmann <arnd@arndb•de>
To: linuxppc-embedded@ozlabs•org, rmcguire@videopresence•com
Subject: Re: 1MB alignment dma_alloc question
Date: Fri, 5 Sep 2008 23:31:36 +0200 [thread overview]
Message-ID: <200809052331.36463.arnd@arndb.de> (raw)
In-Reply-To: <CBF4EB06A92A4901B32659109487513E@absolutdaddy>
On Friday 05 September 2008, Russell McGuire wrote:
> So this begs a question is their a better way to get a 1MB aligned table?
> Other than allocating almost 2MB of memory and then trying to mask off the
> LSBs? Seems like an awful waste of memory. I guess the real question is
> there a better kernel call that returns already aligned DMA memory?
__get_free_pages() will allocate naturally aligned pages from the buddy
allocator, so that should do just what you need. If you don't do it at
boot time though, you might not be able to get a full unfragmented
megabyte any more.
Another option would be to call alloc_bootmem() first, align the buffer
and call free_bootmem() on the areas that you do not need. This has to
be done *very* early in the boot process.
Arnd <><
prev parent reply other threads:[~2008-09-05 21:31 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <mailman.1.1220580004.22796.linuxppc-embedded@ozlabs.org>
2008-09-05 21:11 ` 1MB alignment dma_alloc question Russell McGuire
2008-09-05 21:30 ` Scott Wood
2008-09-05 21:31 ` Arnd Bergmann [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=200809052331.36463.arnd@arndb.de \
--to=arnd@arndb$(echo .)de \
--cc=linuxppc-embedded@ozlabs$(echo .)org \
--cc=rmcguire@videopresence$(echo .)com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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