lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAH3drwaNFCwwfObkWAYP93gZ5Mb7B9D5bP7o3uBNsYS4W1otyQ@mail.gmail.com>
Date:	Wed, 21 Dec 2011 10:22:56 -0500
From:	Jerome Glisse <j.glisse@...il.com>
To:	Konrad Rzeszutek Wilk <konrad.wilk@...cle.com>
Cc:	linux-kernel@...r.kernel.org, dri-devel@...ts.freedesktop.org,
	bskeggs@...hat.com, thellstrom@...are.com
Subject: Re: [PATCH 3/3] drm/ttm/dma: Optimize when free-ing the recycled page pool.

On Mon, Dec 12, 2011 at 3:09 PM, Konrad Rzeszutek Wilk
<konrad.wilk@...cle.com> wrote:
> We would free the page pool - even if it was for cached pages
> (which are deleted from the pool - so there are no free pages).
>
> Also we also missed the opportunity to batch the amount of pages
> to free (similar to how ttm_page_alloc.c does it). This reintroduces
> the code that was lost during rebasing.
>
> Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@...cle.com>
> ---
>  drivers/gpu/drm/ttm/ttm_page_alloc_dma.c |    9 ++++++---
>  1 files changed, 6 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/ttm/ttm_page_alloc_dma.c b/drivers/gpu/drm/ttm/ttm_page_alloc_dma.c
> index e57aa24..156ddcd 100644
> --- a/drivers/gpu/drm/ttm/ttm_page_alloc_dma.c
> +++ b/drivers/gpu/drm/ttm/ttm_page_alloc_dma.c
> @@ -949,7 +949,7 @@ void ttm_dma_unpopulate(struct ttm_dma_tt *ttm_dma, struct device *dev)
>        struct dma_page *d_page, *next;
>        enum pool_type type;
>        bool is_cached = false;
> -       unsigned count = 0, i, npages;
> +       unsigned count = 0, i, npages = 0;
>        unsigned long irq_flags;
>
>        type = ttm_to_type(ttm->page_flags, ttm->caching_state);
> @@ -971,13 +971,16 @@ void ttm_dma_unpopulate(struct ttm_dma_tt *ttm_dma, struct device *dev)
>        pool->npages_in_use -= count;
>        if (is_cached) {
>                pool->nfrees += count;
> -               npages = count;

See patch 2/3 comment otherwise Reviewed-by: Jerome Glisse <jglisse@...hat.com>

>        } else {
>                pool->npages_free += count;
>                list_splice(&ttm_dma->pages_list, &pool->free_list);
>                npages = count;
>                if (pool->npages_free > _manager->options.max_size) {
>                        npages = pool->npages_free - _manager->options.max_size;
> +                       /* free at least NUM_PAGES_TO_ALLOC number of pages
> +                        * to reduce calls to set_memory_wb */
> +                       if (npages < NUM_PAGES_TO_ALLOC)
> +                               npages = NUM_PAGES_TO_ALLOC;
>                }
>        }
>        spin_unlock_irqrestore(&pool->lock, irq_flags);
> @@ -1001,7 +1004,7 @@ void ttm_dma_unpopulate(struct ttm_dma_tt *ttm_dma, struct device *dev)
>                ttm_dma->dma_address[i] = 0;
>        }
>
> -       /* shrink pool if necessary */
> +       /* shrink pool if necessary (only on !is_cached pools)*/
>        if (npages)
>                ttm_dma_page_pool_free(pool, npages);
>        ttm->state = tt_unpopulated;
> --
> 1.7.7.3
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ