Received: by 2002:a25:ef43:0:0:0:0:0 with SMTP id w3csp356858ybm; Fri, 29 May 2020 01:47:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxJQxggCxHvKFe3Zc/2rfY4easUwVcctXD6VJKYuu7McqrlwK3hQWN5QR7047/tkEYrG1K+ X-Received: by 2002:a17:906:4d82:: with SMTP id s2mr6441629eju.542.1590742074549; Fri, 29 May 2020 01:47:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590742074; cv=none; d=google.com; s=arc-20160816; b=CWtO10dnPa5KJe3HWTLkovzQOIfTyv6QoMAYIEx20TYa79mfzvxTZXfLrD6VaNQIe5 17YXHOUpmOgCZX5oRdQtVNRbylKxSZpbGFkIWLE6Qz+S389IPvUWG8RZE9NG6OGMRpPO N8bbvQW4GEPeMb0sAA13svmHrV+hQK0H5eGDIiybdr7lLcb59Lkb8kQ853pBPDeeEsts Rp9xtNlk8JbOuP/ABuTurTlbcsX9TeTpVSDvV00b+9IWMYarBa5/KWYPvLYCkEKiYPap I3VTX0iyedIvBO/LgUR69nqk3ZujKah4skipD+wX92LbDIlTaEGXvI0Pg4tslyTAsAdN jBJA== 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 :mime-version:message-id:date:subject:cc:to:from; bh=YJZ6AZpFhdMTjSg3xt2syrJQG9Kn4gqR1ugcbx4KgGM=; b=APF4exKZY52B/EypNavA2k5jjmEl4PT0fIuk3Auk4BKIUVP+vyd3N7358swm3QYnBw nj1QEDBC7Ke8D3+v9oVpMpimwywy3yWB1cuUwFl0fOLe42Xbm7xI+jonT3p74gdc9tI+ Wq9nMjk+ZKFsTjjk4mToZ0R6l1TR7FW8IeaM59v9aa/1WZ5OFJ8xf1feOm8q/u3KxVyQ qQu8J2iciynElYx+RFaNSd1KGJg2DSFUEPNeHief8UzwEaYLihJ0etqCWSCan2WfW3K4 I5t4G3S2XwRxdatHDEwZOcoes+oxB6iVVk/YTyy4j/iK/mHJZxeLsm6hT8gJGWghhybl SmhA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nvidia.com header.s=n1 header.b=epnH81UO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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. [23.128.96.18]) by mx.google.com with ESMTP id u23si2070859ejb.595.2020.05.29.01.47.31; Fri, 29 May 2020 01:47:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@nvidia.com header.s=n1 header.b=epnH81UO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S1726519AbgE2IpR (ORCPT + 99 others); Fri, 29 May 2020 04:45:17 -0400 Received: from hqnvemgate26.nvidia.com ([216.228.121.65]:9464 "EHLO hqnvemgate26.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725681AbgE2IpQ (ORCPT ); Fri, 29 May 2020 04:45:16 -0400 Received: from hqpgpgate102.nvidia.com (Not Verified[216.228.121.13]) by hqnvemgate26.nvidia.com (using TLS: TLSv1.2, DES-CBC3-SHA) id ; Fri, 29 May 2020 01:45:04 -0700 Received: from hqmail.nvidia.com ([172.20.161.6]) by hqpgpgate102.nvidia.com (PGP Universal service); Fri, 29 May 2020 01:45:16 -0700 X-PGP-Universal: processed; by hqpgpgate102.nvidia.com on Fri, 29 May 2020 01:45:16 -0700 Received: from HQMAIL111.nvidia.com (172.20.187.18) by HQMAIL109.nvidia.com (172.20.187.15) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Fri, 29 May 2020 08:45:16 +0000 Received: from hqnvemgw03.nvidia.com (10.124.88.68) by HQMAIL111.nvidia.com (172.20.187.18) with Microsoft SMTP Server (TLS) id 15.0.1473.3 via Frontend Transport; Fri, 29 May 2020 08:45:16 +0000 Received: from sandstorm.nvidia.com (Not Verified[10.2.62.53]) by hqnvemgw03.nvidia.com with Trustwave SEG (v7,5,8,10121) id ; Fri, 29 May 2020 01:45:16 -0700 From: John Hubbard To: Andrew Morton CC: Souptick Joarder , LKML , , John Hubbard , Dan Carpenter , Jan Kara , Vlastimil Babka Subject: [PATCH] mm/gup: documentation fix for pin_user_pages*() APIs Date: Fri, 29 May 2020 01:45:15 -0700 Message-ID: <20200529084515.46259-1-jhubbard@nvidia.com> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 X-NVConfidentiality: public Content-Transfer-Encoding: quoted-printable Content-Type: text/plain DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nvidia.com; s=n1; t=1590741904; bh=YJZ6AZpFhdMTjSg3xt2syrJQG9Kn4gqR1ugcbx4KgGM=; h=X-PGP-Universal:From:To:CC:Subject:Date:Message-ID:X-Mailer: MIME-Version:X-NVConfidentiality:Content-Transfer-Encoding: Content-Type; b=epnH81UON5VVHMciiZrqvpQ2bMB4L++EGy4Shh6SqZ77UhDzeAgjGlBgP1nR7N2se /FZV3hWdEDGdb+OG7S27dN+YJnE2DC8zMzKE5IylPGrSS+DrFhHuErTFvRD3S3+mOu hjgMT/lkDWJvFZPrN9gdEriE/o8/zSJpxdyFZKbJPJtzEQduNDubhFZa0Ylol3pHOJ mDUX6+nT+odFDhF4n0tt2AEqv4ApLKnyVH9P+sLw1MA3+QfCnFb8vOiAZEUEJ91JPM L9DPxbLFZoc3+Jg6AJ2o29m4p95HPdcuXds79QLaEMcnATya+OBrTkADyp9Ns2mTdi P7yu4KUsp3KxQ== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org All of the pin_user_pages*() API calls will cause pages to be dma-pinned. As such, they are all suitable for either DMA, RDMA, and/or Direct IO. The documentation should say so, but it was instead saying that three of the API calls were only suitable for Direct IO. This was discovered when a reviewer wondered why an API call that specifically recommended against Case 2 (DMA/RDMA) was being used in a DMA situation [1]. Fix this by simply deleting those claims. The gup.c comments already refer to the more extensive Documentation/core-api/pin_user_pages.rst, which does have the correct guidance. So let's just write it once, there. [1] https://lore.kernel.org/r/20200529074658.GM30374@kadam Cc: Dan Carpenter Cc: Jan Kara Cc: Vlastimil Babka Signed-off-by: John Hubbard --- Hi, This applies on top of linux-next, in order to avoid a conflict with Mauro Carvalho Chehab's fix to the lines right above these. thanks, John Hubbard NVIDIA mm/gup.c | 9 --------- 1 file changed, 9 deletions(-) diff --git a/mm/gup.c b/mm/gup.c index ee039d421746d..311d0f11b35e6 100644 --- a/mm/gup.c +++ b/mm/gup.c @@ -2875,9 +2875,6 @@ EXPORT_SYMBOL_GPL(get_user_pages_fast); * * FOLL_PIN means that the pages must be released via unpin_user_page(). P= lease * see Documentation/core-api/pin_user_pages.rst for further details. - * - * This is intended for Case 1 (DIO) in Documentation/core-api/pin_user_pa= ges.rst. It - * is NOT intended for Case 2 (RDMA: long-term pins). */ int pin_user_pages_fast(unsigned long start, int nr_pages, unsigned int gup_flags, struct page **pages) @@ -2951,9 +2948,6 @@ EXPORT_SYMBOL_GPL(pin_user_pages_fast_only); * * FOLL_PIN means that the pages must be released via unpin_user_page(). P= lease * see Documentation/core-api/pin_user_pages.rst for details. - * - * This is intended for Case 1 (DIO) in Documentation/core-api/pin_user_pa= ges.rst. It - * is NOT intended for Case 2 (RDMA: long-term pins). */ long pin_user_pages_remote(struct task_struct *tsk, struct mm_struct *mm, unsigned long start, unsigned long nr_pages, @@ -2987,9 +2981,6 @@ EXPORT_SYMBOL(pin_user_pages_remote); * * FOLL_PIN means that the pages must be released via unpin_user_page(). P= lease * see Documentation/core-api/pin_user_pages.rst for details. - * - * This is intended for Case 1 (DIO) in Documentation/core-api/pin_user_pa= ges.rst. It - * is NOT intended for Case 2 (RDMA: long-term pins). */ long pin_user_pages(unsigned long start, unsigned long nr_pages, unsigned int gup_flags, struct page **pages, --=20 2.26.2