On Thu, Aug 02, 2018 at 03:58:40PM -0400, Tony Battersby wrote:
> @@ -339,11 +360,16 @@ void *dma_pool_alloc(struct dma_pool *po
>  
>       spin_lock_irqsave(&pool->lock, flags);
>  
> -     list_add(&page->page_list, &pool->page_list);
> +     list_add(&page->dma_list, &pool->page_list[POOL_AVAIL_IDX]);
>   ready:
>       page->in_use++;
>       offset = page->offset;
>       page->offset = *(int *)(page->vaddr + offset);
> +     if (page->offset >= pool->allocation) {
> +             /* Move page from the "available" list to the "full" list. */
> +             list_del(&page->dma_list);
> +             list_add(&page->dma_list, &pool->page_list[POOL_FULL_IDX]);

I think this should be:

                list_move_tail(&page->dma_list,
                                &pool->page_list[POOL_FULL_IDX]);

> @@ -444,6 +476,11 @@ void dma_pool_free(struct dma_pool *pool
>  #endif
>  
>       page->in_use--;
> +     if (page->offset >= pool->allocation) {
> +             /* Move page from the "full" list to the "available" list. */
> +             list_del(&page->dma_list);
> +             list_add(&page->dma_list, &pool->page_list[POOL_AVAIL_IDX]);

This one probably wants to be
                list_move(&page->dma_list, &pool->page_list[POOL_AVAIL_IDX]);

so that it's first-in-line to be allocated from for cache warmth purposes.
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

Reply via email to