From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757720AbcEFCuR (ORCPT ); Thu, 5 May 2016 22:50:17 -0400 Received: from szxga01-in.huawei.com ([58.251.152.64]:55143 "EHLO szxga01-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755416AbcEFCuP (ORCPT ); Thu, 5 May 2016 22:50:15 -0400 Subject: Re: [PATCH] ION: Sys_heap: Makes ion buffer always alloc from page pool To: Laura Abbott , , , , , , , , References: <1462418868-40454-1-git-send-email-puck.chen@hisilicon.com> CC: , , , , From: Chen Feng Message-ID: <572C0606.3020106@hisilicon.com> Date: Fri, 6 May 2016 10:48:38 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.5.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.142.193.64] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A020205.572C0641.000D,ss=1,re=0.000,recu=0.000,reip=0.000,cl=1,cld=1,fgs=0, ip=0.0.0.0, so=2013-06-18 04:22:30, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: 9e7d1cce9d60b00e5249d72d72aff3c3 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2016/5/6 1:09, Laura Abbott wrote: > On 05/04/2016 08:27 PM, Chen Feng wrote: >> Makes the ion buffer always alloced from page pool, no matter >> it's cached or not. In this way, it can improve the efficiency >> of it. >> >> Currently, there is no difference from cached or non-cached buffer >> for the page pool. > > > The advantage of the uncached pool was that the pages in the pool > were always clean in the cache. This is lost here with the addition > of cached pages to the same pool as uncached pages I agree the > cache path could benefit from pooling but we need to keep the caching > model consistent. > Yes, the buffer in the pool is non-cached. I found that the ion don't have a invalid cache ops. Currently, we use ioctl to keep the cache coherency. In this way, there is no difference between these. So, how do you think add a new cached pool in the system heap? If yes, I can file a new patch to do this. >> >> Signed-off-by: Chen Feng >> --- >> drivers/staging/android/ion/ion_system_heap.c | 19 ++----------------- >> 1 file changed, 2 insertions(+), 17 deletions(-) >> >> diff --git a/drivers/staging/android/ion/ion_system_heap.c b/drivers/staging/android/ion/ion_system_heap.c >> index b69dfc7..caf11fc 100644 >> --- a/drivers/staging/android/ion/ion_system_heap.c >> +++ b/drivers/staging/android/ion/ion_system_heap.c >> @@ -56,24 +56,10 @@ static struct page *alloc_buffer_page(struct ion_system_heap *heap, >> struct ion_buffer *buffer, >> unsigned long order) >> { >> - bool cached = ion_buffer_cached(buffer); >> struct ion_page_pool *pool = heap->pools[order_to_index(order)]; >> 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); >> - } >> - >> + page = ion_page_pool_alloc(pool); >> return page; >> } >> >> @@ -81,9 +67,8 @@ static void free_buffer_page(struct ion_system_heap *heap, >> struct ion_buffer *buffer, struct page *page) >> { >> unsigned int order = compound_order(page); >> - bool cached = ion_buffer_cached(buffer); >> >> - if (!cached && !(buffer->private_flags & ION_PRIV_FLAG_SHRINKER_FREE)) { >> + if (!(buffer->private_flags & ION_PRIV_FLAG_SHRINKER_FREE)) { >> struct ion_page_pool *pool = heap->pools[order_to_index(order)]; >> >> ion_page_pool_free(pool, page); >> > > > . >