From patchwork Sat Dec 14 03:26:25 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 22475 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-vc0-f200.google.com (mail-vc0-f200.google.com [209.85.220.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 94C1923908 for ; Sat, 14 Dec 2013 03:27:08 +0000 (UTC) Received: by mail-vc0-f200.google.com with SMTP id hu19sf4782252vcb.7 for ; Fri, 13 Dec 2013 19:27:08 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=rMGZD8QLCCDmiWJwypLzFsWDCghiA2Z101/42lkJNGk=; b=SkCA/3ERfgbXo+omO9IVhHVooK0auNFuGFai2FmkgPrbn59BFAUf3RVllXKf3rkGdA VNm+JxNOZMzrK9p7DKDIVl7ZT26w5Dfo2R0a8XHk2kt55BPWbzTKAg7f81UgipuiXakY 6HWI6aspJ+CUKT5GDr7bOvl1Gs/3qb8Ub3Ub/9pQnKzpJwydBCWBx68BJgdG0BwUVmAA UgIpCiTcYKa3jrTaMQ0zxxpsIYJ6pIv/7xEQ/Ntmb/Dn7p85z2JaAe7gN+C/FV0gSww+ XWmlizS8HQHCqUfp1CaSLVKRQHzO6jmTjXwBdzzeyN+uP+GsR+ca5aP/wXyHNy9JTdGl 8YlQ== X-Gm-Message-State: ALoCoQmi4/HHyk4/KC4xp3yJKAOB9cSK8FBv9j0F9WmDz5Ok4B8qxxb2WcCMBi6DHqtYFGsmMSQn X-Received: by 10.52.76.34 with SMTP id h2mr1905403vdw.2.1386991628430; Fri, 13 Dec 2013 19:27:08 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.50.196 with SMTP id e4ls1280105qeo.3.gmail; Fri, 13 Dec 2013 19:27:08 -0800 (PST) X-Received: by 10.220.200.65 with SMTP id ev1mr2597619vcb.13.1386991628314; Fri, 13 Dec 2013 19:27:08 -0800 (PST) Received: from mail-vb0-f50.google.com (mail-vb0-f50.google.com [209.85.212.50]) by mx.google.com with ESMTPS id er6si1412959vdc.153.2013.12.13.19.27.08 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 13 Dec 2013 19:27:08 -0800 (PST) Received-SPF: neutral (google.com: 209.85.212.50 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.212.50; Received: by mail-vb0-f50.google.com with SMTP id w18so1853493vbj.37 for ; Fri, 13 Dec 2013 19:27:08 -0800 (PST) X-Received: by 10.52.162.168 with SMTP id yb8mr2194201vdb.8.1386991628223; Fri, 13 Dec 2013 19:27:08 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.220.174.196 with SMTP id u4csp86958vcz; Fri, 13 Dec 2013 19:27:07 -0800 (PST) X-Received: by 10.68.130.169 with SMTP id of9mr7147348pbb.79.1386991626711; Fri, 13 Dec 2013 19:27:06 -0800 (PST) Received: from mail-pa0-f50.google.com (mail-pa0-f50.google.com [209.85.220.50]) by mx.google.com with ESMTPS id ty3si2965384pbc.257.2013.12.13.19.27.06 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 13 Dec 2013 19:27:06 -0800 (PST) Received-SPF: neutral (google.com: 209.85.220.50 is neither permitted nor denied by best guess record for domain of john.stultz@linaro.org) client-ip=209.85.220.50; Received: by mail-pa0-f50.google.com with SMTP id kl14so805216pab.9 for ; Fri, 13 Dec 2013 19:27:06 -0800 (PST) X-Received: by 10.66.248.227 with SMTP id yp3mr7106524pac.116.1386991626227; Fri, 13 Dec 2013 19:27:06 -0800 (PST) Received: from localhost.localdomain (c-67-170-153-23.hsd1.or.comcast.net. [67.170.153.23]) by mx.google.com with ESMTPSA id nw11sm11680086pab.13.2013.12.13.19.27.05 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 13 Dec 2013 19:27:05 -0800 (PST) From: John Stultz To: LKML Cc: Greg KH , Android Kernel Team , Sumit Semwal , Jesse Barker , Colin Cross , John Stultz Subject: [PATCH 105/115] ion: remove ion_heap_alloc_pages Date: Fri, 13 Dec 2013 19:26:25 -0800 Message-Id: <1386991595-6251-13-git-send-email-john.stultz@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1386991595-6251-1-git-send-email-john.stultz@linaro.org> References: <1386973529-4884-1-git-send-email-john.stultz@linaro.org> <1386991595-6251-1-git-send-email-john.stultz@linaro.org> X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: john.stultz@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.212.50 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , From: Colin Cross Now that ion_vm_fault doesn't need a struct page with a nonzero refcount, there is no need allocate heap memory for cached pages using split_page. Remove the ion_heap_alloc_pages and ion_heap_free_pages helpers in favor of direct calls to alloc_pages and __free_pages, and remove the special handling in the system heap. Signed-off-by: Colin Cross Signed-off-by: John Stultz --- drivers/staging/android/ion/ion_heap.c | 27 --------------------------- drivers/staging/android/ion/ion_priv.h | 13 ------------- drivers/staging/android/ion/ion_system_heap.c | 7 +------ 3 files changed, 1 insertion(+), 46 deletions(-) diff --git a/drivers/staging/android/ion/ion_heap.c b/drivers/staging/android/ion/ion_heap.c index ecc14fd..8054611 100644 --- a/drivers/staging/android/ion/ion_heap.c +++ b/drivers/staging/android/ion/ion_heap.c @@ -148,33 +148,6 @@ end: return ret; } -struct page *ion_heap_alloc_pages(struct ion_buffer *buffer, gfp_t gfp_flags, - unsigned int order) -{ - struct page *page = alloc_pages(gfp_flags, order); - - if (!page) - return page; - - if (ion_buffer_fault_user_mappings(buffer)) - split_page(page, order); - - return page; -} - -void ion_heap_free_pages(struct ion_buffer *buffer, struct page *page, - unsigned int order) -{ - int i; - - if (!ion_buffer_fault_user_mappings(buffer)) { - __free_pages(page, order); - return; - } - for (i = 0; i < (1 << order); i++) - __free_page(page + i); -} - void ion_heap_freelist_add(struct ion_heap *heap, struct ion_buffer * buffer) { rt_mutex_lock(&heap->lock); diff --git a/drivers/staging/android/ion/ion_priv.h b/drivers/staging/android/ion/ion_priv.h index d1fa771..c9b507d 100644 --- a/drivers/staging/android/ion/ion_priv.h +++ b/drivers/staging/android/ion/ion_priv.h @@ -217,19 +217,6 @@ int ion_heap_map_user(struct ion_heap *, struct ion_buffer *, int ion_heap_buffer_zero(struct ion_buffer *buffer); /** - * ion_heap_alloc_pages - allocate pages from alloc_pages - * @buffer: the buffer to allocate for, used to extract the flags - * @gfp_flags: the gfp_t for the allocation - * @order: the order of the allocatoin - * - * This funciton allocations from alloc pages and also does any other - * necessary operations based on the buffer->flags. For buffers which - * will be faulted in the pages are split using split_page - */ -struct page *ion_heap_alloc_pages(struct ion_buffer *buffer, gfp_t gfp_flags, - unsigned int order); - -/** * ion_heap_init_deferred_free -- initialize deferred free functionality * @heap: the heap * diff --git a/drivers/staging/android/ion/ion_system_heap.c b/drivers/staging/android/ion/ion_system_heap.c index bec9d45..a4bcf09 100644 --- a/drivers/staging/android/ion/ion_system_heap.c +++ b/drivers/staging/android/ion/ion_system_heap.c @@ -74,7 +74,7 @@ static struct page *alloc_buffer_page(struct ion_system_heap *heap, if (order > 4) gfp_flags = high_order_gfp_flags; - page = ion_heap_alloc_pages(buffer, gfp_flags, order); + page = alloc_pages(gfp_flags, order); if (!page) return 0; ion_pages_sync_for_device(NULL, page, PAGE_SIZE << order, @@ -91,15 +91,10 @@ static void free_buffer_page(struct ion_system_heap *heap, unsigned int order) { bool cached = ion_buffer_cached(buffer); - bool split_pages = ion_buffer_fault_user_mappings(buffer); - int i; if (!cached) { struct ion_page_pool *pool = heap->pools[order_to_index(order)]; ion_page_pool_free(pool, page); - } else if (split_pages) { - for (i = 0; i < (1 << order); i++) - __free_page(page + i); } else { __free_pages(page, order); }