From patchwork Fri Dec 13 22:24:07 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 22398 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ie0-f199.google.com (mail-ie0-f199.google.com [209.85.223.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 2A1A723FBA for ; Fri, 13 Dec 2013 22:26:59 +0000 (UTC) Received: by mail-ie0-f199.google.com with SMTP id lx4sf8920248iec.6 for ; Fri, 13 Dec 2013 14:26:58 -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=shHYArieVfASUaCJNGTNxUelna+QxPtKj4Qbjn9bf1E=; b=F/xfhy0MbsjgyBObBVTwpIVB/tRgYYesOlIAqN+O7SpGhmSPoyuDQWzrI4DIqT10id Sj/dX9Xw0g+7B9ldQp3Fd1YcX3TypQArdEXqXTmUczC0CqJOBuWhuUw9xC2rF7iwjVbV Mh9TwLCtvXJn7rLTzS4GJ6WsPD5xczZLBU+T6/hgrinN6yWavYitVm4fxbww+iPrffMv yoAwB3fE9kUyc59qgrUeYOaBvPAsSxA7c5aNtwgioQvcii6viQcm+sTWNWFmwTZTjPnC 0d37gSjOw45QaJbfOB7A5h6jfLcpsrUUW27eQ5woxK5EjZmPhUGQy5tO1QodjCmpJeuY Tp0A== X-Gm-Message-State: ALoCoQlBSW/c5ZP5Jj62oRhAwbC+n9W10hFaOXKaMYCBJt9wmUE8UKpZZgnPZuUa+z4lqKLmjuuL X-Received: by 10.182.109.200 with SMTP id hu8mr1946863obb.20.1386973618793; Fri, 13 Dec 2013 14:26:58 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.97.201 with SMTP id ec9ls1222155qeb.60.gmail; Fri, 13 Dec 2013 14:26:58 -0800 (PST) X-Received: by 10.58.187.81 with SMTP id fq17mr2253148vec.14.1386973618589; Fri, 13 Dec 2013 14:26:58 -0800 (PST) Received: from mail-vb0-f48.google.com (mail-vb0-f48.google.com [209.85.212.48]) by mx.google.com with ESMTPS id pv1si1193123veb.94.2013.12.13.14.26.58 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 13 Dec 2013 14:26:58 -0800 (PST) Received-SPF: neutral (google.com: 209.85.212.48 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.48; Received: by mail-vb0-f48.google.com with SMTP id f13so1700824vbg.21 for ; Fri, 13 Dec 2013 14:26:58 -0800 (PST) X-Received: by 10.52.165.210 with SMTP id za18mr1912166vdb.20.1386973618518; Fri, 13 Dec 2013 14:26:58 -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 u4csp73507vcz; Fri, 13 Dec 2013 14:26:58 -0800 (PST) X-Received: by 10.66.159.132 with SMTP id xc4mr5979407pab.27.1386973617797; Fri, 13 Dec 2013 14:26:57 -0800 (PST) Received: from mail-pa0-f46.google.com (mail-pa0-f46.google.com [209.85.220.46]) by mx.google.com with ESMTPS id eq2si2442699pbb.82.2013.12.13.14.26.57 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 13 Dec 2013 14:26:57 -0800 (PST) Received-SPF: neutral (google.com: 209.85.220.46 is neither permitted nor denied by best guess record for domain of john.stultz@linaro.org) client-ip=209.85.220.46; Received: by mail-pa0-f46.google.com with SMTP id kl14so594303pab.33 for ; Fri, 13 Dec 2013 14:26:57 -0800 (PST) X-Received: by 10.68.196.227 with SMTP id ip3mr5933928pbc.163.1386973617422; Fri, 13 Dec 2013 14:26:57 -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 qz9sm7457908pbc.3.2013.12.13.14.26.56 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 13 Dec 2013 14:26:56 -0800 (PST) From: John Stultz To: LKML Cc: Greg KH , Android Kernel Team , Sumit Semwal , Jesse Barker , Colin Cross , Rebecca Schultz Zavin , John Stultz Subject: [PATCH 033/115] gpu: ion: Stop trying to allocate from an order on first failure Date: Fri, 13 Dec 2013 14:24:07 -0800 Message-Id: <1386973529-4884-34-git-send-email-john.stultz@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1386973529-4884-1-git-send-email-john.stultz@linaro.org> References: <1386973529-4884-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.48 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: Rebecca Schultz Zavin With this patch the system heap will only try to allocate from each order as long as allocations succeed. If it failes to obtain a higher order allocation, it doesn't retry that order. Signed-off-by: Rebecca Schultz Zavin [jstultz: modified patch to apply to staging directory] Signed-off-by: John Stultz --- drivers/staging/android/ion/ion_system_heap.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/drivers/staging/android/ion/ion_system_heap.c b/drivers/staging/android/ion/ion_system_heap.c index ef8afc7..30a225a 100644 --- a/drivers/staging/android/ion/ion_system_heap.c +++ b/drivers/staging/android/ion/ion_system_heap.c @@ -32,7 +32,8 @@ struct page_info { }; static struct page_info *alloc_largest_available(unsigned long size, - bool split_pages) + bool split_pages, + unsigned int max_order) { static unsigned int orders[] = {8, 4, 0}; struct page *page; @@ -42,6 +43,8 @@ static struct page_info *alloc_largest_available(unsigned long size, for (i = 0; i < ARRAY_SIZE(orders); i++) { if (size < (1 << orders[i]) * PAGE_SIZE) continue; + if (max_order < orders[i]) + continue; page = alloc_pages(GFP_HIGHUSER | __GFP_ZERO | __GFP_NOWARN | __GFP_NORETRY, orders[i]); if (!page) @@ -71,13 +74,17 @@ static int ion_system_heap_allocate(struct ion_heap *heap, bool split_pages = ion_buffer_fault_user_mappings(buffer); + unsigned int max_order = orders[0]; + INIT_LIST_HEAD(&pages); while (size_remaining > 0) { - info = alloc_largest_available(size_remaining, split_pages); + info = alloc_largest_available(size_remaining, split_pages, + max_order); if (!info) goto err; list_add_tail(&info->list, &pages); size_remaining -= (1 << info->order) * PAGE_SIZE; + max_order = info->order; i++; }