From patchwork Mon Jul 9 07:39:32 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Inki Dae X-Patchwork-Id: 1171381 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by patchwork1.kernel.org (Postfix) with ESMTP id 54DB13FC2A for ; Mon, 9 Jul 2012 07:39:46 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 2CE4D9F101 for ; Mon, 9 Jul 2012 00:39:46 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mailout2.samsung.com (mailout2.samsung.com [203.254.224.25]) by gabe.freedesktop.org (Postfix) with ESMTP id 11A8F9F04D for ; Mon, 9 Jul 2012 00:39:34 -0700 (PDT) Received: from epcpsbgm2.samsung.com (mailout2.samsung.com [203.254.224.25]) by mailout2.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0M6V00BYYULQXJR0@mailout2.samsung.com> for dri-devel@lists.freedesktop.org; Mon, 09 Jul 2012 16:39:33 +0900 (KST) X-AuditID: cbfee61b-b7f566d000005c8a-0e-4ffa8ab57f49 Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id 06.49.23690.5BA8AFF4; Mon, 09 Jul 2012 16:39:33 +0900 (KST) Received: from daeinki-desktop.10.32.193.11 ([10.90.51.53]) by mmp1.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0M6V00A6VULW7X50@mmp1.samsung.com> for dri-devel@lists.freedesktop.org; Mon, 09 Jul 2012 16:39:32 +0900 (KST) From: Inki Dae To: airlied@linux.ie, dri-devel@lists.freedesktop.org Subject: [PATCH v3] drm/exynos: use __free_page() to deallocate memory Date: Mon, 09 Jul 2012 16:39:32 +0900 Message-id: <1341819572-18852-1-git-send-email-inki.dae@samsung.com> X-Mailer: git-send-email 1.7.4.1 In-reply-to: <1341818402-32584-1-git-send-email-inki.dae@samsung.com> References: <1341818402-32584-1-git-send-email-inki.dae@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrAJMWRmVeSWpSXmKPExsVy+t9jAd2tXb/8DeZNZ7e48vU9mwOjx/3u 40wBjFFcNimpOZllqUX6dglcGdOWdjAXnOKv+PN7I1MD43WeLkYODgkBE4l3i1W7GDmBTDGJ C/fWs3UxcnEICSxilLiz9CgLhLOeSWLa3HVMIFVsAqoSE1fcZwOxRQRMJTomLWUBsZkFCiUW 9jwFs4UF3CRaz05gBbFZgOrPv1jPCLKMV8BFYtlHI4hlChIL7r1lAwlzCrhKNK5NBQkLAVU8 adzBNIGRdwEjwypG0dSC5ILipPRcI73ixNzi0rx0veT83E2MYH8/k97BuKrB4hCjAAejEg/v yeZf/kKsiWXFlbmHGCU4mJVEeB90AoV4UxIrq1KL8uOLSnNSiw8xSnOwKInzmnh/9RcSSE8s Sc1OTS1ILYLJMnFwSjUwBs6J389lfDGmQ9NKq3/5MYEiz5K/PaKd6Qnnfx1TFm2I1FnBqLCl tfiu3Wm1578+nQ+Qv2Nh7BtbuVure4Fyfd6SKSbLeJb879z+rtTtgmThgsdlr88/T3g40ypd e8X1qQ0nTONTnvSe5Nr0vFJ2uuKlRe6Rnrxf1Fjy/5ZxbZ70o2jZkjUySizFGYmGWsxFxYkA fXu+tfMBAAA= X-TM-AS-MML: No Cc: Inki Dae , kyungmin.park@samsung.com, sw0312.kim@samsung.com X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org Errors-To: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org this patch uses __free_page() to deallocate the pages allocated by alloc_page() and the pages doesn't need set_parge_dirty() and mark_page_accessed() because they aren't from page cache so removes them. this patch has a pair with previous patch below, http://www.spinics.net/lists/dri-devel/msg24382.html Changelog v2: remove unnecessary arguments. Changelog v3: fix npages type. - npages can have negative value. Signed-off-by: Inki Dae Signed-off-by: Kyungmin Park --- drivers/gpu/drm/exynos/exynos_drm_gem.c | 21 ++++++--------------- 1 files changed, 6 insertions(+), 15 deletions(-) diff --git a/drivers/gpu/drm/exynos/exynos_drm_gem.c b/drivers/gpu/drm/exynos/exynos_drm_gem.c index dceb69f..3ccda0c 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_gem.c +++ b/drivers/gpu/drm/exynos/exynos_drm_gem.c @@ -126,23 +126,14 @@ fail: } static void exynos_gem_put_pages(struct drm_gem_object *obj, - struct page **pages, - bool dirty, bool accessed) + struct page **pages) { - int i, npages; + int npages; npages = obj->size >> PAGE_SHIFT; - for (i = 0; i < npages; i++) { - if (dirty) - set_page_dirty(pages[i]); - - if (accessed) - mark_page_accessed(pages[i]); - - /* Undo the reference we took when populating the table */ - page_cache_release(pages[i]); - } + while (--npages >= 0) + __free_page(pages[npages]); drm_free_large(pages); } @@ -222,7 +213,7 @@ err1: kfree(buf->sgt); buf->sgt = NULL; err: - exynos_gem_put_pages(obj, pages, true, false); + exynos_gem_put_pages(obj, pages); return ret; } @@ -240,7 +231,7 @@ static void exynos_drm_gem_put_pages(struct drm_gem_object *obj) kfree(buf->sgt); buf->sgt = NULL; - exynos_gem_put_pages(obj, buf->pages, true, false); + exynos_gem_put_pages(obj, buf->pages); buf->pages = NULL; /* add some codes for UNCACHED type here. TODO */