From patchwork Thu May 5 03:27:48 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chen Feng X-Patchwork-Id: 67192 Delivered-To: patch@linaro.org Received: by 10.140.92.199 with SMTP id b65csp528121qge; Wed, 4 May 2016 20:28:43 -0700 (PDT) X-Received: by 10.98.51.132 with SMTP id z126mr17081721pfz.23.1462418923161; Wed, 04 May 2016 20:28:43 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d2si8298786pfb.112.2016.05.04.20.28.42; Wed, 04 May 2016 20:28:43 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756093AbcEED2l (ORCPT + 29 others); Wed, 4 May 2016 23:28:41 -0400 Received: from szxga02-in.huawei.com ([119.145.14.65]:61645 "EHLO szxga02-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755313AbcEED2k (ORCPT ); Wed, 4 May 2016 23:28:40 -0400 Received: from 172.24.1.136 (EHLO SZXEML423-HUB.china.huawei.com) ([172.24.1.136]) by szxrg02-dlp.huawei.com (MOS 4.3.7-GA FastPath queued) with ESMTP id DGQ06599; Thu, 05 May 2016 11:28:01 +0800 (CST) Received: from vm163-62.huawei.com (10.184.163.62) by SZXEML423-HUB.china.huawei.com (10.82.67.154) with Microsoft SMTP Server id 14.3.235.1; Thu, 5 May 2016 11:27:49 +0800 From: Chen Feng To: , , , , , , , , , CC: , , , , Subject: [PATCH] ION: Sys_heap: Makes ion buffer always alloc from page pool Date: Thu, 5 May 2016 11:27:48 +0800 Message-ID: <1462418868-40454-1-git-send-email-puck.chen@hisilicon.com> X-Mailer: git-send-email 1.9.1 MIME-Version: 1.0 X-Originating-IP: [10.184.163.62] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A090205.572ABDC3.0178, 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: b5e1d542dfc1ffa63dbf1a5f2cfab538 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. Signed-off-by: Chen Feng --- drivers/staging/android/ion/ion_system_heap.c | 19 ++----------------- 1 file changed, 2 insertions(+), 17 deletions(-) -- 1.9.1 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);