Re: [PATCH v2 4/9] dmapool: improve scalability of dma_pool_alloc

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Aug 2, 2018 at 10:58 PM, Tony Battersby <tonyb@xxxxxxxxxxxxxxx> 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

> +       INIT_LIST_HEAD(&retval->page_list[0]);
> +       INIT_LIST_HEAD(&retval->page_list[1]);

You introduced defines and don't use them.

-- 
With Best Regards,
Andy Shevchenko




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux