mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Laura Abbott <labbott@redhat.com>
To: Chen Feng <puck.chen@hisilicon.com>,
	saberlily.xia@hisilicon.com, gregkh@linuxfoundation.org,
	arve@android.com, riandrews@android.com,
	paul.gortmaker@windriver.com, bmarsh94@gmail.com,
	devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org
Cc: xuyiping@hisilicon.com, suzhuangluan@hisilicon.com,
	dan.zhao@hisilicon.com, linuxarm@huawei.com,
	puck.chen@foxmail.com
Subject: Re: [RESEND PATCH] ION: Sys_heap: Add cached pool to spead up cached buffer alloc
Date: Mon, 9 May 2016 16:50:31 -0700	[thread overview]
Message-ID: <5aef4164-1055-4fca-51ea-3327b9febc10@redhat.com> (raw)
In-Reply-To: <1462783054-36053-1-git-send-email-puck.chen@hisilicon.com>

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

  parent reply	other threads:[~2016-05-09 23:50 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-09  8:37 Chen Feng
2016-05-09  9:02 ` Greg KH
2016-05-09 13:25   ` Chen Feng
2016-05-09 23:50 ` Laura Abbott [this message]
2016-05-10  1:03   ` Chen Feng

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5aef4164-1055-4fca-51ea-3327b9febc10@redhat.com \
    --to=labbott@redhat.com \
    --cc=arve@android.com \
    --cc=bmarsh94@gmail.com \
    --cc=dan.zhao@hisilicon.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxarm@huawei.com \
    --cc=paul.gortmaker@windriver.com \
    --cc=puck.chen@foxmail.com \
    --cc=puck.chen@hisilicon.com \
    --cc=riandrews@android.com \
    --cc=saberlily.xia@hisilicon.com \
    --cc=suzhuangluan@hisilicon.com \
    --cc=xuyiping@hisilicon.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®