Re: [PATCH 2/3] dmapool: improve scalability of dma_pool_free

2018-07-30 Thread Tony Battersby
On 07/27/2018 05:27 PM, Tony Battersby wrote: > On 07/27/2018 03:38 PM, Tony Battersby wrote: >> But the bigger problem is that my first patch adds another list_head to >> the dma_page for the avail_page_link to make allocations faster.  I >> suppose we could make the lists singly-linked instead

Re: [PATCH 2/3] dmapool: improve scalability of dma_pool_free

2018-07-27 Thread Tony Battersby
On 07/27/2018 05:35 PM, Andy Shevchenko wrote: > On Sat, Jul 28, 2018 at 12:27 AM, Tony Battersby > wrote: >> On 07/27/2018 03:38 PM, Tony Battersby wrote: >>> But the bigger problem is that my first patch adds another list_head to >>> the dma_page for the avail_page_link to make allocations

Re: [PATCH 2/3] dmapool: improve scalability of dma_pool_free

2018-07-27 Thread Andy Shevchenko
On Sat, Jul 28, 2018 at 12:27 AM, Tony Battersby wrote: > On 07/27/2018 03:38 PM, Tony Battersby wrote: >> But the bigger problem is that my first patch adds another list_head to >> the dma_page for the avail_page_link to make allocations faster. I >> suppose we could make the lists

Re: [PATCH 2/3] dmapool: improve scalability of dma_pool_free

2018-07-27 Thread Tony Battersby
On 07/27/2018 03:38 PM, Tony Battersby wrote: > But the bigger problem is that my first patch adds another list_head to > the dma_page for the avail_page_link to make allocations faster.  I > suppose we could make the lists singly-linked instead of doubly-linked > to save space. > I managed to

Re: [PATCH 2/3] dmapool: improve scalability of dma_pool_free

2018-07-27 Thread Tony Battersby
On 07/27/2018 11:23 AM, Matthew Wilcox wrote: > On Fri, Jul 27, 2018 at 09:23:30AM -0400, Tony Battersby wrote: >> On 07/26/2018 08:07 PM, Matthew Wilcox wrote: >>> If you're up for more major surgery, then I think we can put all the >>> information currently stored in dma_page into struct page.

Re: [PATCH 2/3] dmapool: improve scalability of dma_pool_free

2018-07-27 Thread Matthew Wilcox
On Fri, Jul 27, 2018 at 09:23:30AM -0400, Tony Battersby wrote: > On 07/26/2018 08:07 PM, Matthew Wilcox wrote: > > If you're up for more major surgery, then I think we can put all the > > information currently stored in dma_page into struct page. Something > > like this: > > > > +++

Re: [PATCH 2/3] dmapool: improve scalability of dma_pool_free

2018-07-27 Thread Tony Battersby
On 07/26/2018 08:07 PM, Matthew Wilcox wrote: > On Thu, Jul 26, 2018 at 04:06:05PM -0400, Tony Battersby wrote: >> On 07/26/2018 03:42 PM, Matthew Wilcox wrote: >>> On Thu, Jul 26, 2018 at 02:54:56PM -0400, Tony Battersby wrote: dma_pool_free() scales poorly when the pool contains many pages

Re: [PATCH 2/3] dmapool: improve scalability of dma_pool_free

2018-07-26 Thread Matthew Wilcox
On Thu, Jul 26, 2018 at 04:06:05PM -0400, Tony Battersby wrote: > On 07/26/2018 03:42 PM, Matthew Wilcox wrote: > > On Thu, Jul 26, 2018 at 02:54:56PM -0400, Tony Battersby wrote: > >> dma_pool_free() scales poorly when the pool contains many pages because > >> pool_find_page() does a linear scan

Re: [PATCH 2/3] dmapool: improve scalability of dma_pool_free

2018-07-26 Thread Tony Battersby
On 07/26/2018 03:42 PM, Matthew Wilcox wrote: > On Thu, Jul 26, 2018 at 02:54:56PM -0400, Tony Battersby wrote: >> dma_pool_free() scales poorly when the pool contains many pages because >> pool_find_page() does a linear scan of all allocated pages. Improve its >> scalability by replacing the

Re: [PATCH 2/3] dmapool: improve scalability of dma_pool_free

2018-07-26 Thread Andy Shevchenko
On Thu, Jul 26, 2018 at 9:54 PM, Tony Battersby wrote: > dma_pool_free() scales poorly when the pool contains many pages because > pool_find_page() does a linear scan of all allocated pages. Improve its > scalability by replacing the linear scan with a red-black tree lookup. > In big O notation,

Re: [PATCH 2/3] dmapool: improve scalability of dma_pool_free

2018-07-26 Thread Matthew Wilcox
On Thu, Jul 26, 2018 at 02:54:56PM -0400, Tony Battersby wrote: > dma_pool_free() scales poorly when the pool contains many pages because > pool_find_page() does a linear scan of all allocated pages. Improve its > scalability by replacing the linear scan with a red-black tree lookup. > In big O

[PATCH 2/3] dmapool: improve scalability of dma_pool_free

2018-07-26 Thread Tony Battersby
dma_pool_free() scales poorly when the pool contains many pages because pool_find_page() does a linear scan of all allocated pages. Improve its scalability by replacing the linear scan with a red-black tree lookup. In big O notation, this improves the algorithm from O(n^2) to O(n * log n).