Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp4678154ybi; Mon, 15 Jul 2019 12:54:09 -0700 (PDT) X-Google-Smtp-Source: APXvYqyUolQjyD2qOrsMsp2wCiKvH8sfg0QOh+hg90IXG9Xga8ui7DrDf1lyfiTzR/r1aJlsireH X-Received: by 2002:a17:902:424:: with SMTP id 33mr30345605ple.151.1563220448944; Mon, 15 Jul 2019 12:54:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563220448; cv=none; d=google.com; s=arc-20160816; b=eb3zym0O2S3Q8eMfmLx5dMWprYVC8C9ZZ31INNKBj77vpytiRRpTZS0py24I16TT4G eAG2YQppVPbbiWUkUXm+ymVKOGUc/OxKBMyb+ReG43tRWjVgyv3Jf5R07W/cOhEablCx 5HG2Kq5uZ3rE0aCUXIMGV3uUd9hOC4De4EpQ1PyLQZbDTsqg4/gBNR3AsOAlpbv/ajBx WqO0srmYYj4WWf6ngcIvyl7+ZVrgiQK8zVe5lFYEgcAirgM3LyVgjOpDiRfhIA/3LMMB F2AAJ1j8bO0gLtMe4RqSau4De35oQIRmkHzdnkml5BY/cI3zxI3vuwiqYH4Ldv+5k2VR MtPA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:content-transfer-encoding :content-disposition:mime-version:message-id:subject:cc:to:from:date :dkim-signature; bh=VvTFFsjpspmxJg0Zk+lQCOkMvx372OdaubqDPGmaJoo=; b=ChU4GaG/PQC1RXEjvzTyaR2KfonoepeBLcQOyTiKG+nVf8WTh0KK/Ao0ZkZtOsk11M 0bzxsxQaWNSAOxUBgOc7X1vQEhZMcD3LrdbAxT3F197LQyTcCGx6eiD1i7kC3L6Cy3e+ p/52CbbT74EDMw2lGlBFBpm0gIkA/FuOsLQ+71ojn6YLIaOdiZSGvCrJA8KbFYCIPGy6 z8EO+3P1KFNzj+vjOhwIiV14Ei8ZAD44D8d1jeNj14XHgd/lPb057F44wVSAuP0koEPi AAz5Or/nsAHUQx9U01gIPaGgULR8/eNcLICs+yT9xMOW00F+M40BYIeLdrJBwK/z0PK8 0+Ow== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Y0+6yg5u; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q24si16069953pls.7.2019.07.15.12.53.52; Mon, 15 Jul 2019 12:54:08 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Y0+6yg5u; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731626AbfGOTw6 (ORCPT + 99 others); Mon, 15 Jul 2019 15:52:58 -0400 Received: from mail-pg1-f196.google.com ([209.85.215.196]:44622 "EHLO mail-pg1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729525AbfGOTw6 (ORCPT ); Mon, 15 Jul 2019 15:52:58 -0400 Received: by mail-pg1-f196.google.com with SMTP id i18so8211178pgl.11 for ; Mon, 15 Jul 2019 12:52:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:mime-version:content-disposition :content-transfer-encoding:user-agent; bh=VvTFFsjpspmxJg0Zk+lQCOkMvx372OdaubqDPGmaJoo=; b=Y0+6yg5uqNAPdQD+ah/uXtJodBiOu7qXGUZsamO3dQTNlZJzjg4Ek26PN9sH6cPymb yvR0TfhEiZSxvEWJREY4WRbKyM9hxRYvEyrRK+nFIVTjd5wGPQeM30hJAvFss33qjOr6 a5lf0Z0h0i0GZU8VbvfaF5gPmTNLiJIByg5+vUiVbxaIVScuLtuDWJCmBENGOlV8KHVP myqNj9DcwuUhbVYJHd/itZBOFC97cVLWqm1lHnGNzPoaLmMwYpW6KTiRNUSyzsRHwMI3 QJzx5hp785DtFA36ySOTX7rwRUUC/c5ya6BCZiOXxIALW7dYtFG/We6ISxZhV9/cZeit dtwg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition:content-transfer-encoding:user-agent; bh=VvTFFsjpspmxJg0Zk+lQCOkMvx372OdaubqDPGmaJoo=; b=uoaGCteYa6dFKZaMV6+/tJ/OKO4m/UW6UtNkEFcpl00IYQwpdgujiGXw3UQLt9eHHP gqUAiV0NgAmsycf8tsyyc6r/yWrz/nJ+wXHh5kz6NmcfJZkRpirsETUNn/bRV9V6dWDA I+JhKUnWvTL948Pzsr6rG1ZqVrNsX35smr3PxGLdDh3xWsAWC0X7rbvcmTZbKcdhG1v2 yA5YFv4a/rNLXlyCpMfUTiQenGyUreUZSaUfzJp1SNUqSjYAd7MPSjmsMYtEDX3GItTO 5/Tdp6hyfIS/zBISCMS5kjDTclYF1zwDyCCPw5GjFiCiSnOzFFOFMXz/ls5UjVFbZG3t c1Vg== X-Gm-Message-State: APjAAAWFV6ZJPeEFfvTa4w0XMWXaywMiaVWtf8U/vzXEUp1f14kmkwa4 KCC360NzuNfqwqF9yomYbso= X-Received: by 2002:a17:90a:5288:: with SMTP id w8mr31337291pjh.61.1563220377447; Mon, 15 Jul 2019 12:52:57 -0700 (PDT) Received: from bharath12345-Inspiron-5559 ([103.110.42.33]) by smtp.gmail.com with ESMTPSA id u3sm15869368pjn.5.2019.07.15.12.52.52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 15 Jul 2019 12:52:56 -0700 (PDT) Date: Tue, 16 Jul 2019 01:22:48 +0530 From: Bharath Vedartham To: ira.weiny@intel.com, jhubbard@nvidia.com, gregkh@linuxfoundation.org, Matt.Sickler@daktronics.com, jglisse@redhat.com Cc: devel@driverdev.osuosl.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH] staging: kpc2000: Convert put_page() to put_user_page*() Message-ID: <20190715195248.GA22495@bharath12345-Inspiron-5559> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org There have been issues with get_user_pages and filesystem writeback. The issues are better described in [1]. The solution being proposed wants to keep track of gup_pinned pages which will allow to take furthur steps to coordinate between subsystems using gup. put_user_page() simply calls put_page inside for now. But the implementation will change once all call sites of put_page() are converted. I currently do not have the driver to test. Could I have some suggestions to test this code? The solution is currently implemented in [2] and it would be great if we could apply the patch on top of [2] and run some tests to check if any regressions occur. [1] https://lwn.net/Articles/753027/ [2] https://github.com/johnhubbard/linux/tree/gup_dma_core Cc: Matt Sickler Cc: Greg Kroah-Hartman Cc: J?r?me Glisse Cc: Ira Weiny Cc: John Hubbard Cc: linux-mm@kvack.org Cc: devel@driverdev.osuosl.org Signed-off-by: Bharath Vedartham --- drivers/staging/kpc2000/kpc_dma/fileops.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/drivers/staging/kpc2000/kpc_dma/fileops.c b/drivers/staging/kpc2000/kpc_dma/fileops.c index 6166587..82c70e6 100644 --- a/drivers/staging/kpc2000/kpc_dma/fileops.c +++ b/drivers/staging/kpc2000/kpc_dma/fileops.c @@ -198,9 +198,7 @@ int kpc_dma_transfer(struct dev_private_data *priv, struct kiocb *kcb, unsigned sg_free_table(&acd->sgt); err_dma_map_sg: err_alloc_sg_table: - for (i = 0 ; i < acd->page_count ; i++){ - put_page(acd->user_pages[i]); - } + put_user_pages(acd->user_pages, acd->page_count); err_get_user_pages: kfree(acd->user_pages); err_alloc_userpages: @@ -229,9 +227,7 @@ void transfer_complete_cb(struct aio_cb_data *acd, size_t xfr_count, u32 flags) dma_unmap_sg(&acd->ldev->pldev->dev, acd->sgt.sgl, acd->sgt.nents, acd->ldev->dir); - for (i = 0 ; i < acd->page_count ; i++){ - put_page(acd->user_pages[i]); - } + put_user_pages(acd->user_pages, acd->page_count); sg_free_table(&acd->sgt); -- 1.8.3.1