Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp4794659ybi; Mon, 15 Jul 2019 15:07:00 -0700 (PDT) X-Google-Smtp-Source: APXvYqx88gdgY3+oe5ZMxr4hRWINYPb/+F1nDRdUY6vvxDDKIw3iUXzosZ3/kLZgoGSQn5N/Lf91 X-Received: by 2002:a17:90a:d14a:: with SMTP id t10mr32010189pjw.85.1563228420735; Mon, 15 Jul 2019 15:07:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563228420; cv=none; d=google.com; s=arc-20160816; b=N+FG6addGuDH9394i8ONCs2E5egqgTV5gOIl5mJmROX/dGcBYkH2ZnT0bctRuw+JxP 1wHsQguelXaoWADFPG5X20VGxm27o9WTN8zBvgCXvH4hq5C1eN8eV710cdxt3CEmX2Tq XKH9gKWoLRPqDIAe/ZLZZ8Cjdx949wN1crmRlSBBHmIncVDZ6CUUtsQW/MZxnjEfcpJU YgczLjgx+ph4qQq6DsHlEa9cIHxxaBMcQ5C2ni77B98tJyjdgaQDN0ZzChSyGiOFR4Sv gMskmpmcj2+h/aMS+aQCGLy1Fkm/2z66jxfmg1YgkTb52OzePDJbosrH61uSxwrsjf+C hsMQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:dkim-signature:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:references:cc:to:from:subject; bh=7F+lrioE5/qbngjXwfnCWvzn3KWHU4WQV3R2Uk1MWm8=; b=UmIGm5PvIJiVU85cleyAhyOT/dnNiMH9NDtiPCg36ylK/DNJw3HTkVk0tY7+Q7FJmp LL+cY/Eg3gzlUhen1s0J4eJgdFxB337+F8fQVb+rfS/1nmdML442/laKA3Y6nHyTQqwm DXgNSDlsAWGMGcVc5AcwTv7tC4jx/we25L40E2keNPIwgo3vkxrzlu4NdXiXyvjcCzUW VUZ5u3eh8KZNL15kOs3Nhhs6FTYxRE4aaWvMKx5ag6CxahzRwjXZ69FgCNDP4ar8iBra o2d2iCUrmnisMhCbBaT0T8jdGGzDSTCrSdaCR7llwtYKDsmQwIJWdnPBaNgS6kdFwiZC iPFg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nvidia.com header.s=n1 header.b=THHxjtsg; 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=NONE dis=NONE) header.from=nvidia.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n20si16464838plp.395.2019.07.15.15.06.44; Mon, 15 Jul 2019 15:07:00 -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=@nvidia.com header.s=n1 header.b=THHxjtsg; 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=NONE dis=NONE) header.from=nvidia.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732919AbfGOWEO (ORCPT + 99 others); Mon, 15 Jul 2019 18:04:14 -0400 Received: from hqemgate16.nvidia.com ([216.228.121.65]:4949 "EHLO hqemgate16.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730647AbfGOWEN (ORCPT ); Mon, 15 Jul 2019 18:04:13 -0400 Received: from hqpgpgate101.nvidia.com (Not Verified[216.228.121.13]) by hqemgate16.nvidia.com (using TLS: TLSv1.2, DES-CBC3-SHA) id ; Mon, 15 Jul 2019 15:04:10 -0700 Received: from hqmail.nvidia.com ([172.20.161.6]) by hqpgpgate101.nvidia.com (PGP Universal service); Mon, 15 Jul 2019 15:04:12 -0700 X-PGP-Universal: processed; by hqpgpgate101.nvidia.com on Mon, 15 Jul 2019 15:04:12 -0700 Received: from [10.110.48.28] (10.124.1.5) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Mon, 15 Jul 2019 22:04:11 +0000 Subject: Re: [PATCH] staging: kpc2000: Convert put_page() to put_user_page*() From: John Hubbard To: Matt Sickler , Bharath Vedartham , "ira.weiny@intel.com" , "gregkh@linuxfoundation.org" , "jglisse@redhat.com" CC: "devel@driverdev.osuosl.org" , "linux-mm@kvack.org" , "linux-kernel@vger.kernel.org" References: <20190715195248.GA22495@bharath12345-Inspiron-5559> <2604fcd1-4829-d77e-9f7c-d4b731782ff9@nvidia.com> <82441723-f30e-5811-ab1c-dd9a4993d7df@nvidia.com> X-Nvconfidentiality: public Message-ID: <2278975b-6ea5-5417-eb0c-9d7debdf68ce@nvidia.com> Date: Mon, 15 Jul 2019 15:04:11 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.2 MIME-Version: 1.0 In-Reply-To: <82441723-f30e-5811-ab1c-dd9a4993d7df@nvidia.com> X-Originating-IP: [10.124.1.5] X-ClientProxiedBy: HQMAIL108.nvidia.com (172.18.146.13) To HQMAIL107.nvidia.com (172.20.187.13) Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nvidia.com; s=n1; t=1563228250; bh=7F+lrioE5/qbngjXwfnCWvzn3KWHU4WQV3R2Uk1MWm8=; h=X-PGP-Universal:Subject:From:To:CC:References:X-Nvconfidentiality: Message-ID:Date:User-Agent:MIME-Version:In-Reply-To: X-Originating-IP:X-ClientProxiedBy:Content-Type:Content-Language: Content-Transfer-Encoding; b=THHxjtsgf8LosY3HKog1RQ/BDV+9F/bTT64YX2I6T2AHWxoBAi0RLmklmhwM3ewuk OX2zlNOoGNrmox7hKvIBOIFmnJslo5CUp7RmxvNgFJCavNuCywtZwx9qel9OqBItAE P+rc1zZKXVbY8PZlPHkgV6xctZUI4ye2lqS+p5KgZRSDRw5AD1lZR4UfhS+ZKvl/jS hMQKOx3zzmXt5XuNUXh7mBFZcc4Z8kxcr7xPK49Hx+ate4QIV3mr/eky3l1SzDrtKS KSOMqk9cAXNlVUBhj/Q6LAOAOQVrgKk0xs5pROzdtxNCjzIBEvMLG7MeGOuyRaGQVd RMPff+4MqyInQ== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 7/15/19 3:01 PM, John Hubbard wrote: > On 7/15/19 2:47 PM, Matt Sickler wrote: ... > I agree: the PageReserved check looks unnecessary here, from my outside-the-kpc_2000-team > perspective, anyway. Assuming that your analysis above is correct, you could collapse that > whole think into just: > > @@ -211,17 +209,8 @@ void transfer_complete_cb(struct aio_cb_data *acd, size_t xfr_count, u32 flags) > BUG_ON(acd->ldev == NULL); > BUG_ON(acd->ldev->pldev == NULL); > > - for (i = 0 ; i < acd->page_count ; i++) { > - if (!PageReserved(acd->user_pages[i])) { > - set_page_dirty(acd->user_pages[i]); > - } > - } > - > 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_dirty(&acd->user_pages[i], acd->page_count); Ahem, I typed too quickly. :) Please make that: put_user_pages_dirty(acd->user_pages, acd->page_count); thanks, -- John Hubbard NVIDIA