From: roel <12o3l@tiscali.nl>
To: Matthew Wilcox <willy@linux.intel.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH 4/4] dmapool: Improve memory usage for devices which can't cross boundaries
Date: Wed, 26 Sep 2007 22:12:27 +0200 [thread overview]
Message-ID: <46FABD2B.40901@tiscali.nl> (raw)
In-Reply-To: <11908332791548-git-send-email-willy@linux.intel.com>
Matthew Wilcox wrote:
[...]
> @@ -142,14 +144,13 @@ struct dma_pool *dma_pool_create(const char *name, struct device *dev,
> if ((size % align) != 0)
> size = ALIGN(size, align);
>
> - if (allocation == 0) {
> - if (PAGE_SIZE < size)
> - allocation = size;
> - else
> - allocation = PAGE_SIZE;
> - // FIXME: round up for less fragmentation
> - } else if (allocation < size)
> + allocation = max_t(size_t, size, PAGE_SIZE);
> +
> + if (!boundary) {
> + boundary = allocation;
> + } else if ((boundary < size) || (boundary & (boundary - 1))) {
> return NULL;
> + }
if (!boundary)
boundary = allocation;
else if (boundary < size || boundary & (boundary - 1))
return NULL;
[...]
> @@ -190,11 +192,14 @@ struct dma_pool *dma_pool_create(const char *name, struct device *dev,
> static void pool_initialise_page(struct dma_pool *pool, struct dma_page *page)
> {
> unsigned int offset = 0;
> + unsigned int next_boundary = pool->boundary;
>
> do {
> unsigned int next = offset + pool->size;
> - if (unlikely((next + pool->size) >= pool->allocation))
> - next = pool->allocation;
> + if (unlikely((next + pool->size) >= next_boundary)) {
if (unlikely(next + pool->size >= next_boundary)) {
[...]
next prev parent reply other threads:[~2007-09-26 20:12 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-09-26 18:57 dmapool Matthew Wilcox
2007-09-26 19:01 ` [PATCH 1/4] Avoid taking waitqueue lock in dmapool Matthew Wilcox
2007-09-26 21:10 ` David Miller
2007-09-26 19:01 ` [PATCH 2/4] dmapool: Validate parameters to dma_pool_create Matthew Wilcox
2007-09-26 19:47 ` roel
[not found] ` <20070926214022.GA14710@linuxntel.com>
2007-09-26 21:08 ` roel
2007-09-26 21:10 ` David Miller
2007-09-26 19:01 ` [PATCH 3/4] Change dmapool free block management Matthew Wilcox
2007-09-26 19:23 ` Roland Dreier
2007-09-26 20:07 ` roel
2007-09-26 21:13 ` David Miller
2007-09-26 19:01 ` [PATCH 4/4] dmapool: Improve memory usage for devices which can't cross boundaries Matthew Wilcox
2007-09-26 20:12 ` roel [this message]
2007-09-26 21:14 ` David Miller
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=46FABD2B.40901@tiscali.nl \
--to=12o3l@tiscali.nl \
--cc=linux-kernel@vger.kernel.org \
--cc=willy@linux.intel.com \
/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