From patchwork Sun Aug 18 19:38:54 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Bharath Vedartham X-Patchwork-Id: 11099899 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 261DC1399 for ; Sun, 18 Aug 2019 19:39:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1828D2842E for ; Sun, 18 Aug 2019 19:39:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 098A928590; Sun, 18 Aug 2019 19:39:30 +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=-2.7 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 87CE42842E for ; Sun, 18 Aug 2019 19:39:29 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B66AA6B000C; Sun, 18 Aug 2019 15:39:28 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id B17356B000D; Sun, 18 Aug 2019 15:39:28 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A060D6B000E; Sun, 18 Aug 2019 15:39:28 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 7E3296B000C for ; Sun, 18 Aug 2019 15:39:28 -0400 (EDT) Received: from smtpin24.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with SMTP id 27FE8181AC9AE for ; Sun, 18 Aug 2019 19:39:28 +0000 (UTC) X-FDA: 75836562816.24.brush99_1867f08ce8945 X-HE-Tag: brush99_1867f08ce8945 X-Filterd-Recvd-Size: 4765 Received: from mail-pg1-f194.google.com (mail-pg1-f194.google.com [209.85.215.194]) by imf34.hostedemail.com (Postfix) with ESMTP for ; Sun, 18 Aug 2019 19:39:27 +0000 (UTC) Received: by mail-pg1-f194.google.com with SMTP id p3so5622015pgb.9 for ; Sun, 18 Aug 2019 12:39:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=tJjwWl4XQTgcmRcDEc+l30pX8XFo75tSFumPFai+auM=; b=UmY6BiMKjLfJtTbMPr2YL48+gSi6VOnzYOGmB49byG2y+gNWR+LHccMEOjU3uV6rzU vs47bj1Wda0bHM3M+0tVfVnkUn5JeYWMuWoPyJiWhssB5oqJi3lvuowfQ5qRiqzyKByF 037PGyd0fWngnsSpBjBk4owPIqAYkSIl8DR9T1VCkYVvWLNNd/4SLogCYlENV5fXi/GI qnVGwINwsEAhgY5m/Vu9VC+dsD3inyTVFkMorxi2MckhRHGG3v9Saij0nBgVh07rb5wE OqTFjDg2ifQD/yQ8Uj40xNeOboRbiBcdRommtkDta5yDTw5vCbifx/WTDfU1ckZxVYSw PlKA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=tJjwWl4XQTgcmRcDEc+l30pX8XFo75tSFumPFai+auM=; b=WSmYnBIQaMifijo5vLKEdmAAz3QY3FZFtcCR7oJL3Dse35J/QaMdZBiNtcpznxWitg mu9zagbliiCM/uMwHAsQ9iDZBfCEjLR13/YGHEpcfascixE6CHpyWivD3FOVWtgmwiWI DdY4si/zwcSRjk87rqzj3tDKMDx4F8rtQ5tZ0xwQUZ3ykCLuJRZTpWsXe1/2fQ+P+KO8 mX4x3CYx7ZWglEfYRvrqltmfINjAwILs6eA7OfOWxSM0IVNR2UogXclCP+mbl9wDXZhB mrgRQHVm8/kZRbXjsA6lf2q+ekGmNDEeCBK+oI1iwGwfleMazWqu4saj9+7Mub3yL0wG DD2g== X-Gm-Message-State: APjAAAXDYlsxoi8Of+ov+AoDqYxiWtLmp5uHgRgnh9TEEUvyMsCRz1G1 nrUDCziqMvhWnyvYkxTIi3s= X-Google-Smtp-Source: APXvYqx7tVVfV+B2SMb5KcGTV0Iw93mnZu+rvdEXioARTktPChwDBCq20S1nC96AwKkuvChntzXpWw== X-Received: by 2002:a63:4e05:: with SMTP id c5mr16328693pgb.82.1566157166340; Sun, 18 Aug 2019 12:39:26 -0700 (PDT) Received: from bharath12345-Inspiron-5559 ([103.110.42.36]) by smtp.gmail.com with ESMTPSA id k5sm11318890pgo.45.2019.08.18.12.39.25 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 18 Aug 2019 12:39:25 -0700 (PDT) From: Bharath Vedartham To: sivanich@sgi.com, jhubbard@nvidia.com Cc: jglisse@redhat.com, ira.weiny@intel.com, gregkh@linuxfoundation.org, arnd@arndb.de, william.kucharski@oracle.com, hch@lst.de, inux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-kernel-mentees@lists.linuxfoundation.org, Bharath Vedartham , linux-kernel@vger.kernel.org Subject: [Linux-kernel-mentees][PATCH v6 1/2] sgi-gru: Convert put_page() to put_user_page*() Date: Mon, 19 Aug 2019 01:08:54 +0530 Message-Id: <1566157135-9423-2-git-send-email-linux.bhar@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1566157135-9423-1-git-send-email-linux.bhar@gmail.com> References: <1566157135-9423-1-git-send-email-linux.bhar@gmail.com> MIME-Version: 1.0 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: X-Virus-Scanned: ClamAV using ClamSMTP For pages that were retained via get_user_pages*(), release those pages via the new put_user_page*() routines, instead of via put_page() or release_pages(). This is part a tree-wide conversion, as described in commit fc1d8e7cca2d ("mm: introduce put_user_page*(), placeholder versions"). Cc: Ira Weiny Cc: John Hubbard Cc: Jérôme Glisse Cc: Greg Kroah-Hartman Cc: Dimitri Sivanich Cc: Arnd Bergmann Cc: William Kucharski Cc: Christoph Hellwig Cc: linux-kernel@vger.kernel.org Cc: linux-mm@kvack.org Cc: linux-kernel-mentees@lists.linuxfoundation.org Reviewed-by: Ira Weiny Reviewed-by: John Hubbard Reviewed-by: William Kucharski Signed-off-by: Bharath Vedartham Reviewed-by: Dimitri Sivanich --- drivers/misc/sgi-gru/grufault.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/misc/sgi-gru/grufault.c b/drivers/misc/sgi-gru/grufault.c index 4b713a8..61b3447 100644 --- a/drivers/misc/sgi-gru/grufault.c +++ b/drivers/misc/sgi-gru/grufault.c @@ -188,7 +188,7 @@ static int non_atomic_pte_lookup(struct vm_area_struct *vma, if (get_user_pages(vaddr, 1, write ? FOLL_WRITE : 0, &page, NULL) <= 0) return -EFAULT; *paddr = page_to_phys(page); - put_page(page); + put_user_page(page); return 0; } From patchwork Sun Aug 18 19:38:55 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Bharath Vedartham X-Patchwork-Id: 11099901 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E64341399 for ; Sun, 18 Aug 2019 19:39:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D46EF2842E for ; Sun, 18 Aug 2019 19:39:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C592228590; Sun, 18 Aug 2019 19:39:34 +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=-2.7 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 58A702842E for ; Sun, 18 Aug 2019 19:39:34 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 832D66B000E; Sun, 18 Aug 2019 15:39:33 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 7E2946B0010; Sun, 18 Aug 2019 15:39:33 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6F8D46B0266; Sun, 18 Aug 2019 15:39:33 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0053.hostedemail.com [216.40.44.53]) by kanga.kvack.org (Postfix) with ESMTP id 4EB946B000E for ; Sun, 18 Aug 2019 15:39:33 -0400 (EDT) Received: from smtpin09.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with SMTP id B19F5180AD801 for ; Sun, 18 Aug 2019 19:39:32 +0000 (UTC) X-FDA: 75836562984.09.wave88_191597efff963 X-HE-Tag: wave88_191597efff963 X-Filterd-Recvd-Size: 5245 Received: from mail-pf1-f196.google.com (mail-pf1-f196.google.com [209.85.210.196]) by imf10.hostedemail.com (Postfix) with ESMTP for ; Sun, 18 Aug 2019 19:39:32 +0000 (UTC) Received: by mail-pf1-f196.google.com with SMTP id o70so5843380pfg.5 for ; Sun, 18 Aug 2019 12:39:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=a8+L6poDC20GcQQ9CfyPX7El391DODwhknO5Uu2z/P8=; b=GOpi23ZWVr64SH0Vu9SJdU+hs6VoZUy5QE9KBREpVVzD4b07FglIvvvaPDBy5dC7J/ nKMMCD6/copl5kczMBMnNguX0lSHQi9eiRApNpD2wGvk6JmFxUmDf9Q90Di8NIo2D2Gh CyTQttAEKWbh9IGkWTLdqLZeCmLoYDB2cUJIzJ93dXeEUuRDkcLR/GkedO8UfVSVQjRQ nCmHe17Xiu+VdGtHoOAI+Vt57aooSYAYtU4XpLEaXH22qig6FZP9soYjcT6OvVEtfe8Z hmrGZ+T4qwyuwhsAqcmH4C7xXSYyYZiuJIVnBXUSlfPQ0CtTBYLKSzlXVQmmj22EQfwK sx9Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=a8+L6poDC20GcQQ9CfyPX7El391DODwhknO5Uu2z/P8=; b=dFWP/lx2WV6jLW/EIydTS076X23L4QVdl6SOymEtXLgpaimZOqY8EQbgiNps55VGpg tzktsNjW4+VfhGRxG+jITNyEPMQUocfrxidTX7NQLCNmIjhZw6re0w0RlYGJggP8cDeI aPP92dlww0hCGv7/ngP8VZ3FaGcaixQlDYnm0kfVNPtmK6bpO2wT1ej8znyqWzo90nI5 FPb4YBsIPAg9kaoUn4M60Y/y5/fOmJOYLl8M1xkyLsQHdUOxvQnzp2vPayLyZwyGQTX3 VyMJOj2Pq6h+BRzeyS26XMhWJVEYjwgEkRgyCrhBtRO4JU9uJzhGMfKEOar/MqhJkA0U 348g== X-Gm-Message-State: APjAAAWMBsxBfPH4YlY6KaeEoltqUFS1x7A5dnrEjru4Ix/59ok4aWXP 1MLiXEo6yaHR7eDMePTK740= X-Google-Smtp-Source: APXvYqxYIXFqhwAQK3mpk0fNnX3nZwkcmz/afOcd6XTFDlWHsIBUqj1+EURmOIXoL7iiX1TsTdbPFA== X-Received: by 2002:aa7:9a12:: with SMTP id w18mr21671346pfj.110.1566157171532; Sun, 18 Aug 2019 12:39:31 -0700 (PDT) Received: from bharath12345-Inspiron-5559 ([103.110.42.34]) by smtp.gmail.com with ESMTPSA id m9sm24492787pgr.24.2019.08.18.12.39.30 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 18 Aug 2019 12:39:31 -0700 (PDT) From: Bharath Vedartham To: sivanich@sgi.com, jhubbard@nvidia.com Cc: jglisse@redhat.com, ira.weiny@intel.com, gregkh@linuxfoundation.org, arnd@arndb.de, william.kucharski@oracle.com, hch@lst.de, inux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-kernel-mentees@lists.linuxfoundation.org, Bharath Vedartham , linux-kernel@vger.kernel.org Subject: [Linux-kernel-mentees][PATCH 2/2] sgi-gru: Remove uneccessary ifdef for CONFIG_HUGETLB_PAGE Date: Mon, 19 Aug 2019 01:08:55 +0530 Message-Id: <1566157135-9423-3-git-send-email-linux.bhar@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1566157135-9423-1-git-send-email-linux.bhar@gmail.com> References: <1566157135-9423-1-git-send-email-linux.bhar@gmail.com> MIME-Version: 1.0 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: X-Virus-Scanned: ClamAV using ClamSMTP is_vm_hugetlb_page will always return false if CONFIG_HUGETLB_PAGE is not set. Cc: Ira Weiny Cc: John Hubbard Cc: Jérôme Glisse Cc: Greg Kroah-Hartman Cc: Dimitri Sivanich Cc: Arnd Bergmann Cc: William Kucharski Cc: Christoph Hellwig Cc: linux-kernel@vger.kernel.org Cc: linux-mm@kvack.org Cc: linux-kernel-mentees@lists.linuxfoundation.org Reviewed-by: Ira Weiny Reviewed-by: John Hubbard Reviewed-by: William Kucharski Signed-off-by: Bharath Vedartham Reviewed-by: Dimitri Sivanich --- drivers/misc/sgi-gru/grufault.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/drivers/misc/sgi-gru/grufault.c b/drivers/misc/sgi-gru/grufault.c index 61b3447..bce47af 100644 --- a/drivers/misc/sgi-gru/grufault.c +++ b/drivers/misc/sgi-gru/grufault.c @@ -180,11 +180,11 @@ static int non_atomic_pte_lookup(struct vm_area_struct *vma, { struct page *page; -#ifdef CONFIG_HUGETLB_PAGE - *pageshift = is_vm_hugetlb_page(vma) ? HPAGE_SHIFT : PAGE_SHIFT; -#else - *pageshift = PAGE_SHIFT; -#endif + if (unlikely(is_vm_hugetlb_page(vma))) + *pageshift = HPAGE_SHIFT; + else + *pageshift = PAGE_SHIFT; + if (get_user_pages(vaddr, 1, write ? FOLL_WRITE : 0, &page, NULL) <= 0) return -EFAULT; *paddr = page_to_phys(page); @@ -238,11 +238,12 @@ static int atomic_pte_lookup(struct vm_area_struct *vma, unsigned long vaddr, return 1; *paddr = pte_pfn(pte) << PAGE_SHIFT; -#ifdef CONFIG_HUGETLB_PAGE - *pageshift = is_vm_hugetlb_page(vma) ? HPAGE_SHIFT : PAGE_SHIFT; -#else - *pageshift = PAGE_SHIFT; -#endif + + if (unlikely(is_vm_hugetlb_page(vma))) + *pageshift = HPAGE_SHIFT; + else + *pageshift = PAGE_SHIFT; + return 0; err: