linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Tony Battersby <tonyb@cybernetics.com>
To: Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: Matthew Wilcox <willy@infradead.org>,
	Christoph Hellwig <hch@lst.de>,
	Marek Szyprowski <m.szyprowski@samsung.com>,
	Sathya Prakash <sathya.prakash@broadcom.com>,
	Chaitra P B <chaitra.basappa@broadcom.com>,
	Suganath Prabu Subramani <suganath-prabu.subramani@broadcom.com>,
	iommu@lists.linux-foundation.org, linux-mm <linux-mm@kvack.org>,
	linux-scsi <linux-scsi@vger.kernel.org>,
	MPT-FusionLinux.pdl@broadcom.com
Subject: Re: [PATCH v2 4/9] dmapool: improve scalability of dma_pool_alloc
Date: Fri, 3 Aug 2018 09:55:17 -0400	[thread overview]
Message-ID: <b304d118-8cca-594c-1321-bb65e39700e4@cybernetics.com> (raw)
In-Reply-To: <CAHp75Vdj_jcv3j2pNf4EnzasN9zCJ1f+2aWwT2f5GKG=yFAm4Q@mail.gmail.com>

On 08/03/2018 05:02 AM, Andy Shevchenko wrote:
> On Thu, Aug 2, 2018 at 10:58 PM, Tony Battersby <tonyb@cybernetics.com> wrote:
>> dma_pool_alloc() scales poorly when allocating a large number of pages
>> because it does a linear scan of all previously-allocated pages before
>> allocating a new one.  Improve its scalability by maintaining a separate
>> list of pages that have free blocks ready to (re)allocate.  In big O
>> notation, this improves the algorithm from O(n^2) to O(n).
>>  struct dma_pool {              /* the pool */
>> +#define POOL_FULL_IDX   0
>> +#define POOL_AVAIL_IDX  1
>> +#define POOL_N_LISTS    2
>> +       struct list_head page_list[POOL_N_LISTS];
> To be consistent with naming scheme and common practice I would rather
> name the last one as
>
> POOL_MAX_IDX 2
OK.
>
>> +       INIT_LIST_HEAD(&retval->page_list[0]);
>> +       INIT_LIST_HEAD(&retval->page_list[1]);
> You introduced defines and don't use them.
>
Just a matter of style.A  In this context, it only matters that both
index 0 and 1 get initialized, not which index corresponds to which
list.A  But I suppose using the defines would improve keyword search, so
I'll change it.

      reply	other threads:[~2018-08-03 13:55 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-02 19:58 Tony Battersby
2018-08-02 20:08 ` Matthew Wilcox
2018-08-03  9:02 ` Andy Shevchenko
2018-08-03 13:55   ` Tony Battersby [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=b304d118-8cca-594c-1321-bb65e39700e4@cybernetics.com \
    --to=tonyb@cybernetics.com \
    --cc=MPT-FusionLinux.pdl@broadcom.com \
    --cc=andy.shevchenko@gmail.com \
    --cc=chaitra.basappa@broadcom.com \
    --cc=hch@lst.de \
    --cc=iommu@lists.linux-foundation.org \
    --cc=linux-mm@kvack.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=m.szyprowski@samsung.com \
    --cc=sathya.prakash@broadcom.com \
    --cc=suganath-prabu.subramani@broadcom.com \
    --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