From patchwork Tue Jun 4 11:48:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kefeng Wang X-Patchwork-Id: 13685095 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id ED832C25B7E for ; Tue, 4 Jun 2024 11:49:09 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D21516B00B8; Tue, 4 Jun 2024 07:49:06 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id A57EF6B00B9; Tue, 4 Jun 2024 07:49:06 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 863146B00B7; Tue, 4 Jun 2024 07:49:06 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 4A11E6B00B8 for ; Tue, 4 Jun 2024 07:49:06 -0400 (EDT) Received: from smtpin01.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id D2A201A0655 for ; Tue, 4 Jun 2024 11:49:05 +0000 (UTC) X-FDA: 82193035050.01.E85FCA7 Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by imf06.hostedemail.com (Postfix) with ESMTP id DCDAC180009 for ; Tue, 4 Jun 2024 11:49:02 +0000 (UTC) Authentication-Results: imf06.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf06.hostedemail.com: domain of wangkefeng.wang@huawei.com designates 45.249.212.189 as permitted sender) smtp.mailfrom=wangkefeng.wang@huawei.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1717501744; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=oQcT3TSLznIifoSeUGxF3eg7iarZ5vTOkHox/JvFLF0=; b=gbHjDU3ZqTdLQ0KNgNOR0H7hEdZwbo92jMkLSgR5NEkGczNlAmf1Mv/T2yUEBn0KiG3hUN Thme5kN5MtDH2KQ1RuooZi2Dn/M7nmLmYLrT2sHOXG94/cYzMMIQC3pfD8clmAIl3tRjs8 Puq24zZyESQYfGAeGFLz3OQoVCid6oQ= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1717501744; a=rsa-sha256; cv=none; b=Gm/5j1fALMQzSO5P2W2p2W9uuw9QGd+0v/e4rhBgGtqiudusdY0OTKPPZy41Xi5bk1CZ4r jySSvPTVIuwiJ6ntTC1h1MSttFLZSPk9dy/ZD0SBII6VY+ANfrHB9YUox8x1I/iQ+a4rtK Vw4nk6UwSS0rnwYP+rFh1zg80J4iyLY= ARC-Authentication-Results: i=1; imf06.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf06.hostedemail.com: domain of wangkefeng.wang@huawei.com designates 45.249.212.189 as permitted sender) smtp.mailfrom=wangkefeng.wang@huawei.com Received: from mail.maildlp.com (unknown [172.19.88.194]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4Vtpgp6ScRzPkWS; Tue, 4 Jun 2024 19:45:42 +0800 (CST) Received: from dggpemm100001.china.huawei.com (unknown [7.185.36.93]) by mail.maildlp.com (Postfix) with ESMTPS id 450FE140FD3; Tue, 4 Jun 2024 19:48:59 +0800 (CST) Received: from localhost.localdomain (10.175.112.125) by dggpemm100001.china.huawei.com (7.185.36.93) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.39; Tue, 4 Jun 2024 19:48:58 +0800 From: Kefeng Wang To: Andrew Morton CC: Helge Deller , Daniel Vetter , David Hildenbrand , Matthew Wilcox , , Jonathan Corbet , Kefeng Wang Subject: [PATCH 2/4] mm: remove page_maybe_dma_pinned() Date: Tue, 4 Jun 2024 19:48:20 +0800 Message-ID: <20240604114822.2089819-3-wangkefeng.wang@huawei.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20240604114822.2089819-1-wangkefeng.wang@huawei.com> References: <20240604114822.2089819-1-wangkefeng.wang@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.112.125] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To dggpemm100001.china.huawei.com (7.185.36.93) X-Stat-Signature: zc5w59hukby5kngidj86srtjghnsow4a X-Rspamd-Queue-Id: DCDAC180009 X-Rspam-User: X-Rspamd-Server: rspam01 X-HE-Tag: 1717501742-648379 X-HE-Meta: U2FsdGVkX1++HxEiFtTulDYzM+LDlq4liiXOJ0V02OcfYBmfT++FnStM+xDXaAERBSFoguMkrdIyJeUjhuHG/14lvAb8gHC6rsC89cSicJPKytdf8NTkWZAWc7HetdQk3hMA9GdtYF+BpDGh53A/vGyO93anpsht86nT5HEbFPd3U0IFyUhC/zAd9xcKF813qtn9467O+h2oY8Hpxvs7yr9dShXTThhCfGVPt0yXsJUpVpmakYlcb1OOv6tFfUbYkB0m88mCsfTWudBKBg+/4D4L5xQD2yrhjEzqBvCsHb2EI3btV5hGqoBetp+HdfqvGR40X+6l2o+TwTW8PozVwfdcRtuFZsX3deFNUzRFm3z42LXpSvdHXniY8immgvstxuRY94D7J78o5NqONBDxuPgCdIwnB50BtPu7bSzE/4Ur+uCBS7m/CvQ+CyTbtYW3bftqFMKsYviiCxtZ2fgJads2k+v7SSDSP3DH+Q7YkPEQpQkwdSBwtJwfHpoUaFfIVFOnTF1T80HYui02Jme6XmPBrnFE+tyWmb0WyYaKFLO1vhr8lUwe07v+yRqg4/WsY+nwfVb33OJ7x9RCAtP2sPcjDQm5JaOd4XW4o8Kdb/FFT1zbG7Nm5rQM5ro0m1OlzalWlq8/Ze2rxWGlJz4q5gYLaeIx2bZAvZlS+ePRDNsP6krqhfz/w7YnS1OvHUaPxvltk3ux1Gj71yc0B3C9wJY/7jV6UAe7T+B7OqcJwq4l5a/P67YIQ7K4LM/Eklb2HAtqAiXEffcORylid/R6GHofkTVjqO208lNw5Ind+6lA+v7Yyvwj2VJNqF9/NnT8liluvt6qcKZW4Q9Z2DXBiKikmt3VkW2WmHl5dRZ4C9V69wi3Rk0lcHkWFGD1OeMrvJlgCd9ZHKp2chi5tNGr9ME3jgC5J5bgv0YMrOz0eRivIWT14EF2aWk4jgd9D2/cugwSOkZ7FClyQMSoCBY LViWwHPt GHelXAiWsLgetqc2ycg3QcyQfDGueT58d5xuE6SRpn74M71ofh3Si17U/FVcrhDlvLkCdfax94fK0VzaYoBiFdqHJYFaWXh9b22LCQkLXhlPmDmQz4HUukf54DETzwEOskMuenVnJsPTvGq96/gaHzc1SRQwLqKXUk2eqmexUHXoroYLzGFXFWnJIZV7B+yBYuxom 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: List-Subscribe: List-Unsubscribe: After the last user of page_maybe_dma_pinned() is converted to folio_maybe_dma_pinned(), remove page_maybe_dma_pinned() and update the document and comment. Signed-off-by: Kefeng Wang --- Documentation/core-api/pin_user_pages.rst | 10 +++++----- include/linux/mm.h | 9 ++------- 2 files changed, 7 insertions(+), 12 deletions(-) diff --git a/Documentation/core-api/pin_user_pages.rst b/Documentation/core-api/pin_user_pages.rst index 6b5f7e6e7155..532ba8e8381b 100644 --- a/Documentation/core-api/pin_user_pages.rst +++ b/Documentation/core-api/pin_user_pages.rst @@ -196,20 +196,20 @@ INCORRECT (uses FOLL_GET calls): write to the data within the pages put_page() -page_maybe_dma_pinned(): the whole point of pinning +folio_maybe_dma_pinned(): the whole point of pinning =================================================== -The whole point of marking pages as "DMA-pinned" or "gup-pinned" is to be able -to query, "is this page DMA-pinned?" That allows code such as page_mkclean() +The whole point of marking folios as "DMA-pinned" or "gup-pinned" is to be able +to query, "is this folio DMA-pinned?" That allows code such as page_mkclean() (and file system writeback code in general) to make informed decisions about -what to do when a page cannot be unmapped due to such pins. +what to do when a folio cannot be unmapped due to such pins. What to do in those cases is the subject of a years-long series of discussions and debates (see the References at the end of this document). It's a TODO item here: fill in the details once that's worked out. Meanwhile, it's safe to say that having this available: :: - static inline bool page_maybe_dma_pinned(struct page *page) + static inline bool folio_maybe_dma_pinned(struct folio *folio) ...is a prerequisite to solving the long-running gup+DMA problem. diff --git a/include/linux/mm.h b/include/linux/mm.h index 28c40f68762e..d42497e25d43 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -1953,8 +1953,8 @@ static inline struct folio *pfn_folio(unsigned long pfn) * * For more information, please see Documentation/core-api/pin_user_pages.rst. * - * Return: True, if it is likely that the page has been "dma-pinned". - * False, if the page is definitely not dma-pinned. + * Return: True, if it is likely that the folio has been "dma-pinned". + * False, if the folio is definitely not dma-pinned. */ static inline bool folio_maybe_dma_pinned(struct folio *folio) { @@ -1973,11 +1973,6 @@ static inline bool folio_maybe_dma_pinned(struct folio *folio) GUP_PIN_COUNTING_BIAS; } -static inline bool page_maybe_dma_pinned(struct page *page) -{ - return folio_maybe_dma_pinned(page_folio(page)); -} - /* * This should most likely only be called during fork() to see whether we * should break the cow immediately for an anon page on the src mm.