From patchwork Fri Dec 13 22:24:12 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 22403 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qc0-f198.google.com (mail-qc0-f198.google.com [209.85.216.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 2E2EE23FBA for ; Fri, 13 Dec 2013 22:27:08 +0000 (UTC) Received: by mail-qc0-f198.google.com with SMTP id e9sf4349896qcy.9 for ; Fri, 13 Dec 2013 14:27:07 -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=mHs3KWL8oebxClnHXPAJPplZmzBq4ldEVFMnbrr+DbM=; b=ZjfGoP4UR2Bln2sBbFa0Xle/U2feqQUg0K8JkzHRzAPpUmlxBBbM1B3KGlAJhvbGRc 4WrCgBcR5CvxclNsIPiIAgV/BembvCEgBKQLJdmHrP+4LI6lUMkRmnCc4N+w3I7PN9hf h61wsoNLcr/hKBAbna5rg5NGPO4e8Qx5sOfyho/dZAyFAxpJhWOeZwNhR03L/8aV5trd Basb3V6Y+p/Ulr1rzdemlvLcmEz60Q9S6Zdzr0iDYkrfgrCGlmxm5tCV4NrhXBeFwlpJ b8bocEVgPMUx5d6H1UwQf6FdIsXttXXubYn2mmjnVf7uXc6b14FoWyzOkfByE9zqvBuI VX8g== X-Gm-Message-State: ALoCoQmhW+yw1haACd/4sjEEau/ph2aJtA9uDvh89xmZQ+Q21m+4o9bJXTs9HCjxtvbfc40fF/Iw X-Received: by 10.236.128.72 with SMTP id e48mr1621397yhi.20.1386973627967; Fri, 13 Dec 2013 14:27:07 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.49.10 with SMTP id q10ls1273070qen.0.gmail; Fri, 13 Dec 2013 14:27:07 -0800 (PST) X-Received: by 10.52.171.79 with SMTP id as15mr1830866vdc.1.1386973627826; Fri, 13 Dec 2013 14:27:07 -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 o3si1194545ves.86.2013.12.13.14.27.07 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 13 Dec 2013 14:27:07 -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 w18so1755180vbj.9 for ; Fri, 13 Dec 2013 14:27:07 -0800 (PST) X-Received: by 10.58.187.129 with SMTP id fs1mr2167412vec.45.1386973627758; Fri, 13 Dec 2013 14:27:07 -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 u4csp73515vcz; Fri, 13 Dec 2013 14:27:07 -0800 (PST) X-Received: by 10.68.195.70 with SMTP id ic6mr6057821pbc.112.1386973626969; Fri, 13 Dec 2013 14:27:06 -0800 (PST) Received: from mail-pd0-f182.google.com (mail-pd0-f182.google.com [209.85.192.182]) by mx.google.com with ESMTPS id ob10si2496091pbb.217.2013.12.13.14.27.06 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 13 Dec 2013 14:27:06 -0800 (PST) Received-SPF: neutral (google.com: 209.85.192.182 is neither permitted nor denied by best guess record for domain of john.stultz@linaro.org) client-ip=209.85.192.182; Received: by mail-pd0-f182.google.com with SMTP id v10so3065560pde.27 for ; Fri, 13 Dec 2013 14:27:06 -0800 (PST) X-Received: by 10.68.196.227 with SMTP id ip3mr5934516pbc.163.1386973626552; Fri, 13 Dec 2013 14: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 qz9sm7457908pbc.3.2013.12.13.14.27.05 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 13 Dec 2013 14:27:06 -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 038/115] gpu: ion: Modify gfp flags in ion_system_heap Date: Fri, 13 Dec 2013 14:24:12 -0800 Message-Id: <1386973529-4884-39-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.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: Rebecca Schultz Zavin When allocations larger than order 4 are made, use _GFP_NORETRY and __GFP_NO_KSWAPD so kswapd doesn't get kicked off to reclaim these larger chunks. For smaller allocaitons, these are unnecessary, as the system should be able to reclaim these. 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 | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/drivers/staging/android/ion/ion_system_heap.c b/drivers/staging/android/ion/ion_system_heap.c index 35fbfff..b99fa0e 100644 --- a/drivers/staging/android/ion/ion_system_heap.c +++ b/drivers/staging/android/ion/ion_system_heap.c @@ -26,6 +26,11 @@ #include "ion.h" #include "ion_priv.h" +static unsigned int high_order_gfp_flags = (GFP_HIGHUSER | __GFP_ZERO | + __GFP_NOWARN | __GFP_NORETRY | + __GFP_NO_KSWAPD); +static unsigned int low_order_gfp_flags = (GFP_HIGHUSER | __GFP_ZERO | + __GFP_NOWARN); static const unsigned int orders[] = {8, 4, 0}; static const int num_orders = ARRAY_SIZE(orders); static int order_to_index(unsigned int order) @@ -63,11 +68,15 @@ static struct page *alloc_buffer_page(struct ion_system_heap *heap, struct ion_page_pool *pool = heap->pools[order_to_index(order)]; struct page *page; - if (!cached) + if (!cached) { page = ion_page_pool_alloc(pool); - else - page = alloc_pages(GFP_HIGHUSER | __GFP_ZERO | - __GFP_NOWARN | __GFP_NORETRY, order); + } else { + gfp_t gfp_flags = low_order_gfp_flags; + + if (order > 4) + gfp_flags = high_order_gfp_flags; + page = alloc_pages(gfp_flags, order); + } if (!page) return 0; if (split_pages) @@ -342,9 +351,11 @@ struct ion_heap *ion_system_heap_create(struct ion_platform_heap *unused) goto err_alloc_pools; for (i = 0; i < num_orders; i++) { struct ion_page_pool *pool; - pool = ion_page_pool_create(GFP_HIGHUSER | __GFP_ZERO | - __GFP_NOWARN | __GFP_NORETRY, - orders[i]); + gfp_t gfp_flags = low_order_gfp_flags; + + if (orders[i] > 4) + gfp_flags = high_order_gfp_flags; + pool = ion_page_pool_create(gfp_flags, orders[i]); if (!pool) goto err_create_pool; heap->pools[i] = pool;