From patchwork Tue Nov 1 19:43:37 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lorenzo Stoakes X-Patchwork-Id: 9408363 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 4FD3F60585 for ; Wed, 2 Nov 2016 00:34:10 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 40AB929BED for ; Wed, 2 Nov 2016 00:34:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 33B3E29C08; Wed, 2 Nov 2016 00:34:10 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id E128829BED for ; Wed, 2 Nov 2016 00:34:09 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C64C56E2D2; Wed, 2 Nov 2016 00:34:04 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wm0-x241.google.com (mail-wm0-x241.google.com [IPv6:2a00:1450:400c:c09::241]) by gabe.freedesktop.org (Postfix) with ESMTPS id 7D4416E408 for ; Tue, 1 Nov 2016 19:43:41 +0000 (UTC) Received: by mail-wm0-x241.google.com with SMTP id u144so4897562wmu.0 for ; Tue, 01 Nov 2016 12:43:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=wHDmpJL9YnmY4Ye6jr0lqS9c7DL6ABJKR9kiEmXvmOQ=; b=KctGKq/bsJsPUUYzzifEjD+zJcFTyaa2NEOHkhG5DDiOQbwpVrkQHqseEo9k44kSBX jhhq31gatnQFOEZuS6/he2XF+b/kv3iN86XfeoAsBWE5wGpsFm5Apva20/++3FdiSNwx uTP9Xpj72Us9EUcCt0AAUI3ZAR+cri2dsG3Qz8Rmb6qNTMI9DeHopjOUTsJqsBaH1CF6 OqH/vzQkshHw10DBMAvYH74hTxqPTgPMIKymFugNAyXlfBZbrZUYrhF91b1PGrgqlhYL ggNFODZetCCTQfi4qVepmq16Re/wwVcUZ6yu+3D04iXa3FF+dApxgP/VD8zW+UALl/y7 AG3g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=wHDmpJL9YnmY4Ye6jr0lqS9c7DL6ABJKR9kiEmXvmOQ=; b=jIsMQ56geWDxV17ghGNlPB/IagwuNGp+usTeFzPWDYHnJEO2/e/3w8tjc6QpSRngIK k8NBFd35MhYjTSeNnVtqSq4W5Fe9WOuz8V+Ktit7mpMb0K4bw0wfF4PFRmd1wuALBMLK 13qbsDZOHFBpZLI4J2qKXd/CUEzZcz9v4DTgflYEP1fUUDFVIqmOqlYUeevhqSPAftBD BKCFi/jg5zz2WKOE6ZoLcVTo2h4ZnftpEAz3/g5RLfnbDNTjcPOWeWdM6npcGpAnGRMN y48WaCp4H+/Qof4tZXartY5uo+1ShC2iWHRaxNbruBZatMQEBuX6Z9AIN+lD52rIJc9Y 88eg== X-Gm-Message-State: ABUngvdPREbhM5ZDn2yCoJT2TtdQZyA7AJ1ennjSK1RykwD89XeM7iKbZKWtoDPcWO2KZg== X-Received: by 10.194.246.169 with SMTP id xx9mr445648wjc.76.1478029420127; Tue, 01 Nov 2016 12:43:40 -0700 (PDT) Received: from localhost (cpc94060-newt37-2-0-cust185.19-3.cable.virginm.net. [92.234.204.186]) by smtp.gmail.com with ESMTPSA id g142sm32035464wmd.2.2016.11.01.12.43.38 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 01 Nov 2016 12:43:38 -0700 (PDT) From: Lorenzo Stoakes To: linux-mm@kvack.org Subject: [PATCH] drm/via: use get_user_pages_unlocked() Date: Tue, 1 Nov 2016 19:43:37 +0000 Message-Id: <20161101194337.24015-1-lstoakes@gmail.com> X-Mailer: git-send-email 2.10.2 X-Mailman-Approved-At: Wed, 02 Nov 2016 00:34:04 +0000 Cc: Lorenzo Stoakes , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, Michal Hocko , Paolo Bonzini X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP Moving from get_user_pages() to get_user_pages_unlocked() simplifies the code and takes advantage of VM_FAULT_RETRY functionality when faulting in pages. Signed-off-by: Lorenzo Stoakes --- drivers/gpu/drm/via/via_dmablit.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/via/via_dmablit.c b/drivers/gpu/drm/via/via_dmablit.c index 1a3ad76..98aae98 100644 --- a/drivers/gpu/drm/via/via_dmablit.c +++ b/drivers/gpu/drm/via/via_dmablit.c @@ -238,13 +238,9 @@ via_lock_all_dma_pages(drm_via_sg_info_t *vsg, drm_via_dmablit_t *xfer) vsg->pages = vzalloc(sizeof(struct page *) * vsg->num_pages); if (NULL == vsg->pages) return -ENOMEM; - down_read(¤t->mm->mmap_sem); - ret = get_user_pages((unsigned long)xfer->mem_addr, - vsg->num_pages, - (vsg->direction == DMA_FROM_DEVICE) ? FOLL_WRITE : 0, - vsg->pages, NULL); - - up_read(¤t->mm->mmap_sem); + ret = get_user_pages_unlocked((unsigned long)xfer->mem_addr, + vsg->num_pages, vsg->pages, + (vsg->direction == DMA_FROM_DEVICE) ? FOLL_WRITE : 0); if (ret != vsg->num_pages) { if (ret < 0) return ret;