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



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]

  Powered by Linux