Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1397532

Re: [RESEND PATCH] ION: Sys_heap: Add cached pool to spead up cached buffer alloc

From Laura Abbott <labbott@redhat.com>
Newsgroups linux.kernel
Subject Re: [RESEND PATCH] ION: Sys_heap: Add cached pool to spead up cached buffer alloc
Date 2016-05-10 02:00 +0200
Message-ID <rx3fI-7Ae-9@gated-at.bofh.it> (permalink)
References <rwP34-1DF-19@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On 05/09/2016 01:37 AM, Chen Feng wrote:
> Add ion cached pool in system heap.
>
> Signed-off-by: Chen Feng <puck.chen@hisilicon.com>
> Signed-off-by: Xia  Qing <saberlily.xia@hisilicon.com>
> Reviewed-by: Fu Jun <oliver.fu@hisilicon.com>
> ---
>  drivers/staging/android/ion/ion_system_heap.c | 145 +++++++++++++++++---------
>  1 file changed, 95 insertions(+), 50 deletions(-)
>
> diff --git a/drivers/staging/android/ion/ion_system_heap.c b/drivers/staging/android/ion/ion_system_heap.c
> index b69dfc7..c633252 100644
> --- a/drivers/staging/android/ion/ion_system_heap.c
> +++ b/drivers/staging/android/ion/ion_system_heap.c
> @@ -49,7 +49,8 @@ static inline unsigned int order_to_size(int order)
>
>  struct ion_system_heap {
>  	struct ion_heap heap;
> -	struct ion_page_pool *pools[0];
> +	struct ion_page_pool *uncached_pools[0];
> +	struct ion_page_pool *cached_pools[0];
>  };
>
>  static struct page *alloc_buffer_page(struct ion_system_heap *heap,
> @@ -57,39 +58,36 @@ static struct page *alloc_buffer_page(struct ion_system_heap *heap,
>  				      unsigned long order)
>  {
>  	bool cached = ion_buffer_cached(buffer);
> -	struct ion_page_pool *pool = heap->pools[order_to_index(order)];
> +	struct ion_page_pool *pool;
>  	struct page *page;
>
> -	if (!cached) {
> -		page = ion_page_pool_alloc(pool);
> -	} else {
> -		gfp_t gfp_flags = low_order_gfp_flags;
> -
> -		if (order > 4)
> -			gfp_flags = high_order_gfp_flags;
> -		page = alloc_pages(gfp_flags | __GFP_COMP, order);
> -		if (!page)
> -			return NULL;
> -		ion_pages_sync_for_device(NULL, page, PAGE_SIZE << order,
> -						DMA_BIDIRECTIONAL);
> -	}
> +	if (!cached)
> +		pool = heap->uncached_pools[order_to_index(order)];
> +	else
> +		pool = heap->cached_pools[order_to_index(order)];
>
> +	page = ion_page_pool_alloc(pool);
>  	return page;
>  }
>

This is a change in behavior. The page is no longer guaranteed to be synced
in the cache. If the page came from the pool (not just freshly allocated)
the cache state is unknown. Do you have a good explanation why we no longer
need to do the cache flush here on every allocation?

Thanks,
Laura

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[RESEND PATCH] ION: Sys_heap: Add cached pool to spead up cached buffer alloc Chen Feng <puck.chen@hisilicon.com> - 2016-05-09 10:50 +0200
  Re: [RESEND PATCH] ION: Sys_heap: Add cached pool to spead up cached  buffer alloc Greg KH <gregkh@linuxfoundation.org> - 2016-05-09 11:10 +0200
    Re: [RESEND PATCH] ION: Sys_heap: Add cached pool to spead up cached  buffer alloc Chen Feng <puck.chen@foxmail.com> - 2016-05-09 15:40 +0200
  Re: [RESEND PATCH] ION: Sys_heap: Add cached pool to spead up cached  buffer alloc Laura Abbott <labbott@redhat.com> - 2016-05-10 02:00 +0200
    Re: [RESEND PATCH] ION: Sys_heap: Add cached pool to spead up cached  buffer alloc Chen Feng <puck.chen@hisilicon.com> - 2016-05-10 03:10 +0200

csiph-web