From patchwork Fri Dec 13 22:24:09 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 22400 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pb0-f70.google.com (mail-pb0-f70.google.com [209.85.160.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id D2D4923FBA for ; Fri, 13 Dec 2013 22:27:02 +0000 (UTC) Received: by mail-pb0-f70.google.com with SMTP id rq2sf7459968pbb.1 for ; Fri, 13 Dec 2013 14:27:02 -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=paa33mp7VpCO9R3QgJFQRqkYhmRB5RGBUzJXbQOHWrQ=; b=PYAZciFVW+VTGYuNFENGfWPvUjL5k1/ueotRdA49l52JNqHpGge3zX6GIAoFtzEwaa ccbbpbMHYRYd2HNqdoo6zHYoIjhy0S9t4Y/g9P4dm3nWYSzj/0mCard52bUENCEDTEhZ WXOtPyvazq/abYjAcvEPFNgenI+ZGOGSH7bRydZsw8CwePfFSPeJjcLgmE4jaiAz6tE3 Fi3EUvDZNWNVRwl6M99Y+96eJm+cAHL7sO8Y0GfL6BbNYwyApx6dr+/ejWmPkTUnMera 2ws1AOYR5uao0pDRvIvArZjpyblk5xeOpZ1GI2FlxKcM3WVmu1AYucQyqbGT8lV9x/V2 xUxw== X-Gm-Message-State: ALoCoQkM4mqEPZ3iYJ8kMIwfOBFAaQsaE8YmYNzAo1DfYVH4oFh2Hop5o1hwr5hLYzASELT0s3ow X-Received: by 10.68.202.69 with SMTP id kg5mr3156010pbc.2.1386973622144; Fri, 13 Dec 2013 14:27:02 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.49.10 with SMTP id q10ls1273038qen.0.gmail; Fri, 13 Dec 2013 14:27:01 -0800 (PST) X-Received: by 10.52.230.35 with SMTP id sv3mr1853910vdc.27.1386973621923; Fri, 13 Dec 2013 14:27:01 -0800 (PST) Received: from mail-ve0-f180.google.com (mail-ve0-f180.google.com [209.85.128.180]) by mx.google.com with ESMTPS id gq10si1193635vdc.69.2013.12.13.14.27.01 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 13 Dec 2013 14:27:01 -0800 (PST) Received-SPF: neutral (google.com: 209.85.128.180 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.128.180; Received: by mail-ve0-f180.google.com with SMTP id jz11so1792439veb.25 for ; Fri, 13 Dec 2013 14:27:01 -0800 (PST) X-Received: by 10.52.0.9 with SMTP id 9mr1832334vda.47.1386973621865; Fri, 13 Dec 2013 14:27:01 -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 u4csp73510vcz; Fri, 13 Dec 2013 14:27:01 -0800 (PST) X-Received: by 10.68.245.200 with SMTP id xq8mr5980929pbc.21.1386973621115; Fri, 13 Dec 2013 14:27:01 -0800 (PST) Received: from mail-pd0-f181.google.com (mail-pd0-f181.google.com [209.85.192.181]) by mx.google.com with ESMTPS id qu5si2513110pbc.120.2013.12.13.14.27.00 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 13 Dec 2013 14:27:01 -0800 (PST) Received-SPF: neutral (google.com: 209.85.192.181 is neither permitted nor denied by best guess record for domain of john.stultz@linaro.org) client-ip=209.85.192.181; Received: by mail-pd0-f181.google.com with SMTP id p10so3006348pdj.26 for ; Fri, 13 Dec 2013 14:27:00 -0800 (PST) X-Received: by 10.66.142.170 with SMTP id rx10mr5982922pab.117.1386973620704; Fri, 13 Dec 2013 14:27:00 -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.59 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 13 Dec 2013 14:26:59 -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 035/115] gpu: ion: use vmalloc to allocate page array to map kernel Date: Fri, 13 Dec 2013 14:24:09 -0800 Message-Id: <1386973529-4884-36-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.128.180 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 ion_map_kernel is execute the system must allocate an array large enough to hold a pointer to each page in the buffer. If the buffer is very large and the system memory has become very fragmented, there may not be sufficient high order allocations available from kmalloc. Use vmalloc instead. 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 | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/staging/android/ion/ion_system_heap.c b/drivers/staging/android/ion/ion_system_heap.c index 25b0255..fcfbb66 100644 --- a/drivers/staging/android/ion/ion_system_heap.c +++ b/drivers/staging/android/ion/ion_system_heap.c @@ -174,10 +174,12 @@ void *ion_system_heap_map_kernel(struct ion_heap *heap, pgprot_t pgprot; struct sg_table *table = buffer->priv_virt; int npages = PAGE_ALIGN(buffer->size) / PAGE_SIZE; - struct page **pages = kzalloc(sizeof(struct page *) * npages, - GFP_KERNEL); + struct page **pages = vmalloc(sizeof(struct page *) * npages); struct page **tmp = pages; + if (!pages) + return 0; + if (buffer->flags & ION_FLAG_CACHED) pgprot = PAGE_KERNEL; else @@ -192,7 +194,7 @@ void *ion_system_heap_map_kernel(struct ion_heap *heap, } } vaddr = vmap(pages, npages, VM_MAP, pgprot); - kfree(pages); + vfree(pages); return vaddr; }