From: Keith Busch <kbusch@kernel.org>
To: Matthew Wilcox <willy@infradead.org>
Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, kernel-team@fb.com
Subject: Re: [PATCH 1/2] mm/dmapool: replace linked list with xarray
Date: Thu, 28 Apr 2022 19:41:03 -0600 [thread overview]
Message-ID: <YmtCL0wzshmW02Xr@kbusch-mbp.dhcp.thefacebook.com> (raw)
In-Reply-To: <YmsOVVfcycVdbzUs@casper.infradead.org>
On Thu, Apr 28, 2022 at 10:59:49PM +0100, Matthew Wilcox wrote:
> On Thu, Apr 28, 2022 at 02:27:13PM -0600, kbusch@kernel.org wrote:
> > @@ -316,13 +316,14 @@ void *dma_pool_alloc(struct dma_pool *pool, gfp_t mem_flags,
> > {
> > unsigned long flags;
> > struct dma_page *page;
> > + unsigned long i;
> > size_t offset;
> > void *retval;
> >
> > might_alloc(mem_flags);
> >
> > spin_lock_irqsave(&pool->lock, flags);
> > - list_for_each_entry(page, &pool->page_list, page_list) {
> > + xa_for_each(&pool->pages, i, page) {
> > if (page->offset < pool->allocation)
> > goto ready;
> > }
>
> A further optimisation you could do is use xarray search marks to
> search for only pages which have free entries.
That's an interesting idea. I didn't consider setting marks since patch 2
replaces this search with essentially a stack pop. If a marked entry can be
returned in a similar time, though, I could drop patch 2. I can't tell from the
xarray code if that operation time is in the same ballpark, though, so I'll
just rerun the the benchmark. :)
next prev parent reply other threads:[~2022-04-29 1:41 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-28 20:27 [PATCH 0/2] dmapool performance enhancements kbusch
2022-04-28 20:27 ` [PATCH 1/2] mm/dmapool: replace linked list with xarray kbusch
2022-04-28 21:59 ` Matthew Wilcox
2022-04-29 1:41 ` Keith Busch [this message]
2022-04-28 20:27 ` [PATCH 2/2] mm/dmapool: link blocks across pages kbusch
2022-05-27 19:35 ` [PATCH 0/2] dmapool performance enhancements Tony Battersby
2022-05-27 21:01 ` Keith Busch
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=YmtCL0wzshmW02Xr@kbusch-mbp.dhcp.thefacebook.com \
--to=kbusch@kernel.org \
--cc=kernel-team@fb.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=willy@infradead.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