From: Guenter Roeck <linux@roeck-us.net>
To: Keith Busch <kbusch@meta.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org,
Keith Busch <kbusch@kernel.org>,
Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Subject: Re: [PATCH] dmapool: push new blocks in ascending order
Date: Mon, 27 Feb 2023 18:14:26 -0800 [thread overview]
Message-ID: <20230228021426.GA3955867@roeck-us.net> (raw)
In-Reply-To: <20230221165400.1595247-1-kbusch@meta.com>
On Tue, Feb 21, 2023 at 08:54:00AM -0800, Keith Busch wrote:
> From: Keith Busch <kbusch@kernel.org>
>
> Some users of the dmapool need their allocations to happen in ascending
> order. The recent optimizations pushed the blocks in reverse order, so
> restore the previous behavior by linking the next available block from
> low-to-high.
>
> Fixes: ced6d06a81fb69 ("dmapool: link blocks across pages")
> Reported-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
> Signed-off-by: Keith Busch <kbusch@kernel.org>
This patch fixes the problem I had observed when trying to boot from
the megasas SCSI controller on powernv.
Tested-by: Guenter Roeck <linux@roeck-us.net>
Thanks,
Guenter
> ---
> mm/dmapool.c | 15 +++++++++++++--
> 1 file changed, 13 insertions(+), 2 deletions(-)
>
> diff --git a/mm/dmapool.c b/mm/dmapool.c
> index 1920890ff8d3d..a151a21e571b7 100644
> --- a/mm/dmapool.c
> +++ b/mm/dmapool.c
> @@ -300,7 +300,7 @@ EXPORT_SYMBOL(dma_pool_create);
> static void pool_initialise_page(struct dma_pool *pool, struct dma_page *page)
> {
> unsigned int next_boundary = pool->boundary, offset = 0;
> - struct dma_block *block;
> + struct dma_block *block, *first = NULL, *last = NULL;
>
> pool_init_page(pool, page);
> while (offset + pool->size <= pool->allocation) {
> @@ -311,11 +311,22 @@ static void pool_initialise_page(struct dma_pool *pool, struct dma_page *page)
> }
>
> block = page->vaddr + offset;
> - pool_block_push(pool, block, page->dma + offset);
> + block->dma = page->dma + offset;
> + block->next_block = NULL;
> +
> + if (last)
> + last->next_block = block;
> + else
> + first = block;
> + last = block;
> +
> offset += pool->size;
> pool->nr_blocks++;
> }
>
> + last->next_block = pool->next_block;
> + pool->next_block = first;
> +
> list_add(&page->page_list, &pool->page_list);
> pool->nr_pages++;
> }
> --
> 2.30.2
>
>
prev parent reply other threads:[~2023-02-28 2:14 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-21 16:54 Keith Busch
2023-02-21 17:20 ` Bryan O'Donoghue
2023-02-21 18:02 ` Christoph Hellwig
2023-02-21 18:07 ` Keith Busch
2023-02-23 20:41 ` Andrew Morton
2023-02-24 18:24 ` Keith Busch
2023-02-24 22:28 ` Bryan O'Donoghue
2023-02-26 4:42 ` Andrew Morton
2023-02-27 17:20 ` Keith Busch
2023-02-28 1:25 ` Keith Busch
2023-02-28 2:14 ` Guenter Roeck [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=20230228021426.GA3955867@roeck-us.net \
--to=linux@roeck-us.net \
--cc=akpm@linux-foundation.org \
--cc=bryan.odonoghue@linaro.org \
--cc=kbusch@kernel.org \
--cc=kbusch@meta.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
/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