From patchwork Thu Feb 22 11:50:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Max Kellermann X-Patchwork-Id: 13567162 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 C5F37C48BF8 for ; Thu, 22 Feb 2024 11:51:08 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id EA1296B0071; Thu, 22 Feb 2024 06:51:06 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id E293C6B0072; Thu, 22 Feb 2024 06:51:06 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C7B956B0074; Thu, 22 Feb 2024 06:51:06 -0500 (EST) 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 B57186B0071 for ; Thu, 22 Feb 2024 06:51:06 -0500 (EST) Received: from smtpin30.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 7CBF81A0D6E for ; Thu, 22 Feb 2024 11:51:06 +0000 (UTC) X-FDA: 81819273732.30.93ECE90 Received: from mail-wr1-f54.google.com (mail-wr1-f54.google.com [209.85.221.54]) by imf12.hostedemail.com (Postfix) with ESMTP id 861AE4000E for ; Thu, 22 Feb 2024 11:51:04 +0000 (UTC) Authentication-Results: imf12.hostedemail.com; dkim=pass header.d=ionos.com header.s=google header.b=JRfmhlSg; dmarc=pass (policy=quarantine) header.from=ionos.com; spf=pass (imf12.hostedemail.com: domain of max.kellermann@ionos.com designates 209.85.221.54 as permitted sender) smtp.mailfrom=max.kellermann@ionos.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1708602664; 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-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=jDtDdAHhdomsee3Ex/DKrZGnvTgKe9aa55S2NGfs23I=; b=cAJOYaa9Vqf7ehlp6KDhNuwZ4qm4nzYMVwJef0L0ZolWLLAomSeOTmd29TU0owMI2nOyCt kGBSE//x3h/JUyTaVp6qYo3fbQuQXc426Lb+0bHg8Qtohr5soaNLIoyprmXrqQnK0J9dhe Vu+/3mTAKaJVbNCNMlvkWflYJc8mTFA= ARC-Authentication-Results: i=1; imf12.hostedemail.com; dkim=pass header.d=ionos.com header.s=google header.b=JRfmhlSg; dmarc=pass (policy=quarantine) header.from=ionos.com; spf=pass (imf12.hostedemail.com: domain of max.kellermann@ionos.com designates 209.85.221.54 as permitted sender) smtp.mailfrom=max.kellermann@ionos.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1708602664; a=rsa-sha256; cv=none; b=FGqrROi052kbNG0HLY4VfpuKmh1eyw9uHk8AclEdICTPg1Fjd6L9dLIJ6SQXEgiNz/6bLr ycGqiy8oXYCr4ElSKvpu/rxKrlOaQFrsXc1/3JYZlm6OT3CYh2C6FdomeRtSTBaP8CikCt Vh5DMWAuxkxAJ4LGdCigvAfo5FhlE/I= Received: by mail-wr1-f54.google.com with SMTP id ffacd0b85a97d-33d6cc6d2fcso1138180f8f.2 for ; Thu, 22 Feb 2024 03:51:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ionos.com; s=google; t=1708602663; x=1709207463; darn=kvack.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=jDtDdAHhdomsee3Ex/DKrZGnvTgKe9aa55S2NGfs23I=; b=JRfmhlSgIcrILhL5tIAFRq4vbdgN8XgarxNHhqc3gm9OyzvyC1mW03iFLCEfD8l2tL UAcFf4mT2Xn5Y9f3LozWpF8VIlfewE5IVe2XBNn1oxVg0mupXF66KPlvciU9coVUiA5a cU39J/zDEJ9T5/XdY72iX0YK6F7yJXO9frZaAPfh4XxSIyBld9nj5iNNna9yTk1u9Uju gOpdnELWYFm915c+oVzd+AnteuonC20nB8FtZdOBh1XvtyrkULSkUg6AzujRydAbfEGt 3d6LP22HLg+fs45tyRyTSGoDJJeeBFyLbHMjvB4YltiHCqZMaGz6qoa3QTAfx6OAdyEI oAwg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708602663; x=1709207463; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=jDtDdAHhdomsee3Ex/DKrZGnvTgKe9aa55S2NGfs23I=; b=ow7+deiDQR3Biq0vpivbZxI7iMmFU7ErOqgSsiLfMGQFAE8aW8/3MGQWNaImebAvif Bod/qfRy4NbAjg9xN6Zoou7fTUqBYHxFEnWpjYEnMpKNh4s5LGS+kpU3o2I7Dn0MkilW uVJeR0c6qj3RtLGGH9m1QTLoSlmNZYBTZquFkKFtbflRqRJ/NutPPR1NronzHp/2WwXL AQyyUg2fzs0NmoZjra0/I1esT5b+BpvozJVLShbIAht4b6snKj48jbSM7O+ncJT/UHd5 90QRTTn0GZLX2cKsCO+Kyh3y61Sl2uKsTZjqYvVPLfxz76c8NmH7zCGEg6QdZlVT3jNJ nT4A== X-Forwarded-Encrypted: i=1; AJvYcCWS3Zw4i+0CygGFYKR2KXjqYNNoaMoiY0z8/uMB8Hd0t2h7zhdbAW4PhDJipmRLsKWizVvEm3P/tAs2IjxdzKQbZn4= X-Gm-Message-State: AOJu0YxM64X7xa0hAODlYUPftemTrPq5l9omu9LEaK2u1JYN/5Ti1xoo tE18ljkQBpkZ6hU1tODieH8+5eQMffC1DagVbPostmgfkOTTPXfajGNKLsepQNY= X-Google-Smtp-Source: AGHT+IHpK0leZ4EwBsfTlfXs6Mp/6tOFCXoxjGX+x0XlqG94LlztrxXkuNNitFI3p/6e/W+fpRz9wA== X-Received: by 2002:a05:6000:38d:b0:33d:8cb5:1429 with SMTP id u13-20020a056000038d00b0033d8cb51429mr2153581wrf.27.1708602663111; Thu, 22 Feb 2024 03:51:03 -0800 (PST) Received: from raven.intern.cm-ag (p200300dc6f010900023064fffe740809.dip0.t-ipconnect.de. [2003:dc:6f01:900:230:64ff:fe74:809]) by smtp.gmail.com with ESMTPSA id co18-20020a0560000a1200b0033d4c3b0beesm15044920wrb.19.2024.02.22.03.51.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Feb 2024 03:51:02 -0800 (PST) From: Max Kellermann To: akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: willy@infradead.org, Max Kellermann Subject: [PATCH v2 01/14] drivers: add missing includes on linux/mm.h (and others) Date: Thu, 22 Feb 2024 12:50:42 +0100 Message-Id: <20240222115055.1172877-2-max.kellermann@ionos.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240222115055.1172877-1-max.kellermann@ionos.com> References: <20240222115055.1172877-1-max.kellermann@ionos.com> MIME-Version: 1.0 X-Rspam-User: X-Stat-Signature: 6xtxaqay4dis1zk1j9juk9cgncughbgm X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 861AE4000E X-HE-Tag: 1708602664-536923 X-HE-Meta: U2FsdGVkX18QqVrVJNPGAQqBur46dasz5driI97dU/DwAnDy/wCrOIhWeRBePw8tuCwua4nRys9hsyQ5i5cpaRXfSMm6g7bi1P2dRCWB9i/CkpEyHAsMWvqtMEN1WJfvrVpk1NYl4lkr6UamhWH/DTWYHe+MDHsjYND+cNLqUWxtj+RF0U/xqmoCpRbMAusby9d6oVPokLIyEtchZmJtF6IcvGO5bp4F40S5Qc4TTpMSHJOjFcZ6yYchY1M2VP/eoGaSU1ktr2VHk8UXMkAUCrqlzFFehx1QJR9KgASFfSHS75BQawAU0Maz+s/60EK30CxQOyQ0kJz6Cv3Y5vCYw2hifVcAXf9W5cAreU7MrIkKSHr/vGPVh+Or7WDvmtit7nSfPdLP0U97j2O40fEFp6gOmPLI6SOnsJnJQIX3zTuHPWMeZPiLufG461JQ1KEerb9wAzTOAlkv5bhFOuWQj5xq+LGk2N3ep+qFSXuU+znaCWIoW26r2YSmR8UPcqIzDeAe9OcZkoXfgRArxaj/2pe849QwhX8UrtFFuomB3i4//Bve2sn27R+CcjRr4AiwhAhrG51Yng6/FSKIs/tVMTzkkYtxTj0SPPijgilt57xKe8lAKV0hgyeybp2Q23jA68SrzRyte7WfnSf60o/ftxRgGxhnW91K7/ylQ9cDPX5IWnL9EHxNFvDtmmD5W5BmeanvyVnmABcE3KTbHIsrkSmKLe2oRinpl3O0q5pqOslqSLSbq47z/hBmskZ56nr0PREKxeUejDbTWR51CFuvGtrpv2vDUe33GRthEe58b0tcu+j4Da7jZlGIoEJ5q2LAs1owD7y43zyeVJXGe6feT7qd9YLaWJalMntYHt0oEWrmcNj64rp338KPmKjCKqyy8QnzbobOnLCZt7BUA0tvgb+FVNgD3kBAL55OTJUlfOuHA/OThkAHtRgcgkuI33Jme1cQ8FC5O0diUfD5Rv7 mjoA4xiq lqBRoQ5btmwg4iq4kgxSCxoECIVnt262GAJcKrWpuz0SwXmLneeqsorftL3VloHQrh6PLzt5xB3rUxiyv+f4p4hHPp8aKF+d0mncbQS0OuqFs/FxyoQQTxK3Br8NAs5WneT5cOIxTXK/brjH5FfvkqSL/088ZaThz7Mb0lK0mAv9t2qsl11WiqSF1dzQo51zniIXc/QD7xG5IcWQPD1/T6BSCyFVCTYo86jbf6vfavXOP7w/GprHvNYGMT6v3VKyEkC+S6NDHJ7wvJ52hBvI/D6hTQGHXHep+p9se6jxJ5C/IcMDMDws2NyDeRZcImsK223TdriRuze8sdwHzuzN5C23hi2b0ru3BdmNKgmt4XAVk8xCugXqjG8uoQA== 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 developing the other patches in this series, I had lots of build failures because "#include " was missing. This patch fixes those build failures by adding the missing "#include" lines. To allow bisects, it is ordered before the others. Signed-off-by: Max Kellermann --- arch/arm/mm/iomap.c | 3 +++ drivers/comedi/comedi_buf.c | 1 + drivers/crypto/intel/qat/qat_common/adf_gen4_pm_debugfs.c | 1 + drivers/dma/dma-axi-dmac.c | 1 + drivers/dma/sh/rcar-dmac.c | 1 + drivers/firmware/qcom/qcom_scm-legacy.c | 1 + drivers/firmware/qcom/qcom_scm-smc.c | 1 + drivers/firmware/raspberrypi.c | 1 + drivers/iio/buffer/industrialio-buffer-dma.c | 1 + drivers/iommu/iommufd/ioas.c | 2 ++ drivers/iommu/iommufd/selftest.c | 1 + drivers/media/platform/mediatek/vpu/mtk_vpu.c | 1 + drivers/media/platform/ti/omap/omap_voutlib.c | 1 + drivers/misc/bcm-vk/bcm_vk_dev.c | 1 + drivers/misc/fastrpc.c | 1 + drivers/misc/genwqe/card_dev.c | 1 + drivers/misc/uacce/uacce.c | 1 + drivers/mtd/spi-nor/core.h | 2 ++ drivers/pci/p2pdma.c | 1 + drivers/pci/pci.c | 1 + drivers/remoteproc/remoteproc_core.c | 1 + drivers/soc/qcom/rmtfs_mem.c | 1 + drivers/spi/spi-aspeed-smc.c | 1 + drivers/spi/spi-bcm2835.c | 2 ++ drivers/spi/spi-intel.c | 1 + drivers/virtio/virtio_ring.c | 1 + include/linux/huge_mm.h | 2 ++ include/linux/iommu.h | 1 + include/linux/nvme-keyring.h | 2 ++ include/linux/scatterlist.h | 6 ++++++ kernel/dma/ops_helpers.c | 1 + kernel/dma/remap.c | 1 + mm/dmapool.c | 1 + 33 files changed, 45 insertions(+) diff --git a/arch/arm/mm/iomap.c b/arch/arm/mm/iomap.c index 415d0a454237..9873d8156908 100644 --- a/arch/arm/mm/iomap.c +++ b/arch/arm/mm/iomap.c @@ -29,6 +29,9 @@ EXPORT_SYMBOL(ioport_unmap); #endif #ifdef CONFIG_PCI + +#include // for VMALLOC_* + unsigned long pcibios_min_io = 0x1000; EXPORT_SYMBOL(pcibios_min_io); diff --git a/drivers/comedi/comedi_buf.c b/drivers/comedi/comedi_buf.c index 393966c09740..23b07ebc97ca 100644 --- a/drivers/comedi/comedi_buf.c +++ b/drivers/comedi/comedi_buf.c @@ -10,6 +10,7 @@ #include #include #include +#include // for PAGE_KERNEL* #include "comedi_internal.h" #ifdef PAGE_KERNEL_NOCACHE diff --git a/drivers/crypto/intel/qat/qat_common/adf_gen4_pm_debugfs.c b/drivers/crypto/intel/qat/qat_common/adf_gen4_pm_debugfs.c index ee0b5079de3e..c9b2787baac7 100644 --- a/drivers/crypto/intel/qat/qat_common/adf_gen4_pm_debugfs.c +++ b/drivers/crypto/intel/qat/qat_common/adf_gen4_pm_debugfs.c @@ -1,6 +1,7 @@ // SPDX-License-Identifier: GPL-2.0-only /* Copyright(c) 2023 Intel Corporation */ #include +#include // for simple_read_from_buffer() #include #include #include diff --git a/drivers/dma/dma-axi-dmac.c b/drivers/dma/dma-axi-dmac.c index 4e339c04fc1e..0c98bf0e4b5d 100644 --- a/drivers/dma/dma-axi-dmac.c +++ b/drivers/dma/dma-axi-dmac.c @@ -15,6 +15,7 @@ #include #include #include +#include // for PAGE_ALIGN() #include #include #include diff --git a/drivers/dma/sh/rcar-dmac.c b/drivers/dma/sh/rcar-dmac.c index 40482cb73d79..784da367665c 100644 --- a/drivers/dma/sh/rcar-dmac.c +++ b/drivers/dma/sh/rcar-dmac.c @@ -12,6 +12,7 @@ #include #include #include +#include // for PAGE_ALIGN() #include #include #include diff --git a/drivers/firmware/qcom/qcom_scm-legacy.c b/drivers/firmware/qcom/qcom_scm-legacy.c index 029e6d117cb8..01e082c7163c 100644 --- a/drivers/firmware/qcom/qcom_scm-legacy.c +++ b/drivers/firmware/qcom/qcom_scm-legacy.c @@ -5,6 +5,7 @@ #include #include +#include // for PAGE_ALIGN() #include #include #include diff --git a/drivers/firmware/qcom/qcom_scm-smc.c b/drivers/firmware/qcom/qcom_scm-smc.c index 16cf88acfa8e..a5c74d8996fe 100644 --- a/drivers/firmware/qcom/qcom_scm-smc.c +++ b/drivers/firmware/qcom/qcom_scm-smc.c @@ -5,6 +5,7 @@ #include #include #include +#include // for PAGE_ALIGN() #include #include #include diff --git a/drivers/firmware/raspberrypi.c b/drivers/firmware/raspberrypi.c index 322aada20f74..beef5c4afef2 100644 --- a/drivers/firmware/raspberrypi.c +++ b/drivers/firmware/raspberrypi.c @@ -9,6 +9,7 @@ #include #include #include +#include // for PAGE_ALIGN() #include #include #include diff --git a/drivers/iio/buffer/industrialio-buffer-dma.c b/drivers/iio/buffer/industrialio-buffer-dma.c index 5610ba67925e..b3ce8c4b101a 100644 --- a/drivers/iio/buffer/industrialio-buffer-dma.c +++ b/drivers/iio/buffer/industrialio-buffer-dma.c @@ -6,6 +6,7 @@ #include #include +#include // for PAGE_ALIGN() #include #include #include diff --git a/drivers/iommu/iommufd/ioas.c b/drivers/iommu/iommufd/ioas.c index 742248276548..40c4942406cd 100644 --- a/drivers/iommu/iommufd/ioas.c +++ b/drivers/iommu/iommufd/ioas.c @@ -5,6 +5,8 @@ #include #include #include +#include +#include #include #include "io_pagetable.h" diff --git a/drivers/iommu/iommufd/selftest.c b/drivers/iommu/iommufd/selftest.c index 8abf9747773e..710789a2add9 100644 --- a/drivers/iommu/iommufd/selftest.c +++ b/drivers/iommu/iommufd/selftest.c @@ -5,6 +5,7 @@ */ #include #include +#include // for GUP_PIN_COUNTING_BIAS #include #include #include diff --git a/drivers/media/platform/mediatek/vpu/mtk_vpu.c b/drivers/media/platform/mediatek/vpu/mtk_vpu.c index 7243604a82a5..885b873982e4 100644 --- a/drivers/media/platform/mediatek/vpu/mtk_vpu.c +++ b/drivers/media/platform/mediatek/vpu/mtk_vpu.c @@ -8,6 +8,7 @@ #include #include #include +#include // for totalram_pages() #include #include #include diff --git a/drivers/media/platform/ti/omap/omap_voutlib.c b/drivers/media/platform/ti/omap/omap_voutlib.c index 0ac46458e41c..3b653b49cc48 100644 --- a/drivers/media/platform/ti/omap/omap_voutlib.c +++ b/drivers/media/platform/ti/omap/omap_voutlib.c @@ -18,6 +18,7 @@ * */ +#include // for PAGE_ALIGN() #include #include #include diff --git a/drivers/misc/bcm-vk/bcm_vk_dev.c b/drivers/misc/bcm-vk/bcm_vk_dev.c index d4a96137728d..c5a39a8189bf 100644 --- a/drivers/misc/bcm-vk/bcm_vk_dev.c +++ b/drivers/misc/bcm-vk/bcm_vk_dev.c @@ -11,6 +11,7 @@ #include #include #include +#include // for io_remap_pfn_range() #include #include #include diff --git a/drivers/misc/fastrpc.c b/drivers/misc/fastrpc.c index dbd26c3b245b..35701e9ec28e 100644 --- a/drivers/misc/fastrpc.c +++ b/drivers/misc/fastrpc.c @@ -10,6 +10,7 @@ #include #include #include +#include // for find_vma() #include #include #include diff --git a/drivers/misc/genwqe/card_dev.c b/drivers/misc/genwqe/card_dev.c index 4441aca2280a..ce3acb938ca6 100644 --- a/drivers/misc/genwqe/card_dev.c +++ b/drivers/misc/genwqe/card_dev.c @@ -17,6 +17,7 @@ #include #include +#include // for struct vm_operations_struct #include #include #include diff --git a/drivers/misc/uacce/uacce.c b/drivers/misc/uacce/uacce.c index bdc2e6fda782..af815b8a718e 100644 --- a/drivers/misc/uacce/uacce.c +++ b/drivers/misc/uacce/uacce.c @@ -2,6 +2,7 @@ #include #include #include +#include // for struct vm_operations_struct #include #include #include diff --git a/drivers/mtd/spi-nor/core.h b/drivers/mtd/spi-nor/core.h index d36c0e072954..0d11ff848a7f 100644 --- a/drivers/mtd/spi-nor/core.h +++ b/drivers/mtd/spi-nor/core.h @@ -9,6 +9,8 @@ #include "sfdp.h" +#include // for SZ_* + #define SPI_NOR_MAX_ID_LEN 6 /* * 256 bytes is a sane default for most older flashes. Newer flashes will diff --git a/drivers/pci/p2pdma.c b/drivers/pci/p2pdma.c index 4f47a13cb500..ef37ea6c09fc 100644 --- a/drivers/pci/p2pdma.c +++ b/drivers/pci/p2pdma.c @@ -16,6 +16,7 @@ #include #include #include +#include // for VM_MAYSHARE #include #include #include diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index cfc5b84dc9c9..e2afd992caa7 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c @@ -25,6 +25,7 @@ #include #include #include +#include // for pgprot_device() #include #include #include diff --git a/drivers/remoteproc/remoteproc_core.c b/drivers/remoteproc/remoteproc_core.c index f276956f2c5c..938220fe29f5 100644 --- a/drivers/remoteproc/remoteproc_core.c +++ b/drivers/remoteproc/remoteproc_core.c @@ -18,6 +18,7 @@ #include #include +#include // for PAGE_ALIGN() #include #include #include diff --git a/drivers/soc/qcom/rmtfs_mem.c b/drivers/soc/qcom/rmtfs_mem.c index df850d073102..15c2f6e5eaff 100644 --- a/drivers/soc/qcom/rmtfs_mem.c +++ b/drivers/soc/qcom/rmtfs_mem.c @@ -6,6 +6,7 @@ #include #include #include +#include // for remap_pfn_range() #include #include #include diff --git a/drivers/spi/spi-aspeed-smc.c b/drivers/spi/spi-aspeed-smc.c index bbd417c55e7f..e45f64761e5e 100644 --- a/drivers/spi/spi-aspeed-smc.c +++ b/drivers/spi/spi-aspeed-smc.c @@ -11,6 +11,7 @@ #include #include #include +#include // for SZ_* #include #include diff --git a/drivers/spi/spi-bcm2835.c b/drivers/spi/spi-bcm2835.c index e1b9b1235787..d8ed5575a9c6 100644 --- a/drivers/spi/spi-bcm2835.c +++ b/drivers/spi/spi-bcm2835.c @@ -33,6 +33,8 @@ #include #include +#include // for ZERO_PAGE() + /* SPI register offsets */ #define BCM2835_SPI_CS 0x00 #define BCM2835_SPI_FIFO 0x04 diff --git a/drivers/spi/spi-intel.c b/drivers/spi/spi-intel.c index 3e5dcf2b3c8a..cf8e4f1c4d93 100644 --- a/drivers/spi/spi-intel.c +++ b/drivers/spi/spi-intel.c @@ -8,6 +8,7 @@ #include #include +#include // for SZ_* #include #include diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c index 49299b1f9ec7..5c3ca44aef42 100644 --- a/drivers/virtio/virtio_ring.c +++ b/drivers/virtio/virtio_ring.c @@ -12,6 +12,7 @@ #include #include #include +#include // for PAGE_ALIGN() #include #include diff --git a/include/linux/huge_mm.h b/include/linux/huge_mm.h index 5adb86af35fc..e3395a9bea81 100644 --- a/include/linux/huge_mm.h +++ b/include/linux/huge_mm.h @@ -7,6 +7,8 @@ #include /* only for vma_is_dax() */ +#include // for pmd_t + vm_fault_t do_huge_pmd_anonymous_page(struct vm_fault *vmf); int copy_huge_pmd(struct mm_struct *dst_mm, struct mm_struct *src_mm, pmd_t *dst_pmd, pmd_t *src_pmd, unsigned long addr, diff --git a/include/linux/iommu.h b/include/linux/iommu.h index de839fd01bb8..c49cd93b9c85 100644 --- a/include/linux/iommu.h +++ b/include/linux/iommu.h @@ -14,6 +14,7 @@ #include #include #include +#include // for copy_struct_from_user() #define IOMMU_READ (1 << 0) #define IOMMU_WRITE (1 << 1) diff --git a/include/linux/nvme-keyring.h b/include/linux/nvme-keyring.h index e10333d78dbb..9e033850b967 100644 --- a/include/linux/nvme-keyring.h +++ b/include/linux/nvme-keyring.h @@ -6,6 +6,8 @@ #ifndef _NVME_KEYRING_H #define _NVME_KEYRING_H +#include + #if IS_ENABLED(CONFIG_NVME_KEYRING) key_serial_t nvme_tls_psk_default(struct key *keyring, diff --git a/include/linux/scatterlist.h b/include/linux/scatterlist.h index 77df3d7b18a6..0516e64dc03e 100644 --- a/include/linux/scatterlist.h +++ b/include/linux/scatterlist.h @@ -8,6 +8,12 @@ #include #include +#ifdef CONFIG_UML +#include // for virt_to_page(), page_to_phys() +#else +#include // for virt_to_page(), page_to_phys() +#endif + struct scatterlist { unsigned long page_link; unsigned int offset; diff --git a/kernel/dma/ops_helpers.c b/kernel/dma/ops_helpers.c index af4a6ef48ce0..641363b13bb9 100644 --- a/kernel/dma/ops_helpers.c +++ b/kernel/dma/ops_helpers.c @@ -4,6 +4,7 @@ * the allocated memory contains normal pages in the direct kernel mapping. */ #include +#include // for PAGE_ALIGN() static struct page *dma_common_vaddr_to_page(void *cpu_addr) { diff --git a/kernel/dma/remap.c b/kernel/dma/remap.c index 27596f3b4aef..87b3c874d370 100644 --- a/kernel/dma/remap.c +++ b/kernel/dma/remap.c @@ -3,6 +3,7 @@ * Copyright (c) 2014 The Linux Foundation */ #include +#include // for vmap(), PAGE_ALIGN() #include #include diff --git a/mm/dmapool.c b/mm/dmapool.c index f0bfc6c490f4..b8e23fdc81d7 100644 --- a/mm/dmapool.c +++ b/mm/dmapool.c @@ -25,6 +25,7 @@ #include #include #include +#include // for want_init_on_alloc() #include #include #include From patchwork Thu Feb 22 11:50:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Max Kellermann X-Patchwork-Id: 13567163 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 1E425C54788 for ; Thu, 22 Feb 2024 11:51:11 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D42466B0072; Thu, 22 Feb 2024 06:51:07 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id C7B6C6B0074; Thu, 22 Feb 2024 06:51:07 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id AF5C16B0075; Thu, 22 Feb 2024 06:51:07 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 9E5726B0072 for ; Thu, 22 Feb 2024 06:51:07 -0500 (EST) Received: from smtpin25.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 5568440DB6 for ; Thu, 22 Feb 2024 11:51:07 +0000 (UTC) X-FDA: 81819273774.25.CF6B25B Received: from mail-wr1-f45.google.com (mail-wr1-f45.google.com [209.85.221.45]) by imf06.hostedemail.com (Postfix) with ESMTP id 8E33918001B for ; Thu, 22 Feb 2024 11:51:05 +0000 (UTC) Authentication-Results: imf06.hostedemail.com; dkim=pass header.d=ionos.com header.s=google header.b=Xp3Ria0b; dmarc=pass (policy=quarantine) header.from=ionos.com; spf=pass (imf06.hostedemail.com: domain of max.kellermann@ionos.com designates 209.85.221.45 as permitted sender) smtp.mailfrom=max.kellermann@ionos.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1708602665; 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:dkim-signature; bh=BL1pmIo7s1MX4N9LU8kIbt0i/wU5mZK2rTJkOzRk4Zc=; b=d/oHhjhWKGWPDGzrewt9I75yJADuj/pi11eO5lHmx5HpWEMS4zVrgESuJjpFDAdM1+aPsh /rYdEhouv4uVJBWLyOux4qEWEwTmysaeWPpslNDXMLLUz6ey3x+XjGT4hTlFznb1ATdo9C hl327NzV8tARg2iHGH+myT7P6gie4v8= ARC-Authentication-Results: i=1; imf06.hostedemail.com; dkim=pass header.d=ionos.com header.s=google header.b=Xp3Ria0b; dmarc=pass (policy=quarantine) header.from=ionos.com; spf=pass (imf06.hostedemail.com: domain of max.kellermann@ionos.com designates 209.85.221.45 as permitted sender) smtp.mailfrom=max.kellermann@ionos.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1708602665; a=rsa-sha256; cv=none; b=Ex8oi1ym0S0lCMXSSoffkq3rkNUfpJbCv8DWmO4ypqO09tZ22zKk7CLNsx6K1k+PFdRi0N Gp3W7Uz/9ReGBZFoVNMLcwPsh33ngRL4bslQTzlqjucPlKux0EO/n+w1WtbQmk1EV9toyu zhRg8CadQGlZTLjF0hJdVJFQ+y3Zf+o= Received: by mail-wr1-f45.google.com with SMTP id ffacd0b85a97d-33d90dfe73cso297643f8f.0 for ; Thu, 22 Feb 2024 03:51:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ionos.com; s=google; t=1708602664; x=1709207464; darn=kvack.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=BL1pmIo7s1MX4N9LU8kIbt0i/wU5mZK2rTJkOzRk4Zc=; b=Xp3Ria0be2ueYNOTn/ouZwrQvyKqLF5CE2PJokgXUtf/8UXtf9u6SLi71Xz6yqB4eC oiBCcuNG4SByZWqumcGd1l1FxrG320rD9X0f8M6/w9Ds8THYrkA3t7S2eKQfpo7XFqrE GijGdv+/5uBL/OqHHm2XCyk2TzAvyr69J2VfWP8/nlH0DRs6H0y/l9qdeUK0kJ3QR5ne nf28P5fV4AYj46fCana1Cq+ysxKd5FwtQAUG7u2gyEhZpzN5tpV+xnDePKUbytVnEJEX ijLazgdF+oXKvtNMS6cwPD7lmlSnLH12GUVOI4oHfFVrQgFckiLgdzZ+Qg4SkgsyMSep QJKQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708602664; x=1709207464; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=BL1pmIo7s1MX4N9LU8kIbt0i/wU5mZK2rTJkOzRk4Zc=; b=AwOQOaPaGTPungNAw3gs50oebLo8/mr/b+mouReV2JKPmWhhCqGmM/2PGwCal9csz+ zCfQdHYg9Wle+FrpHbApPgYR0aDmNKwIFK6R11xdYeuXLbFPA/OjVim2zEMmovneX8Sn ehdNWapnh+oX8n8YZ1qVQUjkdSfDc62fLwvJHFbZ+IslrHjqZ7DXqI87QPjITBbn9wqw 4o8wFR5wtQmE6PBPrbqbjd/MHfn9G+uoRGsQ+hSCS7bk2UBUx3a4SBF8ZPRezXVrubrn yJgdAWd8PHvR+6Ghau6tK1G9MrQD5GGYpRJdKMHDZjxpYpA302Tm+dPejbbd/cwP4zxX HqrQ== X-Forwarded-Encrypted: i=1; AJvYcCV2qzyn7+uFpGhUeyfUDBSXNo8zYXqhnuK1dLEQ4jcBdEUE23Cx7FHZzbi1CdFQI/bT3Gij5T8FczszkDxrR2vyK6U= X-Gm-Message-State: AOJu0Yzw0AULDXFdYO4I/iJ2tSKscZDU7D+gmkyuAXlB6zAKa3P09/bU Kcz1Pd6XdzFdv1R3+aTy1gkNL+D6zlKmXmKzcNxEUBJNqwrLQKZArOQnRA6XZZk= X-Google-Smtp-Source: AGHT+IEdqTZyHvawG3jnqE6QFiaRjzUOCgYFXRkgDA6AoYo7c6Ret0m4HwidPTuLwONlXP4untfCBA== X-Received: by 2002:a5d:404c:0:b0:33d:64a3:9bc6 with SMTP id w12-20020a5d404c000000b0033d64a39bc6mr2229571wrp.4.1708602664281; Thu, 22 Feb 2024 03:51:04 -0800 (PST) Received: from raven.intern.cm-ag (p200300dc6f010900023064fffe740809.dip0.t-ipconnect.de. [2003:dc:6f01:900:230:64ff:fe74:809]) by smtp.gmail.com with ESMTPSA id co18-20020a0560000a1200b0033d4c3b0beesm15044920wrb.19.2024.02.22.03.51.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Feb 2024 03:51:03 -0800 (PST) From: Max Kellermann To: akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: willy@infradead.org, Max Kellermann Subject: [PATCH v2 02/14] include/drm/drm_gem.h: add poll_table_struct forward declaration Date: Thu, 22 Feb 2024 12:50:43 +0100 Message-Id: <20240222115055.1172877-3-max.kellermann@ionos.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240222115055.1172877-1-max.kellermann@ionos.com> References: <20240222115055.1172877-1-max.kellermann@ionos.com> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: 8E33918001B X-Stat-Signature: kaie3oxnbwwfzyxmug4mizop84nb75zg X-HE-Tag: 1708602665-677306 X-HE-Meta: U2FsdGVkX18Mo1ozdYqIdzP6O/Z1txEheBUoxCLesRc0cSCGRdX5kNi5Mw5XKU2VjNHFTN7foluyV+30S+V2FmBkyMwX0GmcatFlawmx323RVZvIvUUk8hZJEDAHYxw2DGAaM1P621f9t0SmdXTvkI/FzNOa0knZROwBLgvXC/llM1Oy0NNYd1l1YRgcUPL7XTY7wRU/8IHjMGdP8/HPV5f1CKHMa82S9Xnvv1WdMxIRQkK7eASa55Pv5zjL0+kxSYbx98zUSHpNBkZPk/xaoQS5bJOka40ALH/YmYFiFCAnyHA8M1EQ/RRiwAy+J0VUcwWGH6dHJC0a8orVt8rVkzcsOLRtpqFpHR2s7fbIc+omivaUf8jPI8EEG3Rf0Jruu1Ovn3QyqBh81hD3P8uyV3vvCz6IyqehQExwbRvryx/ODMDwD/OSiPH/aSWdaq/q1tp6BPmOWNQQx44n3IjIbPJKljtrCXlRLKPrAwvrdi5G4SkoetS6cFOJSqULGUOne3ijoNWXR6/dzPStFvUzJueThMhISvKj72Z6TR+mLZPXDN1v4XMoBJXfmwUYWO9fbnLMBixSMkhcGj2+IxMsnGSmEKO2bkzEnHbP7hnLzMRUdFCqmMUAuOlKzFJB7KVjnyKpUkfq20hXXsKDARWs/Ck6Ihs2QiX5qw0zANzW823ENalTKaWjQtTo4YEoTFCbXof0DJIShH89uhymoP0T5lmtw47mdXSkVzxiQ4tNjxyivyJQDZZ5lTPXrrlv4Le4NLHbekKXVLs7vcfsgCmaWagDpdEsB00FEcGDIFLUXQWBU4QOvQ8REfyObIdcTQwgRj7MuwFbtsCFESpUOfF/wJ+EohZuBwpxMrjqdvPgnHEOgLf0L7dO6nLlk+/rO9I2Ug7D4bOc4aMbXeniTvbUxR9N7l7Ynnb+J1L65EG4FvNpkGtOeuMzPl88zArOn0Kgdr7bqshoec/T16Z+YOJ sMKDiFGR lc9wmfU98X1t/vMlrAebKfMPInW2pEhmjSAUZ4BeLpgBMJdcdpTWD2sC0Wz9CyEBYD5R3pcBY/UCXfFf1g6eTPhXw81dS2HS4OAf+9bU/pX18aZ0zD/AEvf+E3A== 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 eliminating includes of linux/mm.h, the following build failure occurred: ./include/drm/drm_file.h:443:45: warning: ‘struct poll_table_struct’ declared inside parameter list will not be visible outside of this definition or declaration 443 | __poll_t drm_poll(struct file *filp, struct poll_table_struct *wait); | ^~~~~~~~~~~~~~~~~ In file included from drivers/gpu/drm/imagination/pvr_gem.h:12, from drivers/gpu/drm/imagination/pvr_fw.h:9: ./include/drm/drm_gem.h:447:27: error: initialization of ‘__poll_t (*)(struct file *, struct poll_table_struct *)’ {aka ‘unsigned int (*)(struct file *, struct poll_table_struct *)’} from incompatible pointer type ‘__poll_t (*)(struct file *, struct poll_table_struct *)’ {aka ‘unsigned int (*)(struct file *, struct poll_table_struct *)’} [-Werror=incompatible-pointer-types] 447 | .poll = drm_poll,\ | ^~~~~~~~ The compiler is confused, and that can be fixed easily by forward-declaring the struct expicitly. Signed-off-by: Max Kellermann --- include/drm/drm_file.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/drm/drm_file.h b/include/drm/drm_file.h index ab230d3af138..f24ade9f766f 100644 --- a/include/drm/drm_file.h +++ b/include/drm/drm_file.h @@ -44,6 +44,7 @@ struct drm_device; struct drm_printer; struct device; struct file; +struct poll_table_struct; /* * FIXME: Not sure we want to have drm_minor here in the end, but to avoid From patchwork Thu Feb 22 11:50:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Max Kellermann X-Patchwork-Id: 13567164 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 1F938C48BF8 for ; Thu, 22 Feb 2024 11:51:14 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id CF3246B0075; Thu, 22 Feb 2024 06:51:08 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id C7CAE6B007B; Thu, 22 Feb 2024 06:51:08 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9974C6B0078; Thu, 22 Feb 2024 06:51:08 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 858A66B0074 for ; Thu, 22 Feb 2024 06:51:08 -0500 (EST) Received: from smtpin22.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 53921A10B3 for ; Thu, 22 Feb 2024 11:51:08 +0000 (UTC) X-FDA: 81819273816.22.D941ECC Received: from mail-wr1-f45.google.com (mail-wr1-f45.google.com [209.85.221.45]) by imf13.hostedemail.com (Postfix) with ESMTP id 618B32000C for ; Thu, 22 Feb 2024 11:51:06 +0000 (UTC) Authentication-Results: imf13.hostedemail.com; dkim=pass header.d=ionos.com header.s=google header.b=G20G7MxX; dmarc=pass (policy=quarantine) header.from=ionos.com; spf=pass (imf13.hostedemail.com: domain of max.kellermann@ionos.com designates 209.85.221.45 as permitted sender) smtp.mailfrom=max.kellermann@ionos.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1708602666; 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-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=7b5/uhjfqeIuQAGiFdEn3Xr4J+TBvtutx0p1n4ubkzU=; b=Qtsr/TF91Z50zj6ENQQ9v071KBjGau6C83o8zLtIb0ysIermRvwpNm8W+WV58soL6dYOPO LD+S8WVdr6my2Zv+lcSG7Gck6ekkCZ+ap2AlwN9ZDc45OeBojv3/1tv+Rt5XaTOLnmKXSA iFWkwYsDiSCrF2j68qaqcH7hatc2X3E= ARC-Authentication-Results: i=1; imf13.hostedemail.com; dkim=pass header.d=ionos.com header.s=google header.b=G20G7MxX; dmarc=pass (policy=quarantine) header.from=ionos.com; spf=pass (imf13.hostedemail.com: domain of max.kellermann@ionos.com designates 209.85.221.45 as permitted sender) smtp.mailfrom=max.kellermann@ionos.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1708602666; a=rsa-sha256; cv=none; b=nWd4W8umrLe/Mso09sG3el6Sd5nyaGoEhhngdBHZ6pEaaRzr/VrmzpsYy6Vv5SS+QPu+5K gNgaLtmnLdJBa0ftJlRNGn7R0oOWeLX4Ype+9qgbbhohg44kVPcvMiS9lAy1XHkxXAsvCk chZlDaxErLSM8rTk9bo1ah2R3y+I7wk= Received: by mail-wr1-f45.google.com with SMTP id ffacd0b85a97d-33d26da3e15so503099f8f.1 for ; Thu, 22 Feb 2024 03:51:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ionos.com; s=google; t=1708602665; x=1709207465; darn=kvack.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=7b5/uhjfqeIuQAGiFdEn3Xr4J+TBvtutx0p1n4ubkzU=; b=G20G7MxX37c2NbsrWC+YT+trC2kh708Q6xc0HRaRGcGRStAjn3DKUG28gLFpofdJhQ KTP2HcDnCvTkJcgnxJ3qUEN7B/N4EGMV5SRuRvc2eqvFzOB6Ykpv4pejcq1I9WPBrRux vwfWBpctYVbO1t1g/lpNgKSOVgKSU1VY2TbmB1zyOY0ul/qZKuy49SQ9W41OaSQKMDwe ZpJejctB2+nrZRiS9ffNt0P6Oj0nBCvHKxCRNdcf4t1kg2LJQGNsYTYUhi4A5BR143gS 1NkuJGOT+nFVmW64hv9imsS6x8NHFFUywB9N4L4O6K6PRnbBqrVQ/87a0dDRxP1EiguY DfVA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708602665; x=1709207465; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=7b5/uhjfqeIuQAGiFdEn3Xr4J+TBvtutx0p1n4ubkzU=; b=e0dnUp631LYgZu06HKonlByKZ40aJ911W9qLf4xhnvkGw6ZjLtx7KrpbiSJ4gLg5H+ uiTLcEITFNOqt73D/AB9cbAYaJGrX9usSBRoSWyzYcl+B7n00vOOGFnNF8hUQwNPYgSr OzMuuWI2a1dWdzwJII4QBG2mDUXHsJ/FkcYX6EDsLRcQkoksoBPi0HyKnA8YuaB8Vuqg mpCfIMfDaZYcAeKciZhd1EVDh6oMsOvOC98iKkeyuD7rHyp9TbJLWB1Vg1DvjZw8ku0b BrzK2R0RGWQmUWDGSv2UnzVu5rqRyJWNqQcFHcZLf4ueA0S/pUdOn1HH3hHwPm/AkEBb EJww== X-Forwarded-Encrypted: i=1; AJvYcCUSZOPPOXfChtEteF5WGf8D8thWUIygepQG8c4DbeH74efsizUMnTdxvehLpdmXhmPpoPjZAqKH+GH6Xc5+tL+9ttA= X-Gm-Message-State: AOJu0YzU+ijqz01AW3hjvXWmyRruNT9uKs2R1YKgITBjZZ5DOaeCSsp0 cq4cqFFM3tXcl0xviVQ5E452IAaexLe5E64EriYMClRyA504jpdUQMxesdc9b9M= X-Google-Smtp-Source: AGHT+IEKsT+x17IHrY8997OwmeRClTuQ0BNyZeHPQoSXN8JZKWq1sN/JzXVa3pupvyni90LpbItmzg== X-Received: by 2002:a5d:4ac4:0:b0:33d:3ff3:f888 with SMTP id y4-20020a5d4ac4000000b0033d3ff3f888mr2385231wrs.0.1708602664992; Thu, 22 Feb 2024 03:51:04 -0800 (PST) Received: from raven.intern.cm-ag (p200300dc6f010900023064fffe740809.dip0.t-ipconnect.de. [2003:dc:6f01:900:230:64ff:fe74:809]) by smtp.gmail.com with ESMTPSA id co18-20020a0560000a1200b0033d4c3b0beesm15044920wrb.19.2024.02.22.03.51.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Feb 2024 03:51:04 -0800 (PST) From: Max Kellermann To: akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: willy@infradead.org, Max Kellermann Subject: [PATCH v2 03/14] linux/mm.h: move page_kasan_tag() to mm/page_kasan_tag.h Date: Thu, 22 Feb 2024 12:50:44 +0100 Message-Id: <20240222115055.1172877-4-max.kellermann@ionos.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240222115055.1172877-1-max.kellermann@ionos.com> References: <20240222115055.1172877-1-max.kellermann@ionos.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: 618B32000C X-Rspam-User: X-Rspamd-Server: rspam04 X-Stat-Signature: qqky4h9xfu675wmq94xmcfizxmzi4kmr X-HE-Tag: 1708602666-844453 X-HE-Meta: U2FsdGVkX19Zyiebud5302bk1otivLdEQWVuCaJ6izZPbuSw6FKkGypOuCS/vRivlmZ3fjoUaIXczm4FfI5UQTgULtI9Q0KuHkOEJs9jNvMyqvNIF4Z6wHFQetQdmULxxiPFaMEh0jRqcg7j2sagOdZMj0dcCDHpUIDyRWvCJgXVTCs4w53BrBnFAV7B26NEo45Q8pjVXG6jQ08F3zMzRngJ1XvyP5OxVD744uuXz581OqgxiFOCQoQKcX3ZZgTVoeb3jw4asrXXOm7MUYvLzxoa/uP6TJvt/rtek6VqPEPuvBaKKn9cVIn+pDtDlVdMBXkFd6+q+SfcnQz2/CePwnND3UcFyM65GATfCj4IjAOYwDHqkxwPFLZd5vqFmnAmqGUCYFLtWkl6f4rBu/qszm6G6QcAxkJA75NPbDkY5039rXU4tnwWRWyhGyzcBABd/VN2KkGfNeBX/FxJ+wklqmY0gesHFw2bm/ivVXb1AfE8P5P9xSnkwdeLos+YXpHeIa/xKuMB5V6ReNPd3cSVZuMHtEtT4gLAL4E4L9MtSsYNSfK85t6S6M2dcYah796S28UWOQRJruEwdDDOrlWgWJYNDbpnzQyViIhG5m8k7OGU3lAfaDKEXxVa78zH+Khts/2qun6vdqQP+ZCFToi6Xa6W4maXAEIG1P6K1CBjRf8Ro2M/9BfTCwYIy9TeHqKPaXgNAIM8OH6m41xHlI38XN1L4YsrwE25L2RAOzQpxCoT41ZWZ1p7LzOGe7LPZUt2GO6wtwDbmHP8qIKVrH5dtcC5NO3OodxtBVt7QC3Tqc7MvJHZx8ZHLM22mVLBVuOGvI8eXIUmBKxi4xVO5kpQkKKPzwUNp7v3O7qg/9cstYcSFZ7oglAJvR4pur7IxphpYOou1khsD/T1toTH/Ot2qC2FNV2JHkWhrMZ0DyO2lQHio0srMbRcdYLCHMmwHsuByq+uRAWV+fRqCIXsyPL ZEhiOcAe CE2B+vTQSsl5A8fUel2Gdi7WNaa0s+DJWDBC2Ssn/ZMNIk5PUmmj2Hbr6Zx4hL+7ooD3jQ7kkcqSOAOYtj21fnMv7Ankz7U7TDL1pHketMxEEduxI+JLBk65XC939i1ttC4BphHDYIz+VfMqqHgyCmrzEqwdjiCZAKTz+t3EeU1c8PB1Qokph5OhKrBYGLQplVATHa7K9itBfJepJyqkzz5XwNNHpwH66pm5Hamt8PAzyubC5FHKRLcxD+SFXGksVHhIp4ST3aR7sbY48UE37RUSFSitA6Iv1/mQkTrUsBU+dhxRlUHk1Pf49VeIcOkJYVq8gHUR4W9nRb1opLzlzT2iAPw3gUk7Ijfyj9+/DC4RQnqyaYYLV/7A3njnC/uSuzLShgH5KvCu05qWL8RVlhADckm2OPs7wsPtU9bVRgPTxROU= 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: Prepare to reduce dependencies on linux/mm.h. page_kasan_tag() is used by the page_to_virt() macro in ARM64 (but asm/memory.h does not include linux/mm.h). Thus, in order to be able to use anything that calls page_to_virt(), linux/mm.h needs to be included. This would prevent us from moving page_address() to a separate header, because it calls lowmem_page_address() which in turn calls page_to_virt(). To prepare for this move, we move page_kasan_tag() out of linux/mm.h into a separate lean header. A side effect of this patch is that the include line is moved inside the "#ifdef CONFIG_KASAN..." block, i.e. it is not included at all if KASAN is disabled. Signed-off-by: Max Kellermann --- MAINTAINERS | 1 + include/linux/mm.h | 56 +------------------------- include/linux/mm/page_kasan_tag.h | 66 +++++++++++++++++++++++++++++++ 3 files changed, 68 insertions(+), 55 deletions(-) create mode 100644 include/linux/mm/page_kasan_tag.h diff --git a/MAINTAINERS b/MAINTAINERS index c042ca394893..ad208d8aea4b 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -14187,6 +14187,7 @@ F: include/linux/mempolicy.h F: include/linux/mempool.h F: include/linux/memremap.h F: include/linux/mm.h +F: include/linux/mm/*.h F: include/linux/mm_*.h F: include/linux/mmzone.h F: include/linux/mmu_notifier.h diff --git a/include/linux/mm.h b/include/linux/mm.h index 1743bdeab506..c8d909cc1353 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -2,6 +2,7 @@ #ifndef _LINUX_MM_H #define _LINUX_MM_H +#include #include #include #include @@ -27,7 +28,6 @@ #include #include #include -#include #include #include @@ -1810,60 +1810,6 @@ static inline void vma_set_access_pid_bit(struct vm_area_struct *vma) } #endif /* CONFIG_NUMA_BALANCING */ -#if defined(CONFIG_KASAN_SW_TAGS) || defined(CONFIG_KASAN_HW_TAGS) - -/* - * KASAN per-page tags are stored xor'ed with 0xff. This allows to avoid - * setting tags for all pages to native kernel tag value 0xff, as the default - * value 0x00 maps to 0xff. - */ - -static inline u8 page_kasan_tag(const struct page *page) -{ - u8 tag = KASAN_TAG_KERNEL; - - if (kasan_enabled()) { - tag = (page->flags >> KASAN_TAG_PGSHIFT) & KASAN_TAG_MASK; - tag ^= 0xff; - } - - return tag; -} - -static inline void page_kasan_tag_set(struct page *page, u8 tag) -{ - unsigned long old_flags, flags; - - if (!kasan_enabled()) - return; - - tag ^= 0xff; - old_flags = READ_ONCE(page->flags); - do { - flags = old_flags; - flags &= ~(KASAN_TAG_MASK << KASAN_TAG_PGSHIFT); - flags |= (tag & KASAN_TAG_MASK) << KASAN_TAG_PGSHIFT; - } while (unlikely(!try_cmpxchg(&page->flags, &old_flags, flags))); -} - -static inline void page_kasan_tag_reset(struct page *page) -{ - if (kasan_enabled()) - page_kasan_tag_set(page, KASAN_TAG_KERNEL); -} - -#else /* CONFIG_KASAN_SW_TAGS || CONFIG_KASAN_HW_TAGS */ - -static inline u8 page_kasan_tag(const struct page *page) -{ - return 0xff; -} - -static inline void page_kasan_tag_set(struct page *page, u8 tag) { } -static inline void page_kasan_tag_reset(struct page *page) { } - -#endif /* CONFIG_KASAN_SW_TAGS || CONFIG_KASAN_HW_TAGS */ - static inline struct zone *page_zone(const struct page *page) { return &NODE_DATA(page_to_nid(page))->node_zones[page_zonenum(page)]; diff --git a/include/linux/mm/page_kasan_tag.h b/include/linux/mm/page_kasan_tag.h new file mode 100644 index 000000000000..1210c62170a3 --- /dev/null +++ b/include/linux/mm/page_kasan_tag.h @@ -0,0 +1,66 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef _LINUX_MM_PAGE_KASAN_TAG_H +#define _LINUX_MM_PAGE_KASAN_TAG_H + +#include + +struct page; + +#if defined(CONFIG_KASAN_SW_TAGS) || defined(CONFIG_KASAN_HW_TAGS) + +#include +#include // for struct page + +/* + * KASAN per-page tags are stored xor'ed with 0xff. This allows to avoid + * setting tags for all pages to native kernel tag value 0xff, as the default + * value 0x00 maps to 0xff. + */ + +static inline u8 page_kasan_tag(const struct page *page) +{ + u8 tag = KASAN_TAG_KERNEL; + + if (kasan_enabled()) { + tag = (page->flags >> KASAN_TAG_PGSHIFT) & KASAN_TAG_MASK; + tag ^= 0xff; + } + + return tag; +} + +static inline void page_kasan_tag_set(struct page *page, u8 tag) +{ + unsigned long old_flags, flags; + + if (!kasan_enabled()) + return; + + tag ^= 0xff; + old_flags = READ_ONCE(page->flags); + do { + flags = old_flags; + flags &= ~(KASAN_TAG_MASK << KASAN_TAG_PGSHIFT); + flags |= (tag & KASAN_TAG_MASK) << KASAN_TAG_PGSHIFT; + } while (unlikely(!try_cmpxchg(&page->flags, &old_flags, flags))); +} + +static inline void page_kasan_tag_reset(struct page *page) +{ + if (kasan_enabled()) + page_kasan_tag_set(page, KASAN_TAG_KERNEL); +} + +#else /* CONFIG_KASAN_SW_TAGS || CONFIG_KASAN_HW_TAGS */ + +static inline u8 page_kasan_tag(const struct page *page) +{ + return 0xff; +} + +static inline void page_kasan_tag_set(struct page *page, u8 tag) { } +static inline void page_kasan_tag_reset(struct page *page) { } + +#endif /* CONFIG_KASAN_SW_TAGS || CONFIG_KASAN_HW_TAGS */ + +#endif /* _LINUX_MM_PAGE_KASAN_TAG_H */ From patchwork Thu Feb 22 11:50:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Max Kellermann X-Patchwork-Id: 13567165 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 E01BBC48BF8 for ; Thu, 22 Feb 2024 11:51:16 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 7F69B6B0078; Thu, 22 Feb 2024 06:51:09 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 74CC36B007B; Thu, 22 Feb 2024 06:51:09 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5C6266B007E; Thu, 22 Feb 2024 06:51:09 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 484BA6B0078 for ; Thu, 22 Feb 2024 06:51:09 -0500 (EST) Received: from smtpin16.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 18F0980D93 for ; Thu, 22 Feb 2024 11:51:09 +0000 (UTC) X-FDA: 81819273858.16.5723259 Received: from mail-wr1-f54.google.com (mail-wr1-f54.google.com [209.85.221.54]) by imf24.hostedemail.com (Postfix) with ESMTP id 380BE180017 for ; Thu, 22 Feb 2024 11:51:06 +0000 (UTC) Authentication-Results: imf24.hostedemail.com; dkim=pass header.d=ionos.com header.s=google header.b=OQNAvzJ+; spf=pass (imf24.hostedemail.com: domain of max.kellermann@ionos.com designates 209.85.221.54 as permitted sender) smtp.mailfrom=max.kellermann@ionos.com; dmarc=pass (policy=quarantine) header.from=ionos.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1708602667; 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-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=bU66tnpYofC3HczPR5LqCx53IAlSBOajb8Iggei03v8=; b=8iYR5s/1wb8KrLvyOuNMMMBA1hOksMs7NvdHKq77k9RzcN2HwR0FbCZxMsO3qkcBYTbqwd JE6YEsxSI4C17foD8cyGdtuE2KabSj1PqQh+zCjldvhnKMwgrIZuMKEnaiz+5giWAZmbS9 j1psghqS3h10qW9PaKsWEZlUveJTdrM= ARC-Authentication-Results: i=1; imf24.hostedemail.com; dkim=pass header.d=ionos.com header.s=google header.b=OQNAvzJ+; spf=pass (imf24.hostedemail.com: domain of max.kellermann@ionos.com designates 209.85.221.54 as permitted sender) smtp.mailfrom=max.kellermann@ionos.com; dmarc=pass (policy=quarantine) header.from=ionos.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1708602667; a=rsa-sha256; cv=none; b=V4KnlogRZ79qfBkgs9Ab9baUGzc1tStgGTCCd/0tFuWaHvs/S8dBLCfemzPIUTVcVav0e5 6Top3TqEmOb0gWfKDrOanp+C0+qhOMvXGoHPOsmEUVQaT8mN3MIKLGiyzX4IKspviZaTXb yjqb6lCb14+GBgFj90RcxAAP9TbL2n8= Received: by mail-wr1-f54.google.com with SMTP id ffacd0b85a97d-33d9c3f36c2so128417f8f.2 for ; Thu, 22 Feb 2024 03:51:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ionos.com; s=google; t=1708602666; x=1709207466; darn=kvack.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=bU66tnpYofC3HczPR5LqCx53IAlSBOajb8Iggei03v8=; b=OQNAvzJ+qNPZ/Y9I4OgQ2ldj9f5/mvITk5+kkp4xjBVp8cle2wwj2J7SlDuwLAS0v8 5wi2nZitbAzWxjH/Ek1R/olXOskQ+zr4fHQOEyDT0B6ShPWj2Q7hJLqcD7hKFjm8nNHS L0dArEtM8D6jI9ZmKIjFQCj4y5HX+oScnnXThYRgiSYGppRxaBAyTxZGdQ1No15rb9xU WtgchZCYlRhyQO6dnZoW9evY7C01BYNWrkJPQmYHNkyk94WdRJ7O2RW6o1q0CnFg/flk fIE8PPZG3YuPYPIP7QTCqIQDqwVPJcgX7qeX7E70y2pBh1EANKVyBKsZVas1EVOLtwVd SHGw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708602666; x=1709207466; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=bU66tnpYofC3HczPR5LqCx53IAlSBOajb8Iggei03v8=; b=YSKhwGD2+XBUbOlJbzXAmg2iwpxX0mjA5EfcLZtlHbPcLlbfxCK2+bVd+4/dq7AOTT NFfbi3A6RGrZ6Xmi2q+D26i49G3rt/8xz5RxipdViKwkeRKKDMoq4fiZL3dEHTr7DMyk rVvGy4KyBW2zr78/+SyT9axEglCRTzh9HVSvItuKPyIoqEgLCklIg0li02UIQjLIPyzq aiYImnikvoGBc9K/EeYX4B0tgm9Gpi8SDp+BKcaPfXcxHJuTd6qAmm8NHap7hj5Bpmbo MHhIQOFlsrQZgvtNxf1FZrBVmwmpRxGBz4mUbwSpY5+GzbMDqu36qENj9Xlb5vqmQAO7 rIHA== X-Forwarded-Encrypted: i=1; AJvYcCWgqhXPUtvrdCT+o9q48n+AKCA4dW+xfKwQy68HQ/ik8ItXRHJWAZZb5hIlgaDseWWlACA+OgWT2Wqnc2UrXwLTRz4= X-Gm-Message-State: AOJu0YyGJ7TrZUbMJJAJ3l0l6GKf4X0nonPliNEbXPagCqBUWxWDpR5a Ee+Hid95zp0fCb6Pk7k/VYJQ3IJryTXJh+49GAcx4YrxLFnGyqAM5QMo4kNZXoc= X-Google-Smtp-Source: AGHT+IHWgvt0/sZsRq4iRTjhX0psvS+eVhVBMHB4PSfSQw/t1/qrWtQi6HShkpncAQZpTNIObD2jGg== X-Received: by 2002:a05:6000:12c5:b0:33d:40f0:b0de with SMTP id l5-20020a05600012c500b0033d40f0b0demr7809643wrx.6.1708602665810; Thu, 22 Feb 2024 03:51:05 -0800 (PST) Received: from raven.intern.cm-ag (p200300dc6f010900023064fffe740809.dip0.t-ipconnect.de. [2003:dc:6f01:900:230:64ff:fe74:809]) by smtp.gmail.com with ESMTPSA id co18-20020a0560000a1200b0033d4c3b0beesm15044920wrb.19.2024.02.22.03.51.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Feb 2024 03:51:05 -0800 (PST) From: Max Kellermann To: akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: willy@infradead.org, Max Kellermann Subject: [PATCH v2 04/14] linux/mm.h: move section functions to mm/page_section.h Date: Thu, 22 Feb 2024 12:50:45 +0100 Message-Id: <20240222115055.1172877-5-max.kellermann@ionos.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240222115055.1172877-1-max.kellermann@ionos.com> References: <20240222115055.1172877-1-max.kellermann@ionos.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: 380BE180017 X-Rspam-User: X-Stat-Signature: oz7ctmat3zz46uk5qzpjwg1kc8s937dd X-Rspamd-Server: rspam01 X-HE-Tag: 1708602666-770899 X-HE-Meta: U2FsdGVkX18A66fVNoPPAMLciOIXnsuvigcoeVATIV0a301ugYuhpBbsTvCpWNVB63olaMcH0C0hv0nLCd6ouqrZJrTo/vMOBaoqPCMyeSt0XRKFqYOhXdfJREvt5NtDVoCTi9MiSYCdZZQbPyFNLe8j5/D5KUtcoTaXPDTv8Xg3fdkBMnsxBgWuP7WosKsbycpu7M+HISCss0ysoYsUkqpwbE4WDXV51ny9xj3nP0oAWCvJP+N6z16hIqeBdEh1alJB9aFEwwBbwxgZp6UoKfLfycXABgBMGyiQoiKAyn7Ldk1lCku+ImwG/a5wZkyWTLcxbcmvX5f2qJiJFRiY15Yo6yiIQ730mb2utlPzx5zOcZOg7M0RlTzIwhyzNEqZI/f3V4NCL9mWjwPoyyQ824bNJPU8FfE/SCeGrjUL8yxZ02VorAqdH1waWJJ0/3hN+G2NfVekQxojWzhrrXGPMG1yldA6bTgknDv2gQiEabz2KAb+4T0yE1gwk7IjqPniFQhuWKgSacJ2UiF6J0nWlpboHv9hX72p6S48UGGbYPtg7/FmsvFrg2FirmfhcGlpsZFeT8phRru4fNgxT0NlLe2XzTez1Ci3anNSPf8NTsvJs6qtlp+jMl/KD+wpFcKUmrrc7LdvgyNOreqSH9fJGeiIWmUxMtgm1czdOD5F95HUTVtT8zjyzBKMP9BJp5/SMNuCgXLX3GVYdRXcLT5H+u2gL117NHXfdbgS73p5yI8tmOTNjzHH1ZvxwkWjeyO64s1qqX6g6RP+s4PrZRVaar4+yqBptd7rkklTHsgQLQOdEd0AYRz4e15MuU9DNKtmoECQ5x3uOZeDZqCiJ7S4iZ1zXif/w2yCLLNK2My2MJvflqp9VxtAGQF2EbZPCeCJhCZaU1n11JwoWtWkKvPLmR5EHqbd44QqICciKkjgvzxpet40dUEJtqVPuVgM/hgADbz7SNf7Y8/zEj0Zkv5 fIZPRs6s y0tHxoc/TVAUruHtwklrFcecDj2X+xZ/pTDNc/xHwzxm4YqZyt0yAt6dvX7b2uT+whTmQ8A2ZcNTpaAIpjYonCJWqsfX8WBVTbzGLsAb3lmV5394U0bCG22ZWEVJxWnra0RT841UZbJeTmOMkk6WbzQr2RGJkBOoZwcn6Brt/d1TWDc6SVeSB5RiZ7RomObTGjOJwKMlEcNsEcmqcaJq/4tKUuw3ikJftycgfoD2MCFJQxR7GiG9phOM04EaGBDsWEViy/XK7dBK8RPkEYpZzWHPLTBaXq9QkUep9Ub0XrXW0gBkp9ps7e1gb2P/SwtzV4CxKEImdYOtrmoXnJ05/XyMqXKEmDSTNoApC0dfthHZ+BNWoEfcDTzCWB9xEP++E/en19S8Nid/ZdZ5Y6Pi4ml4pDIyclse9lkNZjHixicZ2xxA= 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: Prepare to reduce dependencies on linux/mm.h. page_to_section() is used by __page_to_pfn() (but asm-generic/memory_model.h does not include linux/mm.h). Thus, in order to be able to use anything that calls page_to_pfn(), linux/mm.h needs to be included. This would prevent us from moving page_address() to a separate header, because it calls lowmem_page_address() which in turn calls page_to_virt() and then page_to_pfn(). To prepare for this move, we move page_to_section() out of linux/mm.h into a separate lean header. Signed-off-by: Max Kellermann --- include/linux/mm.h | 18 +----------------- include/linux/mm/page_section.h | 23 +++++++++++++++++++++++ 2 files changed, 24 insertions(+), 17 deletions(-) create mode 100644 include/linux/mm/page_section.h diff --git a/include/linux/mm.h b/include/linux/mm.h index c8d909cc1353..7c3d2bd69818 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -3,6 +3,7 @@ #define _LINUX_MM_H #include +#include #include #include #include @@ -1627,10 +1628,6 @@ static inline bool is_nommu_shared_mapping(vm_flags_t flags) } #endif -#if defined(CONFIG_SPARSEMEM) && !defined(CONFIG_SPARSEMEM_VMEMMAP) -#define SECTION_IN_PAGE_FLAGS -#endif - /* * The identification function is mainly used by the buddy allocator for * determining if two pages could be buddies. We are not really identifying @@ -1830,19 +1827,6 @@ static inline pg_data_t *folio_pgdat(const struct folio *folio) return page_pgdat(&folio->page); } -#ifdef SECTION_IN_PAGE_FLAGS -static inline void set_page_section(struct page *page, unsigned long section) -{ - page->flags &= ~(SECTIONS_MASK << SECTIONS_PGSHIFT); - page->flags |= (section & SECTIONS_MASK) << SECTIONS_PGSHIFT; -} - -static inline unsigned long page_to_section(const struct page *page) -{ - return (page->flags >> SECTIONS_PGSHIFT) & SECTIONS_MASK; -} -#endif - /** * folio_pfn - Return the Page Frame Number of a folio. * @folio: The folio. diff --git a/include/linux/mm/page_section.h b/include/linux/mm/page_section.h new file mode 100644 index 000000000000..e4558c2691b8 --- /dev/null +++ b/include/linux/mm/page_section.h @@ -0,0 +1,23 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef _LINUX_MM_PAGE_SECTION_H +#define _LINUX_MM_PAGE_SECTION_H + +#include // for struct page +#include // for SECTIONS_* + +#if defined(CONFIG_SPARSEMEM) && !defined(CONFIG_SPARSEMEM_VMEMMAP) +#define SECTION_IN_PAGE_FLAGS + +static inline void set_page_section(struct page *page, unsigned long section) +{ + page->flags &= ~(SECTIONS_MASK << SECTIONS_PGSHIFT); + page->flags |= (section & SECTIONS_MASK) << SECTIONS_PGSHIFT; +} + +static inline unsigned long page_to_section(const struct page *page) +{ + return (page->flags >> SECTIONS_PGSHIFT) & SECTIONS_MASK; +} +#endif + +#endif /* _LINUX_MM_PAGE_SECTION_H */ From patchwork Thu Feb 22 11:50:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Max Kellermann X-Patchwork-Id: 13567166 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 3BB0DC48BEB for ; Thu, 22 Feb 2024 11:51:19 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 41A1E6B007B; Thu, 22 Feb 2024 06:51:10 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 3A3456B007E; Thu, 22 Feb 2024 06:51:10 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1F5056B0080; Thu, 22 Feb 2024 06:51:10 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 03DDD6B007B for ; Thu, 22 Feb 2024 06:51:10 -0500 (EST) Received: from smtpin07.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id D8EBB80D88 for ; Thu, 22 Feb 2024 11:51:09 +0000 (UTC) X-FDA: 81819273858.07.53C7E09 Received: from mail-wm1-f53.google.com (mail-wm1-f53.google.com [209.85.128.53]) by imf09.hostedemail.com (Postfix) with ESMTP id 18F6D140005 for ; Thu, 22 Feb 2024 11:51:07 +0000 (UTC) Authentication-Results: imf09.hostedemail.com; dkim=pass header.d=ionos.com header.s=google header.b=c0HDr1Ar; dmarc=pass (policy=quarantine) header.from=ionos.com; spf=pass (imf09.hostedemail.com: domain of max.kellermann@ionos.com designates 209.85.128.53 as permitted sender) smtp.mailfrom=max.kellermann@ionos.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1708602668; 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-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=TYSYlSdUn/dXTjpoW2eB+NQW7lqG+bTDZOpmc2h8jwc=; b=60x0pE43kDQbiOZiODy/guNj0zG1iWaESphzsScgP7hCCBO1qnlnb0glGXShr7MlbAfltF 3B2tRjmBYrPx7TVqQyDbr8IlEX/VhVLwyuzwqir6OxinSCtxMVQR/UvyAkunluxWCJNG5Y qwO8DpoaWnFKoWiDPkn9F0/PiMmpJP8= ARC-Authentication-Results: i=1; imf09.hostedemail.com; dkim=pass header.d=ionos.com header.s=google header.b=c0HDr1Ar; dmarc=pass (policy=quarantine) header.from=ionos.com; spf=pass (imf09.hostedemail.com: domain of max.kellermann@ionos.com designates 209.85.128.53 as permitted sender) smtp.mailfrom=max.kellermann@ionos.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1708602668; a=rsa-sha256; cv=none; b=dfsaQOXl4k4anxoX0AEynLQH24XVhPGsR72zuxxjGGvtQbdScRs0v/8lhvOKIE9gMuEW5R mel2UqesyqSZfnAnOpYQau2Omc6uzHh1Q6vOANHij+sa4g3P7swhj8+jurf5Rmp7SviYm3 S5/k/XDUdPl2J/8wD56yaXJ6KyM3pZQ= Received: by mail-wm1-f53.google.com with SMTP id 5b1f17b1804b1-41273f53c71so13504325e9.1 for ; Thu, 22 Feb 2024 03:51:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ionos.com; s=google; t=1708602667; x=1709207467; darn=kvack.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=TYSYlSdUn/dXTjpoW2eB+NQW7lqG+bTDZOpmc2h8jwc=; b=c0HDr1ArOoqFhtM7ccSDPPvo4Trl2Oz02cqfXsWw/fjgs5Yd0/rYbZeAPkmliQG4do xOUNkWZl7DTeXdOhWEf7XaQxQuVZPzusraAFa3v9F3xqxqxlU9QtMq87SLSWJsMlp8tk tZCEZMeftpt7v65O2fg9GUEQu1V7ylsNARiJ0Giwtp+OVg9pK2KowXNVHNHZyKmc1AvC N/jQf/dXHOUU3/rjVaCjgFlbEcA5g6pPo5dtKZ0RgIJNCZZxWzunC/0OOCvwNweORidU FXeBR4foY64T2Nu/TM0AQPQnEwVrdNOBsrn5yxsbdH2ckEPExoPhlgUgMbhfH7KdTY76 h8DA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708602667; x=1709207467; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=TYSYlSdUn/dXTjpoW2eB+NQW7lqG+bTDZOpmc2h8jwc=; b=V56ScqewiLuIQ8KYvkYsZ0ry1dC0QCAvZAlTx4ok8vrLgofIqnrtRGkwsaof35GRej NJAM6QjS3arGPN6G9iUpxFqnW0bOZQv/EdLLE5w38JoJgRcyzqiZBWIzCKIOSwGrh6qT KvD8IIonh3gtZfvnIlCxr0wnKA2FDqSoliURCztAUYm4SpUq9jQ059Hh9TQJi7m+zKJh uzIC96jUtgllnStAzEM8yFfNLfD1H3ibYENEVtmLSOS7mezRrIgdYP38WsZGcR8Nawg1 G5Z0/qX1Q28s/nhmhOXZnc03M4K8MkTDLVbuleNAvsqC/SqrWkZkZGiSd/E+zDpfBbJZ gu1Q== X-Forwarded-Encrypted: i=1; AJvYcCXsSWDFOVi7h9rgZnVSzFhPalA/pP+oPtDEULx26weKeD5YCIuAfs6o1H8nBKIomFLFJgcM5A9CEKHH6ItwbcYbwNI= X-Gm-Message-State: AOJu0Yw/BF/f2LcJ2D4pcrVgajyPy2EZPUBB3wqLaJB43VRhveTEPHlg hWXiTez6qObgbk/AZNzaSPmhZibTM+ZgvsNAwmbLtCaVEJxjUJ12W8t9aoTA7UfL747R0Ru/Uda D X-Google-Smtp-Source: AGHT+IFW5wFv4Nr2vL4lmZv1xSYSknW8VzR0FHgUnlq32KXpNWXRidmFH8ltDuIb+OCkhQa5lrc0ng== X-Received: by 2002:a05:600c:3c8a:b0:411:9508:e237 with SMTP id bg10-20020a05600c3c8a00b004119508e237mr17669840wmb.19.1708602666816; Thu, 22 Feb 2024 03:51:06 -0800 (PST) Received: from raven.intern.cm-ag (p200300dc6f010900023064fffe740809.dip0.t-ipconnect.de. [2003:dc:6f01:900:230:64ff:fe74:809]) by smtp.gmail.com with ESMTPSA id co18-20020a0560000a1200b0033d4c3b0beesm15044920wrb.19.2024.02.22.03.51.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Feb 2024 03:51:06 -0800 (PST) From: Max Kellermann To: akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: willy@infradead.org, Max Kellermann Subject: [PATCH v2 05/14] linux/mm.h: move page_address() and others to mm/page_address.h Date: Thu, 22 Feb 2024 12:50:46 +0100 Message-Id: <20240222115055.1172877-6-max.kellermann@ionos.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240222115055.1172877-1-max.kellermann@ionos.com> References: <20240222115055.1172877-1-max.kellermann@ionos.com> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: 18F6D140005 X-Stat-Signature: ki3enwz5bgzyztanf97roiq7bp3ue88m X-HE-Tag: 1708602667-349414 X-HE-Meta: U2FsdGVkX19Jymq6I2VkvV0QhlZeyh0ypevGunNhbOAJPzh7JpFJfU9zIjhjH7MTuIKpLvKvDEtaAHIWEYnz0dVMjuMgDYZzKY0U9CGpuESw48PNEO9g2HM69EPDqlLR0sVlaWvIc33WCHnNH8D2HUgVetOY25/lxUuX5snFjHB9XwC0kbacJXW1t7OZ2WuniMnr393V9+crLhiSthXW1FDkG4ivf72AwygU6oOpnUntknitq4GY5HpG4hhhm+QmUpuC5sWtMtt/gpofdD1AAJskG/7oz6ADWlkBGEq5l+4JcJBR22BKiSa+2165lR49lyEWxXG+wA8rc7COiyTZwdxSyeUcFB6yNxr8UqTSfqR2bZsLdBxfyngSeQNkYEEhBGxr+l5BTpD4btD1TstRSuYOS/M7lcLw8jzrWJ17Us3r17b3AuhTFAo92lbAOj0KtoOXWfAwb32hdsl1iCtigKmF/cXTJiGohL8jZS4oWHRaauVux/DPPfHCme8UNmLTAlsK9zcKT3VxFKB537db9qcy6izIhkQSsoORCZKM/OvfOg4LHskKK+q++Zh1S7ArlkWdAMFdbaQhR7xuzUbqvP3I3fMdb5D4RKkPrWmSVoHFy4kbEWNPHO8cBBsZklt3UyyCsXypUsUGrejs+X032MsQHSMHQHyZsBJsin1BBgyOPD9nUNc4qGlbuR455F9S9sDMFRSkGAUTMLm0Z+wELkKRXW3IFkWurKq7EGDnOOMacht7V4l5caM1wIrw4le9d41wLiizR7IOG7nHt6U5FLkGItEPLdtPJixWpxBrvYeZM5ZvWUGL7szxL42xTJCWtYwoYIvTQ2XVAbLMjVG41dLKFMiIZm/85DGg0ZHk4cWxb/HpbZlqtIDDeuzUIt7STiXM2IB/8wr4T2m8gpSHOv0CrHdfyBWwNN21Q+8jNNWt+08SI6L0rT7lYwJ1M5C/3PgvFmbOwJ+ZOa+omPb Qaenpw8U sm3adGYWNuktCbRI864cxukXbyhCo4DGS9G3LeNe0kWw3ZqX2XANkhCTkf1Igs8Di6u3dknkbXHMTEYZEmuD4o4stOpfEbR7FkUc+Zjcgytlaj2zFAMCPVEUxmonohP96ZEGt5+vwrfoCqCwtgaSOv09aVVfdY24JtGl3 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: Prepare to reduce dependencies on linux/mm.h. page_address() is used by the following popular headers: - linux/bio.h - linux/bvec.h - linux/highmem.h - linux/scatterlist.h - linux/skbuff.h Moving it to a separate lean header will allow us to avoid the dependency on linux/mm.h. Signed-off-by: Max Kellermann --- include/linux/mm.h | 56 +------------------------- include/linux/mm/page_address.h | 71 +++++++++++++++++++++++++++++++++ 2 files changed, 72 insertions(+), 55 deletions(-) create mode 100644 include/linux/mm/page_address.h diff --git a/include/linux/mm.h b/include/linux/mm.h index 7c3d2bd69818..57c091e7579e 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -2,7 +2,7 @@ #ifndef _LINUX_MM_H #define _LINUX_MM_H -#include +#include #include #include #include @@ -103,10 +103,6 @@ extern int mmap_rnd_compat_bits __read_mostly; #define __pa_symbol(x) __pa(RELOC_HIDE((unsigned long)(x), 0)) #endif -#ifndef page_to_virt -#define page_to_virt(x) __va(PFN_PHYS(page_to_pfn(x))) -#endif - #ifndef lm_alias #define lm_alias(x) __va(__pa_symbol(x)) #endif @@ -210,14 +206,6 @@ int overcommit_kbytes_handler(struct ctl_table *, int, void *, size_t *, int overcommit_policy_handler(struct ctl_table *, int, void *, size_t *, loff_t *); -#if defined(CONFIG_SPARSEMEM) && !defined(CONFIG_SPARSEMEM_VMEMMAP) -#define nth_page(page,n) pfn_to_page(page_to_pfn((page)) + (n)) -#define folio_page_idx(folio, p) (page_to_pfn(p) - folio_pfn(folio)) -#else -#define nth_page(page,n) ((page) + (n)) -#define folio_page_idx(folio, p) ((p) - &(folio)->page) -#endif - /* to align the pointer to the (next) page boundary */ #define PAGE_ALIGN(addr) ALIGN(addr, PAGE_SIZE) @@ -2122,44 +2110,6 @@ static inline int arch_make_folio_accessible(struct folio *folio) */ #include -static __always_inline void *lowmem_page_address(const struct page *page) -{ - return page_to_virt(page); -} - -#if defined(CONFIG_HIGHMEM) && !defined(WANT_PAGE_VIRTUAL) -#define HASHED_PAGE_VIRTUAL -#endif - -#if defined(WANT_PAGE_VIRTUAL) -static inline void *page_address(const struct page *page) -{ - return page->virtual; -} -static inline void set_page_address(struct page *page, void *address) -{ - page->virtual = address; -} -#define page_address_init() do { } while(0) -#endif - -#if defined(HASHED_PAGE_VIRTUAL) -void *page_address(const struct page *page); -void set_page_address(struct page *page, void *virtual); -void page_address_init(void); -#endif - -#if !defined(HASHED_PAGE_VIRTUAL) && !defined(WANT_PAGE_VIRTUAL) -#define page_address(page) lowmem_page_address(page) -#define set_page_address(page, address) do { } while(0) -#define page_address_init() do { } while(0) -#endif - -static inline void *folio_address(const struct folio *folio) -{ - return page_address(&folio->page); -} - extern pgoff_t __page_file_index(struct page *page); /* @@ -2222,10 +2172,6 @@ static inline void clear_page_pfmemalloc(struct page *page) */ extern void pagefault_out_of_memory(void); -#define offset_in_page(p) ((unsigned long)(p) & ~PAGE_MASK) -#define offset_in_thp(page, p) ((unsigned long)(p) & (thp_size(page) - 1)) -#define offset_in_folio(folio, p) ((unsigned long)(p) & (folio_size(folio) - 1)) - /* * Parameter block passed down to zap_pte_range in exceptional cases. */ diff --git a/include/linux/mm/page_address.h b/include/linux/mm/page_address.h new file mode 100644 index 000000000000..e1aaacc5003f --- /dev/null +++ b/include/linux/mm/page_address.h @@ -0,0 +1,71 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef _LINUX_MM_PAGE_ADDRESS_H +#define _LINUX_MM_PAGE_ADDRESS_H + +#include // for struct page +#include // needed by the page_to_virt() macro on some architectures (e.g. arm64) +#include // for PAGE_MASK, page_to_virt() + +#if defined(CONFIG_FLATMEM) +#include // for memmap (used by __pfn_to_page()) +#elif defined(CONFIG_SPARSEMEM_VMEMMAP) +#include // for vmemmap (used by __pfn_to_page()) +#elif defined(CONFIG_SPARSEMEM) +#include // for page_to_section() (used by __page_to_pfn()) +#endif + +#ifndef page_to_virt +#define page_to_virt(x) __va(PFN_PHYS(page_to_pfn(x))) +#endif + +#if defined(CONFIG_SPARSEMEM) && !defined(CONFIG_SPARSEMEM_VMEMMAP) +#define nth_page(page,n) pfn_to_page(page_to_pfn((page)) + (n)) +#define folio_page_idx(folio, p) (page_to_pfn(p) - folio_pfn(folio)) +#else +#define nth_page(page,n) ((page) + (n)) +#define folio_page_idx(folio, p) ((p) - &(folio)->page) +#endif + +static __always_inline void *lowmem_page_address(const struct page *page) +{ + return page_to_virt(page); +} + +#if defined(CONFIG_HIGHMEM) && !defined(WANT_PAGE_VIRTUAL) +#define HASHED_PAGE_VIRTUAL +#endif + +#if defined(WANT_PAGE_VIRTUAL) +static inline void *page_address(const struct page *page) +{ + return page->virtual; +} +static inline void set_page_address(struct page *page, void *address) +{ + page->virtual = address; +} +#define page_address_init() do { } while(0) +#endif + +#if defined(HASHED_PAGE_VIRTUAL) +void *page_address(const struct page *page); +void set_page_address(struct page *page, void *virtual); +void page_address_init(void); +#endif + +#if !defined(HASHED_PAGE_VIRTUAL) && !defined(WANT_PAGE_VIRTUAL) +#define page_address(page) lowmem_page_address(page) +#define set_page_address(page, address) do { } while(0) +#define page_address_init() do { } while(0) +#endif + +static inline void *folio_address(const struct folio *folio) +{ + return page_address(&folio->page); +} + +#define offset_in_page(p) ((unsigned long)(p) & ~PAGE_MASK) +#define offset_in_thp(page, p) ((unsigned long)(p) & (thp_size(page) - 1)) +#define offset_in_folio(folio, p) ((unsigned long)(p) & (folio_size(folio) - 1)) + +#endif /* _LINUX_MM_PAGE_ADDRESS_H */ From patchwork Thu Feb 22 11:50:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Max Kellermann X-Patchwork-Id: 13567167 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 DD480C54788 for ; Thu, 22 Feb 2024 11:51:21 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id AD1576B007E; Thu, 22 Feb 2024 06:51:11 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id A5ACA6B0080; Thu, 22 Feb 2024 06:51:11 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8125F6B0081; Thu, 22 Feb 2024 06:51:11 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 67D886B007E for ; Thu, 22 Feb 2024 06:51:11 -0500 (EST) Received: from smtpin28.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 474AF1C0427 for ; Thu, 22 Feb 2024 11:51:11 +0000 (UTC) X-FDA: 81819273942.28.0D60B77 Received: from mail-wr1-f41.google.com (mail-wr1-f41.google.com [209.85.221.41]) by imf17.hostedemail.com (Postfix) with ESMTP id 58BF84000C for ; Thu, 22 Feb 2024 11:51:09 +0000 (UTC) Authentication-Results: imf17.hostedemail.com; dkim=pass header.d=ionos.com header.s=google header.b=Y3N0noEb; dmarc=pass (policy=quarantine) header.from=ionos.com; spf=pass (imf17.hostedemail.com: domain of max.kellermann@ionos.com designates 209.85.221.41 as permitted sender) smtp.mailfrom=max.kellermann@ionos.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1708602669; 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-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=zrzkS3Jr9rDGJgnZMZCc9dS49bV9O/AFecbIWIE3ZsM=; b=nDY6JcevV1Ud0vb2wtsKYM0w/K/uRMEWfQ0i1tXiXAwIn1kewjcMcnUV6FsnXns1e7Euvd KQ7t4qhHg8mJT5T0YsRogoVu5Bq3P4C1n+AC1QzCLuNrT4/JtVEiwe10JJZEaHtUaB3lNP HBbS2D9D8EJbY+zPahQMDWEp4okSTXs= ARC-Authentication-Results: i=1; imf17.hostedemail.com; dkim=pass header.d=ionos.com header.s=google header.b=Y3N0noEb; dmarc=pass (policy=quarantine) header.from=ionos.com; spf=pass (imf17.hostedemail.com: domain of max.kellermann@ionos.com designates 209.85.221.41 as permitted sender) smtp.mailfrom=max.kellermann@ionos.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1708602669; a=rsa-sha256; cv=none; b=0wrx70oCOKDKcIEzPlFUZn/V0XtWpM5yrZ8kpV7Iwt24j53QZnYWqj4rrXJFriKg68uyel KLFiVUt/D+1W6q6N6c6LQTgP0Q01YBOMM39L6rZtt2kTZl17ex1mSa4VR3lgUMFr2HnqU4 BQEDQiHf088RpAz4E0GdrVoyC0TFEnY= Received: by mail-wr1-f41.google.com with SMTP id ffacd0b85a97d-33d6f1f17e5so1753755f8f.3 for ; Thu, 22 Feb 2024 03:51:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ionos.com; s=google; t=1708602668; x=1709207468; darn=kvack.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=zrzkS3Jr9rDGJgnZMZCc9dS49bV9O/AFecbIWIE3ZsM=; b=Y3N0noEbXgUoT0rTEbwsfiTe5wzsq/yPPPybxdoc2zjVFITxO0ynwi45YOIiJf4q02 5PasvsteQCqLYRD6a+X3Z6kpfvyMT7CEQNt52YjjoK2UK6aPFKoP+lynn57JhnuKB0aw iiNq70r0EZtRv5N4plbCRTcz4d5Md8He21lZ/s4rXOwiRehcpDLMZN24lGB9Q1SFgdMZ 58sv8wc6yY0NaHVDEbUAPoEEU+5N8r0/c6DZfK7J/VVGc76C+GEB4EFrVLs+LC2S2kyp zKUKNNRnzsqMlsfuzp18LIKcRjcyImnIFrQUQoXg9T4NPdRHmlh0mwMBL7hDav8mo3t+ V6ig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708602668; x=1709207468; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=zrzkS3Jr9rDGJgnZMZCc9dS49bV9O/AFecbIWIE3ZsM=; b=rBMQZPK1eEjmoyTCYOTtcFoBNSQPFp1X6atfB+WnBV2CMXFLmD6qefLVDWT1hFYnCJ CBTLmCQMI9H53FTP2GKaKWpsQS0Wmpa+GLOuBQtq2kDtMBsJKUHR7t7A9kik/lXlXXqm +R/O7kMt876OkkrpHW6z6NOvwQ9fg8abtqJdXjavY9fJBIVvL8vPju3/9lq6hjP9dHo6 K7ipZpxUCgMcdx4JIpxKmcwRqVzHDBuPlap9RQHDU88mMLhu7OLLh66ePXoJWx28zfqp kmqiCW0dVtbfJ/dKZ7kcuVUpjG3DHXdgiJ9Z64gqKhzvHirH55nLd71etnInsT/n+qvm Xw9Q== X-Forwarded-Encrypted: i=1; AJvYcCVg7uVcw+n4k4tDePaRI4Yg62D0ixkWKqAiNk9Z6aM9n0kdnTxp7KxoEBpBTcqtPznroFHlp9J5WH2edKix2D+snb0= X-Gm-Message-State: AOJu0YwZyAgs9swJezZ/4sLnxQvleIJsa5M1y9ppXpAnQTzxIamqJNPg UBSthV+Pv5HNt0i8bxqtthOKC20V5vQSsBAgayV0jh5E0765l30GtSYhEeejZDI= X-Google-Smtp-Source: AGHT+IEf30oKm3SvDXvZCjTXb955DQvutxWXp0IjhfwewVF9FwEP1ddQHLarxc6WQx8FTmkpa5t7tA== X-Received: by 2002:a5d:54c4:0:b0:33d:887c:fe04 with SMTP id x4-20020a5d54c4000000b0033d887cfe04mr1569315wrv.19.1708602667899; Thu, 22 Feb 2024 03:51:07 -0800 (PST) Received: from raven.intern.cm-ag (p200300dc6f010900023064fffe740809.dip0.t-ipconnect.de. [2003:dc:6f01:900:230:64ff:fe74:809]) by smtp.gmail.com with ESMTPSA id co18-20020a0560000a1200b0033d4c3b0beesm15044920wrb.19.2024.02.22.03.51.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Feb 2024 03:51:07 -0800 (PST) From: Max Kellermann To: akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: willy@infradead.org, Max Kellermann Subject: [PATCH v2 06/14] linux/mm.h: move folio_size(), ... to mm/folio_size.h Date: Thu, 22 Feb 2024 12:50:47 +0100 Message-Id: <20240222115055.1172877-7-max.kellermann@ionos.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240222115055.1172877-1-max.kellermann@ionos.com> References: <20240222115055.1172877-1-max.kellermann@ionos.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: 58BF84000C X-Rspam-User: X-Rspamd-Server: rspam05 X-Stat-Signature: t155rmk7cdswz77fr9ref63hghxc7ou8 X-HE-Tag: 1708602669-501197 X-HE-Meta: U2FsdGVkX1/CuaoK1AzK+fjYDE3F/q2WRp0Xd3IzQh4tH219UlUZJ1V4fUYYI70ptvKvwvLcbJrF7VuloKBWk9pePRviZMBo1vkO+o8Cdpmkk4TKEDZm+9rqKWl4miyWzpmhoz3Kt5s648ESBYWw9HU8ADiD2D0fdXqZ7QD0LqS0cEA/pTDqGVQihaGd/lpAwjId/PkowkdL1t3pp0cT7P8lYHTUzBWa7a+xV42r+YCtjq2wbtixdh0vgblqzyYEOf+Poa9srXlZgnhG9/z5VwXS+WteDfdGYrVfcmayAh5qkkWqA8VEmE7UijuI7ySSKTkXZcsm9zk2E8oobICM3IgIFa3lJBNRLtukNyBNNOhimUDaiCjzosWFiWhBnRwYJqAKLolTi8PmHFHA7TpIQL6MKpgRj9in2u6GtcdGp1e44TpEsyI28JikseHC4cFap0k1qwfUbI1NrRzB4CDJ32F9dh/pkNMIjhnqwuW1ZhXthkrSYDBx4OGNjNu1qQ7vvV0lpveFtpbR/YU6hoEGYftgw1CigMjFmu9ddX74xaHrwpR+QqBEsUJ9rTXZP0DqUbOXMIR6ixVKTZhj1UV+1Dj1UQwVqsSFYUWnykl2Ki1J8xPym81bdprK5dtSL7KShCXMCKpWEeY1NA6WoGG4fgEu6TOesDmeJG+AFf3dCfGcfQ+pbmCaDJ/DkxghCqU1lgjI3doeYvwSGK60ke92ytsBaZHpYXGQZw3xaY50SK+5P+5SdJCvX4vufUH2o7q5qTghLM92zJN/ghnGAyLAtacn8j94aXabi8yB3GXB2pfPf1zP69DwZCK9obKV2s2qrCFSdAnBQNO7ffjePWShFtPElvxwkWyXJsYQ/FOfRciAL95AJzuCTZiSUJjBhPlgB5j3uLgIq7e29Jt0pbXv5ap7NNPyXDDIsIPBKl01WMjTQlE7vcGAK/IBteQn0mtoKepga8tfa1tW9vzosM4 oAnSP1pF c3EnVvLyXWT0GJvp2Wawrs+LXL8KayLaG41b/MRXlTQArnOPjeT/lack2GHJrtEM5inbs7M30OA7SHC2fbGDBcgKdfl9hz8jQAAPKjNkvU/xRqwTfMCkGz8zJtv33ZVDebTTkePj9q0szkzGKUUADWqwejCNarWE/TYWb0kOIVYx6pkqgK/0VSaiHXa0JKl7VFHkeOwc8zr3Qx9ElCTOETIrtit2Yn6XfuTacnTT6fPdzlJ9BDHqfzBo4rr3EK/Jtr5ps3TJfhDwlnlOFLx1cHV4mnHTIwpeHWNJnr6WnIypPNJG4m4aTNAPt+TKibZ2SV7ySjr1kafwRTQ+R/5cAg5rSfS+i6u+GDS+lWmzu0LcagTwkY+wg+eLO/9xZW/FUAJG2XMYxr1B2juYqGNJDUz6UB4EFIHm/OEpYHPtN0moZGuE= 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: Prepare to reduce dependencies on linux/mm.h. folio_size()/page_size() are used by the following popular headers: - linux/highmem.h - linux/iov_iter.h - linux/pagemap.h Moving them to a separate lean header will allow us to avoid the dependency on linux/mm.h. Additionally, it allows us to move folio_next() to a separate header, because it needs folio_nr_pages() which is also moved to folio_size.h. Signed-off-by: Max Kellermann --- include/linux/mm.h | 140 +------------------------------ include/linux/mm/folio_size.h | 150 ++++++++++++++++++++++++++++++++++ 2 files changed, 151 insertions(+), 139 deletions(-) create mode 100644 include/linux/mm/folio_size.h diff --git a/include/linux/mm.h b/include/linux/mm.h index 57c091e7579e..9dea6477b4ac 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -2,6 +2,7 @@ #ifndef _LINUX_MM_H #define _LINUX_MM_H +#include #include #include #include @@ -1054,38 +1055,6 @@ int vma_is_stack_for_current(struct vm_area_struct *vma); struct mmu_gather; struct inode; -/* - * compound_order() can be called without holding a reference, which means - * that niceties like page_folio() don't work. These callers should be - * prepared to handle wild return values. For example, PG_head may be - * set before the order is initialised, or this may be a tail page. - * See compaction.c for some good examples. - */ -static inline unsigned int compound_order(struct page *page) -{ - struct folio *folio = (struct folio *)page; - - if (!test_bit(PG_head, &folio->flags)) - return 0; - return folio->_flags_1 & 0xff; -} - -/** - * folio_order - The allocation order of a folio. - * @folio: The folio. - * - * A folio is composed of 2^order pages. See get_order() for the definition - * of order. - * - * Return: The order of the folio. - */ -static inline unsigned int folio_order(struct folio *folio) -{ - if (!folio_test_large(folio)) - return 0; - return folio->_flags_1 & 0xff; -} - #include /* @@ -1299,39 +1268,6 @@ unsigned long nr_free_buffer_pages(void); void destroy_large_folio(struct folio *folio); -/* Returns the number of bytes in this potentially compound page. */ -static inline unsigned long page_size(struct page *page) -{ - return PAGE_SIZE << compound_order(page); -} - -/* Returns the number of bits needed for the number of bytes in a page */ -static inline unsigned int page_shift(struct page *page) -{ - return PAGE_SHIFT + compound_order(page); -} - -/** - * thp_order - Order of a transparent huge page. - * @page: Head page of a transparent huge page. - */ -static inline unsigned int thp_order(struct page *page) -{ - VM_BUG_ON_PGFLAGS(PageTail(page), page); - return compound_order(page); -} - -/** - * thp_size - Size of a transparent huge page. - * @page: Head page of a transparent huge page. - * - * Return: Number of bytes in this page. - */ -static inline unsigned long thp_size(struct page *page) -{ - return PAGE_SIZE << thp_order(page); -} - #ifdef CONFIG_MMU /* * Do pte_mkwrite, but only if the vma says VM_WRITE. We do this when @@ -1971,50 +1907,6 @@ static inline void set_page_links(struct page *page, enum zone_type zone, #endif } -/** - * folio_nr_pages - The number of pages in the folio. - * @folio: The folio. - * - * Return: A positive power of two. - */ -static inline long folio_nr_pages(struct folio *folio) -{ - if (!folio_test_large(folio)) - return 1; -#ifdef CONFIG_64BIT - return folio->_folio_nr_pages; -#else - return 1L << (folio->_flags_1 & 0xff); -#endif -} - -/* - * compound_nr() returns the number of pages in this potentially compound - * page. compound_nr() can be called on a tail page, and is defined to - * return 1 in that case. - */ -static inline unsigned long compound_nr(struct page *page) -{ - struct folio *folio = (struct folio *)page; - - if (!test_bit(PG_head, &folio->flags)) - return 1; -#ifdef CONFIG_64BIT - return folio->_folio_nr_pages; -#else - return 1L << (folio->_flags_1 & 0xff); -#endif -} - -/** - * thp_nr_pages - The number of regular pages in this huge page. - * @page: The head page of a huge page. - */ -static inline int thp_nr_pages(struct page *page) -{ - return folio_nr_pages((struct folio *)page); -} - /** * folio_next - Move to the next physical folio. * @folio: The folio we're currently operating on. @@ -2034,36 +1926,6 @@ static inline struct folio *folio_next(struct folio *folio) return (struct folio *)folio_page(folio, folio_nr_pages(folio)); } -/** - * folio_shift - The size of the memory described by this folio. - * @folio: The folio. - * - * A folio represents a number of bytes which is a power-of-two in size. - * This function tells you which power-of-two the folio is. See also - * folio_size() and folio_order(). - * - * Context: The caller should have a reference on the folio to prevent - * it from being split. It is not necessary for the folio to be locked. - * Return: The base-2 logarithm of the size of this folio. - */ -static inline unsigned int folio_shift(struct folio *folio) -{ - return PAGE_SHIFT + folio_order(folio); -} - -/** - * folio_size - The number of bytes in a folio. - * @folio: The folio. - * - * Context: The caller should have a reference on the folio to prevent - * it from being split. It is not necessary for the folio to be locked. - * Return: The number of bytes in this folio. - */ -static inline size_t folio_size(struct folio *folio) -{ - return PAGE_SIZE << folio_order(folio); -} - /** * folio_estimated_sharers - Estimate the number of sharers of a folio. * @folio: The folio. diff --git a/include/linux/mm/folio_size.h b/include/linux/mm/folio_size.h new file mode 100644 index 000000000000..dd8af39ef572 --- /dev/null +++ b/include/linux/mm/folio_size.h @@ -0,0 +1,150 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef _LINUX_MM_FOLIO_SIZE_H +#define _LINUX_MM_FOLIO_SIZE_H + +#include // for test_bit() +#include // for VM_BUG_ON_PGFLAGS() +#include // for struct page +#include // for folio_test_large() +#include // for PAGE_SIZE, PAGE_SHIFT + +/* + * compound_order() can be called without holding a reference, which means + * that niceties like page_folio() don't work. These callers should be + * prepared to handle wild return values. For example, PG_head may be + * set before the order is initialised, or this may be a tail page. + * See compaction.c for some good examples. + */ +static inline unsigned int compound_order(struct page *page) +{ + struct folio *folio = (struct folio *)page; + + if (!test_bit(PG_head, &folio->flags)) + return 0; + return folio->_flags_1 & 0xff; +} + +/** + * folio_order - The allocation order of a folio. + * @folio: The folio. + * + * A folio is composed of 2^order pages. See get_order() for the definition + * of order. + * + * Return: The order of the folio. + */ +static inline unsigned int folio_order(struct folio *folio) +{ + if (!folio_test_large(folio)) + return 0; + return folio->_flags_1 & 0xff; +} + +/* Returns the number of bytes in this potentially compound page. */ +static inline unsigned long page_size(struct page *page) +{ + return PAGE_SIZE << compound_order(page); +} + +/* Returns the number of bits needed for the number of bytes in a page */ +static inline unsigned int page_shift(struct page *page) +{ + return PAGE_SHIFT + compound_order(page); +} + +/** + * thp_order - Order of a transparent huge page. + * @page: Head page of a transparent huge page. + */ +static inline unsigned int thp_order(struct page *page) +{ + VM_BUG_ON_PGFLAGS(PageTail(page), page); + return compound_order(page); +} + +/** + * thp_size - Size of a transparent huge page. + * @page: Head page of a transparent huge page. + * + * Return: Number of bytes in this page. + */ +static inline unsigned long thp_size(struct page *page) +{ + return PAGE_SIZE << thp_order(page); +} + +/** + * folio_nr_pages - The number of pages in the folio. + * @folio: The folio. + * + * Return: A positive power of two. + */ +static inline long folio_nr_pages(struct folio *folio) +{ + if (!folio_test_large(folio)) + return 1; +#ifdef CONFIG_64BIT + return folio->_folio_nr_pages; +#else + return 1L << (folio->_flags_1 & 0xff); +#endif +} + +/* + * compound_nr() returns the number of pages in this potentially compound + * page. compound_nr() can be called on a tail page, and is defined to + * return 1 in that case. + */ +static inline unsigned long compound_nr(struct page *page) +{ + struct folio *folio = (struct folio *)page; + + if (!test_bit(PG_head, &folio->flags)) + return 1; +#ifdef CONFIG_64BIT + return folio->_folio_nr_pages; +#else + return 1L << (folio->_flags_1 & 0xff); +#endif +} + +/** + * thp_nr_pages - The number of regular pages in this huge page. + * @page: The head page of a huge page. + */ +static inline int thp_nr_pages(struct page *page) +{ + return folio_nr_pages((struct folio *)page); +} + +/** + * folio_shift - The size of the memory described by this folio. + * @folio: The folio. + * + * A folio represents a number of bytes which is a power-of-two in size. + * This function tells you which power-of-two the folio is. See also + * folio_size() and folio_order(). + * + * Context: The caller should have a reference on the folio to prevent + * it from being split. It is not necessary for the folio to be locked. + * Return: The base-2 logarithm of the size of this folio. + */ +static inline unsigned int folio_shift(struct folio *folio) +{ + return PAGE_SHIFT + folio_order(folio); +} + +/** + * folio_size - The number of bytes in a folio. + * @folio: The folio. + * + * Context: The caller should have a reference on the folio to prevent + * it from being split. It is not necessary for the folio to be locked. + * Return: The number of bytes in this folio. + */ +static inline size_t folio_size(struct folio *folio) +{ + return PAGE_SIZE << folio_order(folio); +} + +#endif /* _LINUX_MM_FOLIO_SIZE_H_H */ From patchwork Thu Feb 22 11:50:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Max Kellermann X-Patchwork-Id: 13567168 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 B2F45C48BEB for ; Thu, 22 Feb 2024 11:51:24 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 359F76B0083; Thu, 22 Feb 2024 06:51:13 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 293436B0087; Thu, 22 Feb 2024 06:51:13 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id F14A76B0083; Thu, 22 Feb 2024 06:51:12 -0500 (EST) 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 CCC266B0081 for ; Thu, 22 Feb 2024 06:51:12 -0500 (EST) Received: from smtpin19.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id A440680D93 for ; Thu, 22 Feb 2024 11:51:12 +0000 (UTC) X-FDA: 81819273984.19.2BFC4C7 Received: from mail-lj1-f174.google.com (mail-lj1-f174.google.com [209.85.208.174]) by imf12.hostedemail.com (Postfix) with ESMTP id B68B840011 for ; Thu, 22 Feb 2024 11:51:10 +0000 (UTC) Authentication-Results: imf12.hostedemail.com; dkim=pass header.d=ionos.com header.s=google header.b="L1UxO/mH"; dmarc=pass (policy=quarantine) header.from=ionos.com; spf=pass (imf12.hostedemail.com: domain of max.kellermann@ionos.com designates 209.85.208.174 as permitted sender) smtp.mailfrom=max.kellermann@ionos.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1708602670; 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-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=B9RcqoFubCuQScg9fnwnkgqqvXJKp60zqkqXexg+avE=; b=u+eYp1E39I2jTzIbURUz/te0yzrADk6L+YLLjgEP0xXujRji7Pbxu+KJRbdDE23i8MZbKH jvqpU49GY5TbbTV0k8Tv8BFJtgsyBQr6BRoMEAuUvlYG8K5q/q89ec/0GdqNKtYVHn/wll rmdU90U8m1aOv+xuhsecqpz0GuO0pMI= ARC-Authentication-Results: i=1; imf12.hostedemail.com; dkim=pass header.d=ionos.com header.s=google header.b="L1UxO/mH"; dmarc=pass (policy=quarantine) header.from=ionos.com; spf=pass (imf12.hostedemail.com: domain of max.kellermann@ionos.com designates 209.85.208.174 as permitted sender) smtp.mailfrom=max.kellermann@ionos.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1708602670; a=rsa-sha256; cv=none; b=008ARiK6A8Z8LsaSmwauX7RCZidBxAcJyjZ6N8ud78/BLoip9ChCSeor+GZJGJOTlLOchv +i68JZqlli75CABz0pn7ktI3qBKlxhF/56ZaVZwAz08x46vJhbChA/YmDexTPDnU0l8P/B fKjqenYXh5MmY4OOwBOCcqevrL57qOo= Received: by mail-lj1-f174.google.com with SMTP id 38308e7fff4ca-2d26227d508so5279881fa.2 for ; Thu, 22 Feb 2024 03:51:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ionos.com; s=google; t=1708602669; x=1709207469; darn=kvack.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=B9RcqoFubCuQScg9fnwnkgqqvXJKp60zqkqXexg+avE=; b=L1UxO/mHPYpeimDVcBNl8/jL1vZotIhfxT9pnmnI1CaCxoMuiGRYkg+IYC/7V8n8xQ 7OcBiFRgjAa9T2I3WetVlTdzb8B6Dp6X4uyDw/xQL6BMyicWyU+EG4RPt87hp9tP0xcQ S+nW43nQIH5zGOtvZBL6sRr4aazNgMGiPO2ss5X3Xy/w/ZHK+KJQSxbqJ6F4yWEqS+YL dtNOgRH+QKxx+YRVjnTE39QcXbyC6wVfYzP8TfmE+Q2pnuEWPUZ7MbfXa+retzGI9UPo SJZvCOzjfxvLkUd7BFjcXmY5Lifx9P+Yp218H30sXYs/YuCKrHkLfd7osGMPTQrzVBqK dneg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708602669; x=1709207469; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=B9RcqoFubCuQScg9fnwnkgqqvXJKp60zqkqXexg+avE=; b=MDg2cUMPU0kNOgu+RTWNw16Lx4egs0CH/aSIukklku36shmc3GBwV37y71md0PKSoO MJhJ7PQsDoDLfQMnW/TBhVrGRP5pcm6zy8z4UNwDVfSH2BqsHb3/69WN1i/d+L0I619S 66b2eV0B5JjKjxmfQzfmmRHDw5VbJtQw0ZuOyJ0mjZCzIOs+uSTcNKr5S6LepV3cC9N/ Cv1Hnk2/WbC3iEWlB7NcVvBvdcCRL7gNzUk0+vx6Um8Xg0SfZTsHHpZfUkEyRO7oXtPw jJZUCtW2JmBnNmsSerRb6yE3BB4+WbzgqI04PD1fQU7ODBShKtkYO5CizNcPnj4Ze1bA oIIA== X-Forwarded-Encrypted: i=1; AJvYcCV5di1lKQTI65yKGgoRic6IeGHGc+8x2/Nyn+JawEVH3a9gmxnfIQgaNoF5hFxY3FcHNaWYI2bhCAGgTPY5/OXnbh8= X-Gm-Message-State: AOJu0YygFZlyw24whhntsDQ5RaVA63b3pT2enZI7NA99sravCAgH39mz RwzQWU+GfU8Cy+2+Q5yolzE63JOaDh3DqvSUtIl7jCJi1V7j3KJZYyRw3X+vD0Q= X-Google-Smtp-Source: AGHT+IGYV+VkpS2jnAWZLT/C7Reb89sTXA/vTqKXcqskIPNbelgHAHgf9vgjrOTAJQbjmnMw0na1/w== X-Received: by 2002:a2e:968e:0:b0:2d2:43fd:391b with SMTP id q14-20020a2e968e000000b002d243fd391bmr6042449lji.26.1708602668784; Thu, 22 Feb 2024 03:51:08 -0800 (PST) Received: from raven.intern.cm-ag (p200300dc6f010900023064fffe740809.dip0.t-ipconnect.de. [2003:dc:6f01:900:230:64ff:fe74:809]) by smtp.gmail.com with ESMTPSA id co18-20020a0560000a1200b0033d4c3b0beesm15044920wrb.19.2024.02.22.03.51.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Feb 2024 03:51:08 -0800 (PST) From: Max Kellermann To: akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: willy@infradead.org, Max Kellermann Subject: [PATCH v2 07/14] linux/mm.h: move folio_next() to mm/folio_next.h Date: Thu, 22 Feb 2024 12:50:48 +0100 Message-Id: <20240222115055.1172877-8-max.kellermann@ionos.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240222115055.1172877-1-max.kellermann@ionos.com> References: <20240222115055.1172877-1-max.kellermann@ionos.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: B68B840011 X-Rspam-User: X-Rspamd-Server: rspam05 X-Stat-Signature: 8w8s4opafsedfught18e89b5qjea3ber X-HE-Tag: 1708602670-612110 X-HE-Meta: U2FsdGVkX18kttiuWJ8kKAFDI1jItIHF6ngM/Og3yf39IOyPFZFyWKG/OZpyWhmrDMZNMVorxYf6CZboskzAQcEy/oaegOCEqEljxCNJtuZEiLCP4bBtRZl5U+ZAzHaB0oydfVJ9AKLLBCa6nwfF+Iy9bOYy5AIbxUMXA7gsYTcBIq9VYRA04HG1KGkbd3pd4cs23GVIiJlbX4zZY6KIcxWfrJ5sT3sHjGFaxwqwNaBE/qf1WvHaQkqcQuHhMGir1PjhpsokaL5mxAt+Fm+lI/34qw5rct9wcw+SVIgPX0lla5rLeRhtDQmxpkdqNwP9nLG9iT+3T0RTRcnQ0WOiimbbedASXy8gzTaxz3ycoOuhMg+nzMByWphh0MPV4k3QhnokeNMnDPA2yBEQyJzO3pf5YghVKf4l980C98zSbWoe0uE7WVTxXtvt5Y9i7S9D08bxPm4UIVh8xE9xEjIwNbPZu4zDwvhk5OjT2fktBp1z2zPIgqf6cVavwT5Vq5SePFLgNC0p85bNivSXDWhNPqrDWz9tbJ6dRwUF2LAHp/BM8FlQ2pX7gZYhbLJfonL5sjXDAZTCM4w74hyBFYceG2cPUKKE2kiYyC/efGk6HIauLA2MswoT/XC7uvynDIPSdUkJz9VsChKBLCHpro+pzXUHtIvQRbY8Onlg7CFvUckBAkY74ysiF0RbqVQwSfrCQKagRoS6S+KFpAZsKeczUG/7UJ0rPadWfds6RvXIlDIfIEJdxWjiODEwtGMAyQFuk3LrpMJMfc5zAcG6SUMzjAxCa8Nl/LYerGIhp0pdjielHJG6dODE2H7krlWYI9T6vLQRdMKG6ei4Q+3PY9/jCOyzmCGKfmp5RBkLuoZV5dTGAch7fioDnEx5ZHdH/chJ6TUvz7lDYgYN+CcO9ayeo+fcnZmPYHGoG0HN13SKIgtXXZn0YEIzl4br82/OFzFerrcs+8fETEveA4NYtP1 nUaS7iaB RP1a905yThXirBDE5eNfWbVDaTXG/BH54rD0sX3iM0ZqSAeKOnP+4FDvmYcD6wjweT9iXg/HNkloUT6bcfBRqsC9fYjjHqzDgbcLWpzWGOGSM3T9ImcZiSlNJBc4OmoJQZ44lvnwpp2/HhoONY9/wklrGWXlCX8+R3YdD/+Pa1dhMf0D2PSsY2wZE8dExxkamiRrkKQcLJNPr/ONFtVUTIyWldizxk9EhrkJ04CjgSoW4PWvTIwcpCV2C/TbyGRtVkCF3PeJVC5LCS1XHbpaf0DmqVrZHqObEv6EpR3uuHhuPCPmIskVTgmJPNODOH8UqAw456V7fuQOMuynESTcFGDlZmxHsPThqbzXQWWJanSp6ecFZcNs2KXiMbevutYee6MWXYIaQRDR86t+CIb4svIoNpdl7ogSXpT+0lZeYH4IINQsBo5Sq63/t6iIwd9QfaqTCcc5fwV8AyDPo5rDVR5x/8g== 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: Prepare to reduce dependencies on linux/mm.h. folio_next() is used by linux/bio.h. Moving it to a separate lean header will allow us to avoid the dependency on linux/mm.h. Signed-off-by: Max Kellermann --- include/linux/mm.h | 20 +------------------- include/linux/mm/folio_next.h | 27 +++++++++++++++++++++++++++ 2 files changed, 28 insertions(+), 19 deletions(-) create mode 100644 include/linux/mm/folio_next.h diff --git a/include/linux/mm.h b/include/linux/mm.h index 9dea6477b4ac..7d83d6d64f30 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -2,6 +2,7 @@ #ifndef _LINUX_MM_H #define _LINUX_MM_H +#include #include #include #include @@ -1907,25 +1908,6 @@ static inline void set_page_links(struct page *page, enum zone_type zone, #endif } -/** - * folio_next - Move to the next physical folio. - * @folio: The folio we're currently operating on. - * - * If you have physically contiguous memory which may span more than - * one folio (eg a &struct bio_vec), use this function to move from one - * folio to the next. Do not use it if the memory is only virtually - * contiguous as the folios are almost certainly not adjacent to each - * other. This is the folio equivalent to writing ``page++``. - * - * Context: We assume that the folios are refcounted and/or locked at a - * higher level and do not adjust the reference counts. - * Return: The next struct folio. - */ -static inline struct folio *folio_next(struct folio *folio) -{ - return (struct folio *)folio_page(folio, folio_nr_pages(folio)); -} - /** * folio_estimated_sharers - Estimate the number of sharers of a folio. * @folio: The folio. diff --git a/include/linux/mm/folio_next.h b/include/linux/mm/folio_next.h new file mode 100644 index 000000000000..7016e303439c --- /dev/null +++ b/include/linux/mm/folio_next.h @@ -0,0 +1,27 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef _LINUX_MM_FOLIO_NEXT_H +#define _LINUX_MM_FOLIO_NEXT_H + +#include // for folio_nr_pages() +#include // for nth_page(), needed by folio_page() + +/** + * folio_next - Move to the next physical folio. + * @folio: The folio we're currently operating on. + * + * If you have physically contiguous memory which may span more than + * one folio (eg a &struct bio_vec), use this function to move from one + * folio to the next. Do not use it if the memory is only virtually + * contiguous as the folios are almost certainly not adjacent to each + * other. This is the folio equivalent to writing ``page++``. + * + * Context: We assume that the folios are refcounted and/or locked at a + * higher level and do not adjust the reference counts. + * Return: The next struct folio. + */ +static inline struct folio *folio_next(struct folio *folio) +{ + return (struct folio *)folio_page(folio, folio_nr_pages(folio)); +} + +#endif /* _LINUX_MM_FOLIO_NEXT_H */ From patchwork Thu Feb 22 11:50:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Max Kellermann X-Patchwork-Id: 13567169 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 2090EC48BF8 for ; Thu, 22 Feb 2024 11:51:27 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 83C656B0081; Thu, 22 Feb 2024 06:51:13 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 775FA6B0085; Thu, 22 Feb 2024 06:51:13 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 355C36B0081; Thu, 22 Feb 2024 06:51:13 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 053666B0081 for ; Thu, 22 Feb 2024 06:51:13 -0500 (EST) Received: from smtpin16.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 9D686C0DA6 for ; Thu, 22 Feb 2024 11:51:12 +0000 (UTC) X-FDA: 81819273984.16.03456E1 Received: from mail-wr1-f46.google.com (mail-wr1-f46.google.com [209.85.221.46]) by imf15.hostedemail.com (Postfix) with ESMTP id DB779A000C for ; Thu, 22 Feb 2024 11:51:10 +0000 (UTC) Authentication-Results: imf15.hostedemail.com; dkim=pass header.d=ionos.com header.s=google header.b=YZXFMNf4; spf=pass (imf15.hostedemail.com: domain of max.kellermann@ionos.com designates 209.85.221.46 as permitted sender) smtp.mailfrom=max.kellermann@ionos.com; dmarc=pass (policy=quarantine) header.from=ionos.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1708602671; 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-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=kxFeZ/0ASaJvoJHkw5FuQa0hU1Ih3iAyraY4h2cFePg=; b=xv+FykoiW6klE1lwgZO4bahk/XFBrH6gxgkU41hrUo++3WJZYwSylqv3Wb+9eiAll8L0bX nUHqohbcCyQBbcIpx6MlYqPs90IBFVEWLxyLK6w5yeT9t2NBOLrjFs/Rj4bSUXh9n4UvqV q9dLlUJikqsCONVPOQKzxnR+qL+uu3o= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1708602671; a=rsa-sha256; cv=none; b=wLH+PtY7K8b3F7f7kDB2FETok6qYVP3rz4X1IpBPySVrSwCXghHevO2JXz7/oS06WYRPjJ DGoHk6M+xSDIbvQ3ajn0496j/VEEytukLzuCFBAW9ip3TI+KpjHgBxkUwwolgr94ecYW1f Vwu2OSVlzHmtrMwh8dsYBJ9MvRTp2rk= ARC-Authentication-Results: i=1; imf15.hostedemail.com; dkim=pass header.d=ionos.com header.s=google header.b=YZXFMNf4; spf=pass (imf15.hostedemail.com: domain of max.kellermann@ionos.com designates 209.85.221.46 as permitted sender) smtp.mailfrom=max.kellermann@ionos.com; dmarc=pass (policy=quarantine) header.from=ionos.com Received: by mail-wr1-f46.google.com with SMTP id ffacd0b85a97d-33d0a7f2424so4694182f8f.0 for ; Thu, 22 Feb 2024 03:51:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ionos.com; s=google; t=1708602669; x=1709207469; darn=kvack.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=kxFeZ/0ASaJvoJHkw5FuQa0hU1Ih3iAyraY4h2cFePg=; b=YZXFMNf42aSRSgroKhSkH3XVQdyAh0qmQWxcRig6BQ182Ew2fE8683hznweT4/nOPA LVzaAHWJw1P0cFbvIwpjjQ2hOR3pbsB8AKi0lmUMaF+tR24nrgGrpiKTorTxrrXQlStm LrWFVWG8anVK6RbzV1uKgKYVJA6QdFpzT3gWkcg559Ykr0w6l0T0XdyS50JNdeOdgSTy 7vaSo4z6RvYMC6poZ86fMgoDdMw3GiSeu8sCgr6NN/4mhZZjQXu3PHSiYE+rRxH8uT4j KgMHdhRJs7S2IDamja0mcMdVAoJOgf6njYsle7p3swCXzWmVe+Db8U45MV1yFn4A8qOJ 6rOw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708602669; x=1709207469; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=kxFeZ/0ASaJvoJHkw5FuQa0hU1Ih3iAyraY4h2cFePg=; b=uTmEYbsnUJ9bSRP4aYvtnYnpgooZ3tVxB99YYM17SbLBp7txnISnPsYTFjvT+rVz/1 +NBixdFvfWGI7eeuqSE7dDoYGqizn0/oPq0Orx6R5N0bJw3XpkNQv29Wg3q/Uko5XaXO c6pCCuyRJ1cMwB0Q47NSCgcY1YykKkW4Oij+yuDkkCQp3UPf5XdUd70l9ZfZb0m1KkJQ 7c+QKchVwUoPX64JPLUjaf26tyZdfXyxPIVHAUYaz5kSrkFZaBza3CQodRf21AFu/BKW klokn3nr1f4j68IUWkv814G2l4+ztkAd2ocVWn+1qaKirRBlq+lHl9O0GV8kZYqLc81G BXTw== X-Forwarded-Encrypted: i=1; AJvYcCWgiN8MFHLfRAXlLDZuABfDC2ijusNqrHFEmXtgNrprvEO5Te2U5RJX7GDCVbFgpPslcoILhFL0J6Ezhb9jd31/MlQ= X-Gm-Message-State: AOJu0YwYj1EEpoNDhEpvi710GsF/GCx0P0TDi56OW2bl4uP1Q9BoKTK9 QrdNr0y5khQl8MjDroDqI2eVyWhdlYORquCUtAV/HOsbrLtvQdjs2ojC2wNaEsE= X-Google-Smtp-Source: AGHT+IEa3C8f7cLy6OU3uEmSmSXgcYIgG0huCWrowteGjGdDCOAsaf2p99NOehd9GQ5cTyTmBUBHRg== X-Received: by 2002:a05:6000:1787:b0:33d:56a0:88e3 with SMTP id e7-20020a056000178700b0033d56a088e3mr8736928wrg.65.1708602669683; Thu, 22 Feb 2024 03:51:09 -0800 (PST) Received: from raven.intern.cm-ag (p200300dc6f010900023064fffe740809.dip0.t-ipconnect.de. [2003:dc:6f01:900:230:64ff:fe74:809]) by smtp.gmail.com with ESMTPSA id co18-20020a0560000a1200b0033d4c3b0beesm15044920wrb.19.2024.02.22.03.51.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Feb 2024 03:51:09 -0800 (PST) From: Max Kellermann To: akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: willy@infradead.org, Max Kellermann Subject: [PATCH v2 08/14] linux/mm.h: move devmap-related declarations to mm/devmap_managed.h Date: Thu, 22 Feb 2024 12:50:49 +0100 Message-Id: <20240222115055.1172877-9-max.kellermann@ionos.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240222115055.1172877-1-max.kellermann@ionos.com> References: <20240222115055.1172877-1-max.kellermann@ionos.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: DB779A000C X-Rspam-User: X-Rspamd-Server: rspam11 X-Stat-Signature: ysqfdpp8oqkek6omin9x4yht6kzzi7zh X-HE-Tag: 1708602670-696645 X-HE-Meta: U2FsdGVkX1+kko/esCdGcze7SNPgCxcLMIXzKY2GsLmdNk4ZDhwugO84F/CT3ow7llFy/ZqHxiTnP+Fify4MGPW7Y2/aCFQMWlzzhkpTc5HSXKIicZOMHC0UBMkuG3pUDHDfUC2hwlxcnb/clZJXMbm0JzkTKtwsGzDe+zZS5EmDhJkbgylgV6pMxy0WHh4/u2mR3h6dBYUXvwtUTzN1nlXRmB657tl7GDdpOGqEqFl0wK7BPEwGudZ/PUSeXZ3972NEJXwsQS1qsW3ZHqFwR8ka7uqbJqb3PUSP6lio3FbZUtyYga2xC3UQYe59U0CTcjcFAQwOB+rOVWczEGY3jvo0samGGnABkpnAx9DApIasYxY1AYbstM9lvc4jyrlW7V7XQ6KOfmDdN7Gz0q8WmrqvV8jxABPLGLrYF3IRx2wRJsILZSHPRuAZQZ2hDRnr5PjJKCuBfwNLr8EWOQQNm9+QJEugax9YHNqHElYgFhenhpUw6OHeoSTCB7PZjhWlw7v3FMUnddaeRNSiOgEVNage8qOJwZFIrTJEKtmQH2tV+E2Yky15GcZs1GtP7YGsvTT8JyOeexsbNR1xsxlT+sG6yXkZvNHEN4QXHCnatujBlO/kOGudETOqWtJM7JppP6hF1XANHRGGIswNd/qnOSmMGDLCx34HIhfTOnyQuLOAdNAEUqhiRgxG00ZlVl428R/OyA+hboILBgleRe5K1K7IJQLgrLjk/3nl7EBnppYuxM9xvVIEvuRrCRSt1lXKCeUujaGJ+33mDo2irIdQYoYhLTblPk2SyX+s5QWSkYTmE+abEI8wSGPtQojPpkEgBzvtVqYZ2K3gdfyOwsCmcC+ajQRhxp4IHYd6rZfqPCmFYXV7FVpbtIqP+q0euWvpkmmXc+CeIV6tUAKRiabR1ERhgspTC2FQ2y6ZhHNd+QL4x43gxjUHb1eq1SgvR1BUOuvwiT7nQvQFXWinDOZ VuKstai9 30zDV2zh0R1lcMZYDF0FTIcXtMHCdGYSMlpM2b+hNlMoE72FqtEMdtplwVs3F3FzozEUSWoNOdBLVcX9mFvQUXySMYjdGM4tT5NBOFW+NnzYaRcHz1E+UQoEpPduLnoGXz4l9h+qxSYJJgHR8lpH3MWH/61z3iULTMjdC 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: Prepare to reduce dependencies on linux/mm.h. put_devmap_managed_page() is called by put_page(). Moving it to a separate header allows us to move put_page() to a separate lean header as well. Signed-off-by: Max Kellermann --- include/linux/mm.h | 24 -------------------- include/linux/mm/devmap_managed.h | 37 +++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+), 24 deletions(-) create mode 100644 include/linux/mm/devmap_managed.h diff --git a/include/linux/mm.h b/include/linux/mm.h index 7d83d6d64f30..7a302da7de24 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -1350,30 +1350,6 @@ vm_fault_t finish_fault(struct vm_fault *vmf); * back into memory. */ -#if defined(CONFIG_ZONE_DEVICE) && defined(CONFIG_FS_DAX) -DECLARE_STATIC_KEY_FALSE(devmap_managed_key); - -bool __put_devmap_managed_page_refs(struct page *page, int refs); -static inline bool put_devmap_managed_page_refs(struct page *page, int refs) -{ - if (!static_branch_unlikely(&devmap_managed_key)) - return false; - if (!is_zone_device_page(page)) - return false; - return __put_devmap_managed_page_refs(page, refs); -} -#else /* CONFIG_ZONE_DEVICE && CONFIG_FS_DAX */ -static inline bool put_devmap_managed_page_refs(struct page *page, int refs) -{ - return false; -} -#endif /* CONFIG_ZONE_DEVICE && CONFIG_FS_DAX */ - -static inline bool put_devmap_managed_page(struct page *page) -{ - return put_devmap_managed_page_refs(page, 1); -} - /* 127: arbitrary random number, small enough to assemble well */ #define folio_ref_zero_or_close_to_overflow(folio) \ ((unsigned int) folio_ref_count(folio) + 127u <= 127u) diff --git a/include/linux/mm/devmap_managed.h b/include/linux/mm/devmap_managed.h new file mode 100644 index 000000000000..0773529d80b2 --- /dev/null +++ b/include/linux/mm/devmap_managed.h @@ -0,0 +1,37 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef _LINUX_MM_DEVMAP_MANAGED_H +#define _LINUX_MM_DEVMAP_MANAGED_H + +#include // for bool + +struct page; + +#if defined(CONFIG_ZONE_DEVICE) && defined(CONFIG_FS_DAX) + +#include // for DECLARE_STATIC_KEY_FALSE(), static_branch_unlikely() +#include // is_zone_device_page() + +DECLARE_STATIC_KEY_FALSE(devmap_managed_key); + +bool __put_devmap_managed_page_refs(struct page *page, int refs); +static inline bool put_devmap_managed_page_refs(struct page *page, int refs) +{ + if (!static_branch_unlikely(&devmap_managed_key)) + return false; + if (!is_zone_device_page(page)) + return false; + return __put_devmap_managed_page_refs(page, refs); +} +#else /* CONFIG_ZONE_DEVICE && CONFIG_FS_DAX */ +static inline bool put_devmap_managed_page_refs(struct page *page, int refs) +{ + return false; +} +#endif /* CONFIG_ZONE_DEVICE && CONFIG_FS_DAX */ + +static inline bool put_devmap_managed_page(struct page *page) +{ + return put_devmap_managed_page_refs(page, 1); +} + +#endif /* _LINUX_MM_DEVMAP_MANAGED_H */ From patchwork Thu Feb 22 11:50:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Max Kellermann X-Patchwork-Id: 13567170 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 967D9C54788 for ; Thu, 22 Feb 2024 11:51:29 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A836F6B0082; Thu, 22 Feb 2024 06:51:14 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 9E7FB6B0085; Thu, 22 Feb 2024 06:51:14 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7740C6B0087; Thu, 22 Feb 2024 06:51:14 -0500 (EST) 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 5C61F6B0082 for ; Thu, 22 Feb 2024 06:51:14 -0500 (EST) Received: from smtpin09.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 2F2D940DB3 for ; Thu, 22 Feb 2024 11:51:14 +0000 (UTC) X-FDA: 81819274068.09.1A70315 Received: from mail-lf1-f52.google.com (mail-lf1-f52.google.com [209.85.167.52]) by imf21.hostedemail.com (Postfix) with ESMTP id 54D2C1C0008 for ; Thu, 22 Feb 2024 11:51:12 +0000 (UTC) Authentication-Results: imf21.hostedemail.com; dkim=pass header.d=ionos.com header.s=google header.b="OUtdzP/4"; dmarc=pass (policy=quarantine) header.from=ionos.com; spf=pass (imf21.hostedemail.com: domain of max.kellermann@ionos.com designates 209.85.167.52 as permitted sender) smtp.mailfrom=max.kellermann@ionos.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1708602672; 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-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=1kLoKUxPzCv4au/TRObsd9V3UzJrpdaiZFCw0biA2LU=; b=jhol3un4/3ctzOztF5o2azrl25Ef0L1A8GYwUKf+KRoXVp71bywGM6lcK34MtP+AmksXLm kYS6jovjUF+xGnzFSXRNoZlCg0AsZ3I0qb+0hkU0hbmehKRu0J7p2nd5H6yPWrzIAWDP41 VF5wYQcsqnbO/Y0tLjwRNQLJ3nrw1sk= ARC-Authentication-Results: i=1; imf21.hostedemail.com; dkim=pass header.d=ionos.com header.s=google header.b="OUtdzP/4"; dmarc=pass (policy=quarantine) header.from=ionos.com; spf=pass (imf21.hostedemail.com: domain of max.kellermann@ionos.com designates 209.85.167.52 as permitted sender) smtp.mailfrom=max.kellermann@ionos.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1708602672; a=rsa-sha256; cv=none; b=mmBUPegAaRpPKzo+ZhytgLlWFa9hHrDeVOwGuIW1lgFsy7EbAlSFstbUKe9bey1X7xBPBD uvRGZKQljFj1UlrDcT5B+4hnGOKx761KrEr1cBJsRYNQHW9UfDbwPtd9iJrXlZO3s6XPzh wIjO83ohPY0gg75vrLnWMRgvCpzw8fs= Received: by mail-lf1-f52.google.com with SMTP id 2adb3069b0e04-512cc3ea7a5so3271986e87.3 for ; Thu, 22 Feb 2024 03:51:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ionos.com; s=google; t=1708602670; x=1709207470; darn=kvack.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=1kLoKUxPzCv4au/TRObsd9V3UzJrpdaiZFCw0biA2LU=; b=OUtdzP/4rIwofysifeIvkjmEpWa31nYNhu/qt7gEDMbdULU1Cj/tlf6H1b9uP0UMZ7 hp7IFtfqbMq16wjVqeG2Ah5C/FTXp89oh31VWSZXYzGi/IrMUeDfo/PyF9oZLJbknMTj JLj75PThlP4gYDSxYfcVX54zVOavwRYd/Ae7pLifAhHlFQramMjs4YEO5WCA6w/D9ZJP FRguuBQOV82PYcaeBYnyOQRJidKPuyoQYg/1Gqtpsb0eSis1f7q4am97L/kmFqG6G2gB PqgVJhe/Z6vUyIXhbENIEQj8kuUq7I9fSppPKZMbfQ5qXaOxZTxJDhFhGUHP82GSdGaP QfXw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708602670; x=1709207470; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=1kLoKUxPzCv4au/TRObsd9V3UzJrpdaiZFCw0biA2LU=; b=bmmGQ7SQyaPtVAmEw139yrs7dcKd6Pc8/PWu4LcwdtRPj88Xb0FWIZcbAYKyKOVJLo l1ORtCJg+EY5YJqK67DGBnEJ6v/7k+zWu9XCWBzRisg075kZrI1LqJJXgAghV66wIY3I 2cFu2U81Fm17hvDlQBB+5nTtDWtNXtZHafVHM/REuJ+UuMDBRkWZwf7h2BKzSl5bCwe5 qXzuStYu88yYPIMGyE+ilU8MODcrqLOV65iCHSn/hxBx8RJro4nIeCo0et4x0z+hG9YJ uqwZRUNkMJM0049EqZ+xXcarNo9fIjDSGQ2qymJIAQyI/1rCIss5XOedzLiB2VF3vnUn Tw5w== X-Forwarded-Encrypted: i=1; AJvYcCU3U2Rzel2C7jc9if72WKhB7K0uD+0upuaVjjO/PwSwqtKAGiv/6xIOzFQjqhxp0krWW5lCFN9/UKQwbxb8KeZidGE= X-Gm-Message-State: AOJu0Yy85ysCU97/G07sPnEiPUQQOFiTnEIPA520DOAqNluttyVADX4c OXBwtQ0T5MI7p4g59TEe4N5i1qVX/38XSySP/560E9rKESyB4zTqlOmbJOSrPJ0= X-Google-Smtp-Source: AGHT+IG3KNwxLKO2NUP+qJu3NUWgqMuYFxpFclvxLFDRnLhVWht5yaKDXfsrMiBDlo2H+wUtOyr1eA== X-Received: by 2002:a19:ac03:0:b0:512:beb3:7070 with SMTP id g3-20020a19ac03000000b00512beb37070mr5896813lfc.59.1708602670390; Thu, 22 Feb 2024 03:51:10 -0800 (PST) Received: from raven.intern.cm-ag (p200300dc6f010900023064fffe740809.dip0.t-ipconnect.de. [2003:dc:6f01:900:230:64ff:fe74:809]) by smtp.gmail.com with ESMTPSA id co18-20020a0560000a1200b0033d4c3b0beesm15044920wrb.19.2024.02.22.03.51.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Feb 2024 03:51:09 -0800 (PST) From: Max Kellermann To: akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: willy@infradead.org, Max Kellermann Subject: [PATCH v2 09/14] linux/mm.h: move usage count functions to mm/folio_usage.h Date: Thu, 22 Feb 2024 12:50:50 +0100 Message-Id: <20240222115055.1172877-10-max.kellermann@ionos.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240222115055.1172877-1-max.kellermann@ionos.com> References: <20240222115055.1172877-1-max.kellermann@ionos.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: 54D2C1C0008 X-Rspam-User: X-Rspamd-Server: rspam02 X-Stat-Signature: ni31sdm4uzufrpcgfbn6wobgqre7jxix X-HE-Tag: 1708602672-103800 X-HE-Meta: U2FsdGVkX1/pAZYQwypqV+GgA1Tnq+yeWUC29tOKHj9nr79+iSaOOI68dJismYQLYJSiMrlApCSBPG474HFhrk5L0A2u4116Epr9uMtlPS8ySb5GnBp4aGLgQeeXjfGZteVdNReiE5wUzXxoe1ibIHnzeMg+LEXcC99s2HROmttxmgeRTZunddoJPz88jIeGQN+fBhE5AjKvlhJN+hCuhSwjmbNnCL39yjvrnycxIEcY8o18UnEl/2sAdwBDezjjK8eitm08QhgAqJS8bIxhszEh9qzoQc5Fc9G+lyMCH2iTSQOWw3O97X9pjK0DY0Zq27DoIjJBhA46WIC9m+UOjKTbet2cLn8nLIV8rM7mBN91cJtbzetJAryANoejHzrETfu83yPd5cTY+mllVzgFx7jRszCvnAftJ0y4t/3OpecMEM90TdWFHiDOWdWLXZqzBKWz/dSLKrM2XdLyaXfNMObV74Oc+/JUchoUAU7/zmLK3eoyMvmcYiGsEQDH/oaeNvTnXkeeINoi5jPs+z6L2av78gX3bDO1WvCuD+Vfs0a13YKlIAjkEETvxzC5eFSybbtYXsU76tYmZuZAw6aQsab60A3SfJNta6S4IpyJNckSTyTyoxtG5KBnxs6OfeA2ivBI3Q1n8UZF22KvcDBptpLPdFUDLLaQcXXeJL7DnpHVCD09SEU97O68bcoo0NqmXdVENIUjtEZu738Lb9LitA0pm7EURxWTyDkcBWUHEfIfIeU040JIQw2BoTZ3ynifymEw9bPt3faAr1NjcCmv+BXb1rfHol1ww1KUrMCrCiFuPTAtYkBg4LPHD+v8JvZoGWvKQMrki3GdG1nsMma0TRk4FAFEbzgbLIwAKniqsJ3CkEjcgBhf8/LcVJQc5mxxQRfc9rd01qHQUovWp7sFzoCGkmyi6euXwxB7dhM++PX+/FfYlb5HrGnZ5DJUmaLfAnLrZgn9+ULNbmxFY6Z /IA4CQOJ 6jEnyCDMVRRgyrWAgJqqjbOZbIxEtKnZe/AwI+pPA//3oNYN7yiG99EQVq2qCpFyH70E9crtJ60Mif8XEg90GX41pbcZ9WPQKpsJ4H5g9HugITl2FXBFx815iFANn+qyCpWz65nx9fosc8ZEYRXfrfJ6wBKrrVfEVTCqZ 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: Prepare to reduce dependencies on linux/mm.h. This new header contains wrappers for the low-level functions from page_ref.h. By having those higher-level functions in a separate header, we can avoid their additional dependencies in the page_ref.h. Having these in a separate header will allow eliminating the dependency on linux/mm.h from these headers: - linux/skbuff.h - linux/swap.h Signed-off-by: Max Kellermann --- include/linux/mm.h | 168 +------------------------------ include/linux/mm/folio_usage.h | 177 +++++++++++++++++++++++++++++++++ 2 files changed, 178 insertions(+), 167 deletions(-) create mode 100644 include/linux/mm/folio_usage.h diff --git a/include/linux/mm.h b/include/linux/mm.h index 7a302da7de24..0dc38017e134 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -4,6 +4,7 @@ #include #include +#include #include #include #include @@ -1058,51 +1059,6 @@ struct inode; #include -/* - * Methods to modify the page usage count. - * - * What counts for a page usage: - * - cache mapping (page->mapping) - * - private data (page->private) - * - page mapped in a task's page tables, each mapping - * is counted separately - * - * Also, many kernel routines increase the page count before a critical - * routine so they can be sure the page doesn't go away from under them. - */ - -/* - * Drop a ref, return true if the refcount fell to zero (the page has no users) - */ -static inline int put_page_testzero(struct page *page) -{ - VM_BUG_ON_PAGE(page_ref_count(page) == 0, page); - return page_ref_dec_and_test(page); -} - -static inline int folio_put_testzero(struct folio *folio) -{ - return put_page_testzero(&folio->page); -} - -/* - * Try to grab a ref unless the page has a refcount of zero, return false if - * that is the case. - * This can be called when MMU is off so it must not access - * any of the virtual mappings. - */ -static inline bool get_page_unless_zero(struct page *page) -{ - return page_ref_add_unless(page, 1, 0); -} - -static inline struct folio *folio_get_nontail_page(struct page *page) -{ - if (unlikely(!get_page_unless_zero(page))) - return NULL; - return (struct folio *)page; -} - extern int page_is_ram(unsigned long pfn); enum { @@ -1258,8 +1214,6 @@ static inline struct folio *virt_to_folio(const void *x) return page_folio(page); } -void __folio_put(struct folio *folio); - void put_pages_list(struct list_head *pages); void split_page(struct page *page, unsigned int order); @@ -1350,126 +1304,6 @@ vm_fault_t finish_fault(struct vm_fault *vmf); * back into memory. */ -/* 127: arbitrary random number, small enough to assemble well */ -#define folio_ref_zero_or_close_to_overflow(folio) \ - ((unsigned int) folio_ref_count(folio) + 127u <= 127u) - -/** - * folio_get - Increment the reference count on a folio. - * @folio: The folio. - * - * Context: May be called in any context, as long as you know that - * you have a refcount on the folio. If you do not already have one, - * folio_try_get() may be the right interface for you to use. - */ -static inline void folio_get(struct folio *folio) -{ - VM_BUG_ON_FOLIO(folio_ref_zero_or_close_to_overflow(folio), folio); - folio_ref_inc(folio); -} - -static inline void get_page(struct page *page) -{ - folio_get(page_folio(page)); -} - -static inline __must_check bool try_get_page(struct page *page) -{ - page = compound_head(page); - if (WARN_ON_ONCE(page_ref_count(page) <= 0)) - return false; - page_ref_inc(page); - return true; -} - -/** - * folio_put - Decrement the reference count on a folio. - * @folio: The folio. - * - * If the folio's reference count reaches zero, the memory will be - * released back to the page allocator and may be used by another - * allocation immediately. Do not access the memory or the struct folio - * after calling folio_put() unless you can be sure that it wasn't the - * last reference. - * - * Context: May be called in process or interrupt context, but not in NMI - * context. May be called while holding a spinlock. - */ -static inline void folio_put(struct folio *folio) -{ - if (folio_put_testzero(folio)) - __folio_put(folio); -} - -/** - * folio_put_refs - Reduce the reference count on a folio. - * @folio: The folio. - * @refs: The amount to subtract from the folio's reference count. - * - * If the folio's reference count reaches zero, the memory will be - * released back to the page allocator and may be used by another - * allocation immediately. Do not access the memory or the struct folio - * after calling folio_put_refs() unless you can be sure that these weren't - * the last references. - * - * Context: May be called in process or interrupt context, but not in NMI - * context. May be called while holding a spinlock. - */ -static inline void folio_put_refs(struct folio *folio, int refs) -{ - if (folio_ref_sub_and_test(folio, refs)) - __folio_put(folio); -} - -/* - * union release_pages_arg - an array of pages or folios - * - * release_pages() releases a simple array of multiple pages, and - * accepts various different forms of said page array: either - * a regular old boring array of pages, an array of folios, or - * an array of encoded page pointers. - * - * The transparent union syntax for this kind of "any of these - * argument types" is all kinds of ugly, so look away. - */ -typedef union { - struct page **pages; - struct folio **folios; - struct encoded_page **encoded_pages; -} release_pages_arg __attribute__ ((__transparent_union__)); - -void release_pages(release_pages_arg, int nr); - -/** - * folios_put - Decrement the reference count on an array of folios. - * @folios: The folios. - * @nr: How many folios there are. - * - * Like folio_put(), but for an array of folios. This is more efficient - * than writing the loop yourself as it will optimise the locks which - * need to be taken if the folios are freed. - * - * Context: May be called in process or interrupt context, but not in NMI - * context. May be called while holding a spinlock. - */ -static inline void folios_put(struct folio **folios, unsigned int nr) -{ - release_pages(folios, nr); -} - -static inline void put_page(struct page *page) -{ - struct folio *folio = page_folio(page); - - /* - * For some devmap managed pages we need to catch refcount transition - * from 2 to 1: - */ - if (put_devmap_managed_page(&folio->page)) - return; - folio_put(folio); -} - /* * GUP_PIN_COUNTING_BIAS, and the associated functions that use it, overload * the page's refcount so that two separate items are tracked: the original page diff --git a/include/linux/mm/folio_usage.h b/include/linux/mm/folio_usage.h new file mode 100644 index 000000000000..2700e2ec4d78 --- /dev/null +++ b/include/linux/mm/folio_usage.h @@ -0,0 +1,177 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef _LINUX_MM_FOLIO_USAGE_H +#define _LINUX_MM_FOLIO_USAGE_H + +#include // for put_devmap_managed_page() +#include // for VM_BUG_ON_PAGE() +#include // for struct folio +#include + +/* + * Methods to modify the page usage count. + * + * What counts for a page usage: + * - cache mapping (page->mapping) + * - private data (page->private) + * - page mapped in a task's page tables, each mapping + * is counted separately + * + * Also, many kernel routines increase the page count before a critical + * routine so they can be sure the page doesn't go away from under them. + */ + +/* + * Drop a ref, return true if the refcount fell to zero (the page has no users) + */ +static inline int put_page_testzero(struct page *page) +{ + VM_BUG_ON_PAGE(page_ref_count(page) == 0, page); + return page_ref_dec_and_test(page); +} + +static inline int folio_put_testzero(struct folio *folio) +{ + return put_page_testzero(&folio->page); +} + +/* + * Try to grab a ref unless the page has a refcount of zero, return false if + * that is the case. + * This can be called when MMU is off so it must not access + * any of the virtual mappings. + */ +static inline bool get_page_unless_zero(struct page *page) +{ + return page_ref_add_unless(page, 1, 0); +} + +static inline struct folio *folio_get_nontail_page(struct page *page) +{ + if (unlikely(!get_page_unless_zero(page))) + return NULL; + return (struct folio *)page; +} + +void __folio_put(struct folio *folio); + +/* 127: arbitrary random number, small enough to assemble well */ +#define folio_ref_zero_or_close_to_overflow(folio) \ + ((unsigned int) folio_ref_count(folio) + 127u <= 127u) + +/** + * folio_get - Increment the reference count on a folio. + * @folio: The folio. + * + * Context: May be called in any context, as long as you know that + * you have a refcount on the folio. If you do not already have one, + * folio_try_get() may be the right interface for you to use. + */ +static inline void folio_get(struct folio *folio) +{ + VM_BUG_ON_FOLIO(folio_ref_zero_or_close_to_overflow(folio), folio); + folio_ref_inc(folio); +} + +static inline void get_page(struct page *page) +{ + folio_get(page_folio(page)); +} + +static inline __must_check bool try_get_page(struct page *page) +{ + page = compound_head(page); + if (WARN_ON_ONCE(page_ref_count(page) <= 0)) + return false; + page_ref_inc(page); + return true; +} + +/** + * folio_put - Decrement the reference count on a folio. + * @folio: The folio. + * + * If the folio's reference count reaches zero, the memory will be + * released back to the page allocator and may be used by another + * allocation immediately. Do not access the memory or the struct folio + * after calling folio_put() unless you can be sure that it wasn't the + * last reference. + * + * Context: May be called in process or interrupt context, but not in NMI + * context. May be called while holding a spinlock. + */ +static inline void folio_put(struct folio *folio) +{ + if (folio_put_testzero(folio)) + __folio_put(folio); +} + +/** + * folio_put_refs - Reduce the reference count on a folio. + * @folio: The folio. + * @refs: The amount to subtract from the folio's reference count. + * + * If the folio's reference count reaches zero, the memory will be + * released back to the page allocator and may be used by another + * allocation immediately. Do not access the memory or the struct folio + * after calling folio_put_refs() unless you can be sure that these weren't + * the last references. + * + * Context: May be called in process or interrupt context, but not in NMI + * context. May be called while holding a spinlock. + */ +static inline void folio_put_refs(struct folio *folio, int refs) +{ + if (folio_ref_sub_and_test(folio, refs)) + __folio_put(folio); +} + +/* + * union release_pages_arg - an array of pages or folios + * + * release_pages() releases a simple array of multiple pages, and + * accepts various different forms of said page array: either + * a regular old boring array of pages, an array of folios, or + * an array of encoded page pointers. + * + * The transparent union syntax for this kind of "any of these + * argument types" is all kinds of ugly, so look away. + */ +typedef union { + struct page **pages; + struct folio **folios; + struct encoded_page **encoded_pages; +} release_pages_arg __attribute__ ((__transparent_union__)); + +void release_pages(release_pages_arg, int nr); + +/** + * folios_put - Decrement the reference count on an array of folios. + * @folios: The folios. + * @nr: How many folios there are. + * + * Like folio_put(), but for an array of folios. This is more efficient + * than writing the loop yourself as it will optimise the locks which + * need to be taken if the folios are freed. + * + * Context: May be called in process or interrupt context, but not in NMI + * context. May be called while holding a spinlock. + */ +static inline void folios_put(struct folio **folios, unsigned int nr) +{ + release_pages(folios, nr); +} + +static inline void put_page(struct page *page) +{ + struct folio *folio = page_folio(page); + + /* + * For some devmap managed pages we need to catch refcount transition + * from 2 to 1: + */ + if (put_devmap_managed_page(&folio->page)) + return; + folio_put(folio); +} + +#endif /* _LINUX_MM_FOLIO_USAGE_H */ From patchwork Thu Feb 22 11:50:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Max Kellermann X-Patchwork-Id: 13567171 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 6D816C48BEB for ; Thu, 22 Feb 2024 11:51:32 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 0E8EE6B0085; Thu, 22 Feb 2024 06:51:15 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 020266B0089; Thu, 22 Feb 2024 06:51:14 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id DB6E26B0085; Thu, 22 Feb 2024 06:51:14 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id A85026B0087 for ; Thu, 22 Feb 2024 06:51:14 -0500 (EST) Received: from smtpin05.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 7804040DB3 for ; Thu, 22 Feb 2024 11:51:14 +0000 (UTC) X-FDA: 81819274068.05.B904E67 Received: from mail-lf1-f48.google.com (mail-lf1-f48.google.com [209.85.167.48]) by imf30.hostedemail.com (Postfix) with ESMTP id 83AD880008 for ; Thu, 22 Feb 2024 11:51:12 +0000 (UTC) Authentication-Results: imf30.hostedemail.com; dkim=pass header.d=ionos.com header.s=google header.b=LM+uBq8O; spf=pass (imf30.hostedemail.com: domain of max.kellermann@ionos.com designates 209.85.167.48 as permitted sender) smtp.mailfrom=max.kellermann@ionos.com; dmarc=pass (policy=quarantine) header.from=ionos.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1708602672; 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-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=MFa9Dx9xV4GQAl7iRO46X+jLcP69enhwI/ycHUy9Pls=; b=25CxUA4Fe/tKnKYeRDiMwXp0k8ThtxEh11Mejid012R29NraJ0ks2Goy32AgnYFZ52jisH fA6tela5uiaRvDlqtwyIoW8zSVUHPyBYKCHT2lJiMTNfH1TKmQfcYHeH4wPOsgghBwy7sW YE8kYDDhi8t+cIoB8OFU+jRwtLQLUiY= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1708602672; a=rsa-sha256; cv=none; b=FF57SRGVNQS4gU+R4OYR/VolQRPDFtvewQbuyQEE9myZVkgh8a80s5wJcLBE+rAM+ke1Od S2oS4uPyU3uTTmePpClK90NvhCgy/3b5aQhXY1MLIJRCPQX9bl7XVhGSyEH9WvfYz/KR79 Y/D2virTkARwUXe82WpEmsiJJnOWVjQ= ARC-Authentication-Results: i=1; imf30.hostedemail.com; dkim=pass header.d=ionos.com header.s=google header.b=LM+uBq8O; spf=pass (imf30.hostedemail.com: domain of max.kellermann@ionos.com designates 209.85.167.48 as permitted sender) smtp.mailfrom=max.kellermann@ionos.com; dmarc=pass (policy=quarantine) header.from=ionos.com Received: by mail-lf1-f48.google.com with SMTP id 2adb3069b0e04-5129e5b8cecso7137430e87.3 for ; Thu, 22 Feb 2024 03:51:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ionos.com; s=google; t=1708602671; x=1709207471; darn=kvack.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=MFa9Dx9xV4GQAl7iRO46X+jLcP69enhwI/ycHUy9Pls=; b=LM+uBq8O36JEmcGuRCIo2r7NS4R7i6maJY5CJgsXjhdSF7a0TFoEG3iYYeUX6Xi+Qf 9w/abNV1lK9jnHMKI3FHOuYMr9koDSfg3EBnUsf133VZNyaHHvWfhstwQmV9YrOz3bv9 1B+NVed5WOhWOMFu8C11GfIuvCuIQ+KD60C3xU2UEP+SsVwdFLmPOCBR+GYa8kpUnD62 3TV29OnsAXwZaaJMWb2MsT3w+pS51Vaw2vbVEySSUgM7GATmL5YQaBjviEL81ekdoOgQ iqgZpeSelEPwJB5ikOIY19NIMJTmsakXbLyqqUanm9Bkz1cSLh1hbhPV5HYnUHhqww01 bujg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708602671; x=1709207471; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=MFa9Dx9xV4GQAl7iRO46X+jLcP69enhwI/ycHUy9Pls=; b=I/c2XytomQqcEVEmXbvKmmf0SXOETm5AjotTyEqy5A3kr3/V0ZO5hlQdCjmfkO29Mx vXYgPhTgBKvY+zmMoSDIDsOI7yUy32aYHDR53B1IHz/mkC/1VVNI9WtYZz7MLc/jhsOa TmIP9oqxnMX981B7CR3dDiCiicGhgLFp8q5jcKq/pQ+qkWX56pvPMmGLjGLBteNRF5Jz wJfSASRkT6RgrzWObZC/TEnxXGv14q4jC2LO0md+E7UndLhO9T/IGupKbv2WBRI+y5fK 5Y7/Pf3YMLRfyPXbihSi1vf49Jf306J0NyVDQy/nwsE5j3qVyXkffMvjQ+I67VxOnXEe j5lQ== X-Forwarded-Encrypted: i=1; AJvYcCUABoPbFyaZpvNkbLWN/WG1f/Ml06Vau1AL7t/lkqTojnRPM0VSLG1L4YK6XyjHXlyADynlTUZpz9LVvKoGsXJWIpg= X-Gm-Message-State: AOJu0YzzStHWC5PFoP2xmMqVz7JRc78d4KjJx7aT/HAZuzj0ZXTOXbXM YDUao9Q5Qd7X37MUr/gb7nyEV3ijjw6ZYW53m/VKeNSQKMBjf3cJFEE8au7YbwNkuFm12nIjNBE 5 X-Google-Smtp-Source: AGHT+IGIO6dtLuYV1/1VqNo1n3zSBkE3XkdIVv4w1GdYfmtSErj42ytjrkrSj0uYvF/i1uTgxDlvlA== X-Received: by 2002:ac2:4a68:0:b0:512:a37a:bde2 with SMTP id q8-20020ac24a68000000b00512a37abde2mr9448627lfp.67.1708602670967; Thu, 22 Feb 2024 03:51:10 -0800 (PST) Received: from raven.intern.cm-ag (p200300dc6f010900023064fffe740809.dip0.t-ipconnect.de. [2003:dc:6f01:900:230:64ff:fe74:809]) by smtp.gmail.com with ESMTPSA id co18-20020a0560000a1200b0033d4c3b0beesm15044920wrb.19.2024.02.22.03.51.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Feb 2024 03:51:10 -0800 (PST) From: Max Kellermann To: akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: willy@infradead.org, Max Kellermann Subject: [PATCH v2 10/14] linux/mm.h: move page_zone_id() and more to mm/folio_zone.h Date: Thu, 22 Feb 2024 12:50:51 +0100 Message-Id: <20240222115055.1172877-11-max.kellermann@ionos.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240222115055.1172877-1-max.kellermann@ionos.com> References: <20240222115055.1172877-1-max.kellermann@ionos.com> MIME-Version: 1.0 X-Stat-Signature: fe6ray3d3iyqqf75cgn1x3fx1gctegr5 X-Rspamd-Server: rspam10 X-Rspamd-Queue-Id: 83AD880008 X-Rspam-User: X-HE-Tag: 1708602672-761823 X-HE-Meta: U2FsdGVkX1+4Zi2jfg9eRnjUgge/U+bUHzat0k/90byASe08P5P+vgotOW0Q8vauy9dC9rZpxyQ8m02RKINYZ757PVv3Nu6LgQnf/gxFO6eSoRAzNP9QPj+j1DzMnQCsTpsr1mR3/R6sn56TCCZFRLDgq/QiwJXrFnau7NwANADOQJMFpQrFM+jASmd9LcZIP8EpFsaym5NHzVhYMEwAe/n2Wy0RVV6PQDq/lBp3B9hSciHX2vyS1JgzNnNbKjdIXczyr1qwFnFcg8IBjHNAIFtcVmUSQjT8iwlhktr1zG870IfIRFDabIJ3h7w2/7EEHIismCM5sbvP2s5gH6heiRf0Kz539PP87W6wjLNM9DOfxZvEni4h2X/kB3LsbDSXPeyIGiX095U7WjqfTSUnpXcGRmEOHnN412dYYWdNWRMYUxJPWR7QPATKblNXXcei18KQbzsoUywV+7+wLvQalok0rpvVVL3K2T/i5TJNChQiVWeloOZ1FZV6Pq28wogxSD1v2ZFshIdJvPOGz5APCZ6UZ6u7gp0+Pn1uGMUhRO9Jbs7NTJ8lexC6sG/P8AELX1+is8Vqlu+iiXEITHTvsLJ9y1dsrGpeBKCvRZEjCbl+XT4bpBxvIbgJdNNWXMnBIk7ZxinN111f8fz8zmuLxnpwpGUgXxKjbDK1pvFEZMhEa1gEUMJU21yVlw9DoQOrkY22O+g4ElO//ld0kS0OZN/iD42Vd5hHVyINF4rPrxZU+7ryliOOHAE1fn0JXauNqO0Q1POu6nFZkZyN9RjTJZGxplDCyxq9KFELzytPN6+leeLeulEp1eBbs8ipW3LXkgTuVM95wsYX5WaL/PC8gjsLa8tZP0EU+O4fsfyMr3Xq1rythA8nY5kZq9a76OILEX9vH80b1ABiPkn0Xk0FcA1hCkaG6E15uCeOq+wwOF96dNepU3wxVEssCmTnyLLk5JDYQpsZVwOaGF3IqM+ tnqjcWmC NmiArobozkCKUbtYNDxV2+q80INdj63or7iU5VW5+PeEpCWUan9Iz5XEXyXEwGDULP0cHSfn+iRCWxV52UYSbrgKYG7rP1Op4HfuzjKsqGnW9SrMLeVOqI7p26Nu4Md2IPUDyxZtIKcKaIhTzn3o6yXk1ED2axEE3daI1w+QOTLrkS+ELpbTJ9awbolCaSFChfajY3LbamqkxOkYD6ZWS4P1wY2HVJaIXMS2wrJk4yAqjN/1W1z+cqz+hMC2J4JlQ1cdHDxzMm4NsPN4csGc+cn4RqImwV0OdOINy9h9ax6OzN5uzvFJhVClqTDMRvO0ejOOKY5DaT409NH+S7CiIXn2xmDwiU1LTsvIv7e/ogLsPVGw60pwHgyoSTaLIzmoMnGqj8dI5oxThuxLng6Se8kjHeNODGDKsMyN+bhbn2g4TBi4= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000191, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: This is needed to eliminate linux/skbuff.h's dependency on linux/mm.h. Signed-off-by: Max Kellermann --- include/linux/mm.h | 30 +-------------------------- include/linux/mm/folio_zone.h | 38 +++++++++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+), 29 deletions(-) create mode 100644 include/linux/mm/folio_zone.h diff --git a/include/linux/mm.h b/include/linux/mm.h index 0dc38017e134..1297ae7b2541 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -5,6 +5,7 @@ #include #include #include +#include #include #include #include @@ -1363,35 +1364,6 @@ static inline bool is_nommu_shared_mapping(vm_flags_t flags) } #endif -/* - * The identification function is mainly used by the buddy allocator for - * determining if two pages could be buddies. We are not really identifying - * the zone since we could be using the section number id if we do not have - * node id available in page flags. - * We only guarantee that it will return the same value for two combinable - * pages in a zone. - */ -static inline int page_zone_id(struct page *page) -{ - return (page->flags >> ZONEID_PGSHIFT) & ZONEID_MASK; -} - -#ifdef NODE_NOT_IN_PAGE_FLAGS -extern int page_to_nid(const struct page *page); -#else -static inline int page_to_nid(const struct page *page) -{ - struct page *p = (struct page *)page; - - return (PF_POISONED_CHECK(p)->flags >> NODES_PGSHIFT) & NODES_MASK; -} -#endif - -static inline int folio_nid(const struct folio *folio) -{ - return page_to_nid(&folio->page); -} - #ifdef CONFIG_NUMA_BALANCING /* page access time bits needs to hold at least 4 seconds */ #define PAGE_ACCESS_TIME_MIN_BITS 12 diff --git a/include/linux/mm/folio_zone.h b/include/linux/mm/folio_zone.h new file mode 100644 index 000000000000..8ebcdb57ee2d --- /dev/null +++ b/include/linux/mm/folio_zone.h @@ -0,0 +1,38 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef _LINUX_MM_FOLIO_ZONE_H +#define _LINUX_MM_FOLIO_ZONE_H + +#include // for struct page, struct folio +#include // for ZONEID_*, NODES_* +#include // for PF_POISONED_CHECK() + +/* + * The identification function is mainly used by the buddy allocator for + * determining if two pages could be buddies. We are not really identifying + * the zone since we could be using the section number id if we do not have + * node id available in page flags. + * We only guarantee that it will return the same value for two combinable + * pages in a zone. + */ +static inline int page_zone_id(struct page *page) +{ + return (page->flags >> ZONEID_PGSHIFT) & ZONEID_MASK; +} + +#ifdef NODE_NOT_IN_PAGE_FLAGS +extern int page_to_nid(const struct page *page); +#else +static inline int page_to_nid(const struct page *page) +{ + struct page *p = (struct page *)page; + + return (PF_POISONED_CHECK(p)->flags >> NODES_PGSHIFT) & NODES_MASK; +} +#endif + +static inline int folio_nid(const struct folio *folio) +{ + return page_to_nid(&folio->page); +} + +#endif /* _LINUX_MM_FOLIO_ZONE_H */ From patchwork Thu Feb 22 11:50:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Max Kellermann X-Patchwork-Id: 13567172 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 48F61C48BF8 for ; Thu, 22 Feb 2024 11:51:35 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B20426B0087; Thu, 22 Feb 2024 06:51:15 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id AA92E6B0089; Thu, 22 Feb 2024 06:51:15 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8D5966B008A; Thu, 22 Feb 2024 06:51:15 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 767796B0087 for ; Thu, 22 Feb 2024 06:51:15 -0500 (EST) Received: from smtpin28.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 53A561C01D9 for ; Thu, 22 Feb 2024 11:51:15 +0000 (UTC) X-FDA: 81819274110.28.13EAE28 Received: from mail-wr1-f53.google.com (mail-wr1-f53.google.com [209.85.221.53]) by imf14.hostedemail.com (Postfix) with ESMTP id 6745E100010 for ; Thu, 22 Feb 2024 11:51:13 +0000 (UTC) Authentication-Results: imf14.hostedemail.com; dkim=pass header.d=ionos.com header.s=google header.b=Voxr+Ga6; dmarc=pass (policy=quarantine) header.from=ionos.com; spf=pass (imf14.hostedemail.com: domain of max.kellermann@ionos.com designates 209.85.221.53 as permitted sender) smtp.mailfrom=max.kellermann@ionos.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1708602673; 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-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=QIuZ9zlRlzs4cjZtyrA8C8bTBDZzt0jvXmpPfaEdUlE=; b=mBsQ2nT9YC54wJbLxwBZfKbMzJ24SCTNFbM5QxhzYn/kcDpZ+PxwIs/+Jev2Arh2JHMDKJ Jqdxi6bR3pOfedd/hSch1IxGakdTdS2f39s2rNx1WbZLpSoByDIvCrgULWA8OL/h3g2l9C kmcG6K2Vr4qPjCBfEnTeMFRGuJe/smU= ARC-Authentication-Results: i=1; imf14.hostedemail.com; dkim=pass header.d=ionos.com header.s=google header.b=Voxr+Ga6; dmarc=pass (policy=quarantine) header.from=ionos.com; spf=pass (imf14.hostedemail.com: domain of max.kellermann@ionos.com designates 209.85.221.53 as permitted sender) smtp.mailfrom=max.kellermann@ionos.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1708602673; a=rsa-sha256; cv=none; b=tL0AZyFyZ+wIoyKhdRR7MTV/MKSZqHcyhDoIHllSdHQglXXL4/FaaXrvkZwipEkUWNmv1j p4myP8xCoGnnt3q/fmZKk/d3ZEd1z8zsaTbHaCj5+G0OxdC9AbyTAPnhX7XYOar7aVG0Yp 8lGC8nFcoAsB9B2VkvXtKyWNHFPaot4= Received: by mail-wr1-f53.google.com with SMTP id ffacd0b85a97d-3392b12dd21so1299558f8f.0 for ; Thu, 22 Feb 2024 03:51:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ionos.com; s=google; t=1708602672; x=1709207472; darn=kvack.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=QIuZ9zlRlzs4cjZtyrA8C8bTBDZzt0jvXmpPfaEdUlE=; b=Voxr+Ga632dXM9sYWto71oaQAg7BNDV2sg3sbdgqL56wfpan2dkono9tbUTBc4OTr1 UhvWS/yEdKdB1lmeAP+xrgjoLA3ZjPshEXMLlLoMmrAMxTf/QaIcEJ4N8NlKmC5GOdSo KHo6LHr8PbXct/WOluppwWyZu/ZwEfzK+L4yj7Z+7d6F4GpWEsXQA7jcTp2OEqIKtPdO otmf35QLGErB4KE0FBnTndNzGljwa4vHnv9bzmRS3T2GmhY82TcyI/Ks0gnRCWhzsbmS 9+mtT3ICmtZAVZ67t1nUCLNaRtWEJ9MKOpmsZbzkRePtmbXXBZLyQY+xC5iJKcgEnqBP vPyA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708602672; x=1709207472; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=QIuZ9zlRlzs4cjZtyrA8C8bTBDZzt0jvXmpPfaEdUlE=; b=gPpYFN3iKL5aFRb86Bm6HBbKRGK0yP0b6w/FqftNZykoXWMyyxqkeckCGuYekgVXBl q5t/zKpx1v41WW73nEozHaHAwe3xg1NiKjuJasu9NDmIB76AhSsHf17VGqJLwDJPF8UU oJsT6LDP8LqUK4pccznKeG4h+6FBfPAGWL45FLB0wqGWJ1CJTjexr8lPRbbb1mrn+bJ9 BhNznI5Aaqw1cVlsqOQO5d8CUcK5EOapZPVr99/gyv1Bx93Dfx9JSA/vUpTk+H9i54Rq ZVHMXnMrYmRHvSNpOCn0hxqLGV0v19hj0165Kg31BgPf1mKkkv5a8f+PnOnFd779GnY2 Qv7w== X-Forwarded-Encrypted: i=1; AJvYcCXCDN8ICoBFED8j5wlP2VaxJvy3C49nDbtFhZdAIQj6e86yaAxhSM1E4xoQJqKjiTYg5orl7+gYVnd/PcOZP5Br09w= X-Gm-Message-State: AOJu0Yz/FGU2FTHqSQc4S+DR9jj/qLTDw/56JdoAdTCE+p93/rObHD6j cDFCh+SBmOQnmFF7JeNK22EN3zhBzSE1cICxv4KqhjlJqvQ9SX/Gc90EdgXsMms= X-Google-Smtp-Source: AGHT+IE7GlQdOA5ZITSqjxJZEz89QZSFz6WL5hb8Ohh0TF8MgsaND/DbLcX8ZehAKHAsuK2u2ZaU5A== X-Received: by 2002:a5d:47a9:0:b0:33d:3a06:acbc with SMTP id 9-20020a5d47a9000000b0033d3a06acbcmr10659700wrb.70.1708602672077; Thu, 22 Feb 2024 03:51:12 -0800 (PST) Received: from raven.intern.cm-ag (p200300dc6f010900023064fffe740809.dip0.t-ipconnect.de. [2003:dc:6f01:900:230:64ff:fe74:809]) by smtp.gmail.com with ESMTPSA id co18-20020a0560000a1200b0033d4c3b0beesm15044920wrb.19.2024.02.22.03.51.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Feb 2024 03:51:11 -0800 (PST) From: Max Kellermann To: akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: willy@infradead.org, Max Kellermann Subject: [PATCH v2 11/14] linux/mm.h: move pfmemalloc-related functions to pfmemalloc.h Date: Thu, 22 Feb 2024 12:50:52 +0100 Message-Id: <20240222115055.1172877-12-max.kellermann@ionos.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240222115055.1172877-1-max.kellermann@ionos.com> References: <20240222115055.1172877-1-max.kellermann@ionos.com> MIME-Version: 1.0 X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: 6745E100010 X-Stat-Signature: oo9co7xbzm155gkgw4rnsaq1kp5e1fhe X-Rspam-User: X-HE-Tag: 1708602673-708885 X-HE-Meta: U2FsdGVkX19u8KD3wK/vTMYt7KWWgtZAFLOo0wUftDYuxAibgoezduaVmf3s/LTKe3teL1w7/owDfcz32jDkQzrUj2uqjb/kLeNgFPmy8vE3pebWoenI1X0I4ZrFixCjfBiGK+7ndNeKunQwcG+8AAOOUCusg5c6ss9b1IU/M0RxwmCD4QhZ/m/SPYk6iC6w4ljYk1YsRRP2Hg1kr3gMyJJ7QWlkeMOxlx8xRzllDjSz0iCgLUpyfE4Q3T11sLTdJBwibE+cGLE+ldoptDmJ0IoL4vXNXS0KrwK/gHvV3GAEAxQfKOE/XFuesYJD0CUfilqPQ6UTpL1IRtuyUbBWMVC/zJ4CPaEbJPh3j/2blh/iqDXs0TLEvVhqGP6DpUbwBDUGFCxA+hDkzUpTShHA6rAe3w5yRV0lU5nKwtPiqHakQI9QE2o9fvIyVXVxKOCkQEFE55GzJ1qetHC8ipDg9gbXtzSAIbwSNXIF03FarctGmOgenzh55kY70cUkBjmjblPTupoho3p5a4QFelSEaZQ72FmaV2rmU8ophvzIsEiQjcgvgNOUi4XTcuz9MqkS0NlPtYyjnsgNPkd//btW0QtxCH7ezI3jismnCzDzOSyZz7BUxOqrJ/x//32tKZQBop4u+uG0yK0KqxdTrc937P95dI2t5AeWpIOpv/Lg+QaPl4WTs5mi8GqbtHHHIoO6SLSc7TCB18HmmpMdXaFnUx7eu0FO10LF9TTQcgpz+2jqG14S0B3mwTHHX1Sk33pAdLWWSSb8OW+OvMjn1EhIGbY+VmyAAKbK+/ZiLJ75nyJNau2OJuiukldvq4vrK2JWWVGfaYo0Xa9A/DestzD1nlaZRty/Pujb03c3zgqTU43b7C394jLXBGac2q1jb6zbcixqdjOK/+k+eZ1Ie6URE3HbcyCPNRb6JZPiRL9k4g4aktfObEAvnx6SdF07ivxAkEPHCb41Er6boh4ehQR xipbEkpL 1EvOIyiwdaJFHpoW9Gv/Ieah1X/CBKT0ZkDfpO0MFVkO2IwH6fQ5YgBHkK7DljRZllaoDn9LsTlLL9tRJTkez7U0kLlvkMqYy71Ut1wPFml87lRAg90FTutdhxuG3+pb8TlAjkU7T9z4tvgrqfiyvf08nL3+yKeGR5VYK+YY449rBOOaGbUpGUNOcxXovO/Jb4d3KBz1cvnz6CQLJ866bSVBoZF/L24bhotAHaMHR2ity5FqT1HRYJKjCF2IXZICHvPtJ/Dla8ClvqnMiIX8WCwypLkWvQRhx5pZHFQpXZx8NHMBAF6r8BWjll2I3Kcf8GKO0Nxxk5VQ40bvErtDJmlKtn9sumVv0f/P6Ff4nCEHPRGMF9vY0r4U5VCKXTFSPOVwuha/N+OOVDbG1CaRQGq5Hn2CiU83jlxhG X-Bogosity: Ham, tests=bogofilter, spamicity=0.000821, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: This is needed to eliminate linux/skbuff.h's dependency on linux/mm.h. Signed-off-by: Max Kellermann --- include/linux/mm.h | 45 +----------------------------- include/linux/mm/pfmemalloc.h | 52 +++++++++++++++++++++++++++++++++++ 2 files changed, 53 insertions(+), 44 deletions(-) create mode 100644 include/linux/mm/pfmemalloc.h diff --git a/include/linux/mm.h b/include/linux/mm.h index 1297ae7b2541..68228f43e7ca 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -8,6 +8,7 @@ #include #include #include +#include #include #include #include @@ -1749,50 +1750,6 @@ static inline pgoff_t page_index(struct page *page) return page->index; } -/* - * Return true only if the page has been allocated with - * ALLOC_NO_WATERMARKS and the low watermark was not - * met implying that the system is under some pressure. - */ -static inline bool page_is_pfmemalloc(const struct page *page) -{ - /* - * lru.next has bit 1 set if the page is allocated from the - * pfmemalloc reserves. Callers may simply overwrite it if - * they do not need to preserve that information. - */ - return (uintptr_t)page->lru.next & BIT(1); -} - -/* - * Return true only if the folio has been allocated with - * ALLOC_NO_WATERMARKS and the low watermark was not - * met implying that the system is under some pressure. - */ -static inline bool folio_is_pfmemalloc(const struct folio *folio) -{ - /* - * lru.next has bit 1 set if the page is allocated from the - * pfmemalloc reserves. Callers may simply overwrite it if - * they do not need to preserve that information. - */ - return (uintptr_t)folio->lru.next & BIT(1); -} - -/* - * Only to be called by the page allocator on a freshly allocated - * page. - */ -static inline void set_page_pfmemalloc(struct page *page) -{ - page->lru.next = (void *)BIT(1); -} - -static inline void clear_page_pfmemalloc(struct page *page) -{ - page->lru.next = NULL; -} - /* * Can be called by the pagefault handler when it gets a VM_FAULT_OOM. */ diff --git a/include/linux/mm/pfmemalloc.h b/include/linux/mm/pfmemalloc.h new file mode 100644 index 000000000000..345b215a3566 --- /dev/null +++ b/include/linux/mm/pfmemalloc.h @@ -0,0 +1,52 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef _LINUX_MM_PFMEMALLOC_H +#define _LINUX_MM_PFMEMALLOC_H + +#include // for BIT() +#include // for struct page + +/* + * Return true only if the page has been allocated with + * ALLOC_NO_WATERMARKS and the low watermark was not + * met implying that the system is under some pressure. + */ +static inline bool page_is_pfmemalloc(const struct page *page) +{ + /* + * lru.next has bit 1 set if the page is allocated from the + * pfmemalloc reserves. Callers may simply overwrite it if + * they do not need to preserve that information. + */ + return (uintptr_t)page->lru.next & BIT(1); +} + +/* + * Return true only if the folio has been allocated with + * ALLOC_NO_WATERMARKS and the low watermark was not + * met implying that the system is under some pressure. + */ +static inline bool folio_is_pfmemalloc(const struct folio *folio) +{ + /* + * lru.next has bit 1 set if the page is allocated from the + * pfmemalloc reserves. Callers may simply overwrite it if + * they do not need to preserve that information. + */ + return (uintptr_t)folio->lru.next & BIT(1); +} + +/* + * Only to be called by the page allocator on a freshly allocated + * page. + */ +static inline void set_page_pfmemalloc(struct page *page) +{ + page->lru.next = (void *)BIT(1); +} + +static inline void clear_page_pfmemalloc(struct page *page) +{ + page->lru.next = NULL; +} + +#endif /* _LINUX_MM_PFMEMALLOC_H */ From patchwork Thu Feb 22 11:50:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Max Kellermann X-Patchwork-Id: 13567173 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 EDE3AC48BF8 for ; Thu, 22 Feb 2024 11:51:37 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id DA3076B0089; Thu, 22 Feb 2024 06:51:16 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id CA4EE6B008A; Thu, 22 Feb 2024 06:51:16 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id AA7DD6B008C; Thu, 22 Feb 2024 06:51:16 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 903F66B0089 for ; Thu, 22 Feb 2024 06:51:16 -0500 (EST) Received: from smtpin21.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 68A87A11E3 for ; Thu, 22 Feb 2024 11:51:16 +0000 (UTC) X-FDA: 81819274152.21.FECBA8B Received: from mail-wr1-f47.google.com (mail-wr1-f47.google.com [209.85.221.47]) by imf12.hostedemail.com (Postfix) with ESMTP id 9366F40011 for ; Thu, 22 Feb 2024 11:51:14 +0000 (UTC) Authentication-Results: imf12.hostedemail.com; dkim=pass header.d=ionos.com header.s=google header.b=YurKPvH9; spf=pass (imf12.hostedemail.com: domain of max.kellermann@ionos.com designates 209.85.221.47 as permitted sender) smtp.mailfrom=max.kellermann@ionos.com; dmarc=pass (policy=quarantine) header.from=ionos.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1708602674; 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-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=+Ry2UB7dcYeDT9zlEEyR0ChQEn3iuoF+FIIQJnSpSl4=; b=NWAOCSBdLu4xkGyRyQVqMgeOMNhLGSxtLcaINJAFuiL1wUxTtLFf7it5MdziJAtYtceGSV jczOOZKyR5XU6ZQk0tNlZKF1nD+82NayK3sPRmVir4v9n/xcDJ9EAjr681rlGU9AwoKHcy 9wE3c4MriTkUaq4V2qHJxcZeZZnJB9g= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1708602674; a=rsa-sha256; cv=none; b=HFkmigJoZtzsziz+Jt9W+0Hlx8bWRthZibR7TSz4OJ+K3pmsfSS3r+HtrqzAcp2hS93YTV 7OqtBDOB+adb0xhNdAPmqcTla9HKabPPWqtSNGdd6LQEv0y5w1KsjuEdlJgx1F+ZyOShnF 408kIxDz+2gEdil20IHs+Nxm/P1jL+w= ARC-Authentication-Results: i=1; imf12.hostedemail.com; dkim=pass header.d=ionos.com header.s=google header.b=YurKPvH9; spf=pass (imf12.hostedemail.com: domain of max.kellermann@ionos.com designates 209.85.221.47 as permitted sender) smtp.mailfrom=max.kellermann@ionos.com; dmarc=pass (policy=quarantine) header.from=ionos.com Received: by mail-wr1-f47.google.com with SMTP id ffacd0b85a97d-33d18931a94so1383259f8f.1 for ; Thu, 22 Feb 2024 03:51:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ionos.com; s=google; t=1708602673; x=1709207473; darn=kvack.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=+Ry2UB7dcYeDT9zlEEyR0ChQEn3iuoF+FIIQJnSpSl4=; b=YurKPvH9CIoVZ13a523SrFsJjC0KoqhbPHu2yPfRt3b/DPLDtBBrnQyN5VOEHpA0v3 Wemv82/LY3oOXbViY88ZuCvUUN847Z/VBJBYHJhOzgIdS54N8J3bXYaxYcsXdJavjXeF AOuhQliKCxdpQqo/sahsdKOibtrjGU3c7VA9Lr6uvNGAbKwU+0qEG/P4o5yjnjmBtACo sWfSLY1/VHMxaUHUFIHEM2rJHBfMaVKrUYyNjq0fs7mjbA8v7XIX2CZMgGfeuSWxkAfx 0dWuFdVuUXChJyZY5T4hfBkVTN+JLkuxd0rZGBKlhF0ZlZJ5ZYMhjflE8qWXRn+CT9Zk wHIA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708602673; x=1709207473; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=+Ry2UB7dcYeDT9zlEEyR0ChQEn3iuoF+FIIQJnSpSl4=; b=FFNvOEKYdfL0kuWNU5sTSViYvm48oe6hShzGNjHMTZMxTbSEsEXnCXmGSa3zzcj2as f+RJVxagbi1Ajgk9Qpy6YT/WBBIQWOFjRfvcztE6b9li4bRlSfv16GSEtyG5OzwZqYF+ 0vdztZtuzX6bhd72b3nA7XvGt8rFcEP5jU7TJT0+Vq7Ndpvnj/btAxlT5PKwYdbdmrCY OE0XrCv6S/kIQE081PoofQZBUOj+MmQnOZ+dmPyiFOfe8hNRId9bXMEmto52GAODVq7r JT6Vl2w8QUeMLQ7pdNnd6B+Hy7HNg+f/F+4IPxiPOR6VPJSGrjUj7LmCQweoDzWgB/X4 79SQ== X-Forwarded-Encrypted: i=1; AJvYcCXjGx6bH1cCBNShheGuDVzifvNJqfy0KNghaZrYMPROCuQnYUIcWco6CFgwnOW54fjGrNbD62jFLxyP+TGvjdq+afw= X-Gm-Message-State: AOJu0Yw7iIfHznr5NgeIpnEO9cTSDqQ2B+diJCysVCxmj6todMsroPL6 eUoZvoioaigabtjblOn6MSXtnK5eSwckWOxPiwrDb0jgFvZAtA5DxUdfIGAxPP4= X-Google-Smtp-Source: AGHT+IHkn7Kv2cDL9TKEn0TXsN6T76wIe9NTlaJgmzsTsJCs2KhPmArE67c6S0bklL8r6dKwaNFpGw== X-Received: by 2002:a5d:5962:0:b0:33d:3a0e:9168 with SMTP id e34-20020a5d5962000000b0033d3a0e9168mr9439866wri.3.1708602673418; Thu, 22 Feb 2024 03:51:13 -0800 (PST) Received: from raven.intern.cm-ag (p200300dc6f010900023064fffe740809.dip0.t-ipconnect.de. [2003:dc:6f01:900:230:64ff:fe74:809]) by smtp.gmail.com with ESMTPSA id co18-20020a0560000a1200b0033d4c3b0beesm15044920wrb.19.2024.02.22.03.51.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Feb 2024 03:51:12 -0800 (PST) From: Max Kellermann To: akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: willy@infradead.org, Max Kellermann Subject: [PATCH v2 12/14] linux/mm.h: move is_vmalloc_addr() to mm/vmalloc_addr.h Date: Thu, 22 Feb 2024 12:50:53 +0100 Message-Id: <20240222115055.1172877-13-max.kellermann@ionos.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240222115055.1172877-1-max.kellermann@ionos.com> References: <20240222115055.1172877-1-max.kellermann@ionos.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: 9366F40011 X-Rspam-User: X-Rspamd-Server: rspam11 X-Stat-Signature: f8szcw6e13847tiqewrh7o4j6qn9kf5w X-HE-Tag: 1708602674-467455 X-HE-Meta: U2FsdGVkX1+H6MaGhA44aPiLfkuPsHzB00xxHwaEe4yaJOaxuZELnUkMENsUPhhqLLTtZMpsJhz09acKc6WjDYnaL1AAly7O7OJSTx4KIixW+3QdUGvloCMyt7qr+ShVv00qi82ddvYsDCZKGIlwfmkxgOYMBolPstWTtKtkJdRQr6K6CDUnW8e/RHQBPJx+SesMunudQekAdDW6hwKG/yP+uFK184glGz3Zs9O+tefGyYng4nrG5rWh9Tj5JSmZbteX3b/sWcDJWDSRSnMxFlnJBnU9MvtA5m52TRvOQGnBANEv4yG2fxkepy+PtbjHFNPYXae4QMTpNtXhEC/RhVTQkcT1VWWbMlGdLphK2TIdxsSZXQ1167N9t8tXh+bEnJNfbv8ZYNWZBPkpTjumRUwXcr6E2lQU7/Z+nbXeLJzVZ8GfTAUu7Sv59msIdpYYtVwOpFC6XS3NYeLuHhCiIo+e1+XA/6+QF1Ole4RAoCmKghB/4yUD/x29JNyixBlRqPP5yjhIoD8scsbQSFiu4uM3Au87FoYbTM8bZuIKNCCnGy1KASN9GkxrGdKF6LOPDIefDjBVsjnvej0AP2opRCY5xo/3/EZQDvCyCk+gaVq8w4EZNS3XHuu9AhyOpZLZGfIQnb8maukhEC9eJlrnkh7QoUFU9giLL9EMdEFVmsZGyBWlOFrizwmPSTvD3pTXYwwSisf/mS42EnWV3DjscTcShL+Rl6mfcgZRixEokHi2nexITsluHi/v2HFjgFyYYJIaT8wzA+inpi/FzxW2NjwCj5Bl9qTvbPAiUTgLHI88sOf5b8UP4IKBVmYi0Ec+WeYL/+6BDgTCBJQsL/bK8QOanwbdrYtaORfU47qpTf+E/Tx1lYDx/11ZCgZVzdUMUtY+3M9t1uzzLl9H5/vAi+2HJxLt5wMAUAizbtLisZ5v8GSudkT9Y5oHXpthxcK0+B0KPXX1GJQsUpvL0gT nVMUuzyh Txq6PnymossmmnCUUNcPQyE1vvk0PmiJ3pdHwQhWBf2veJxQjv+A3Xsezl9KVo/z4wicM6+G56yfF0GmijLxLOPziI3PJoPORGzifpJjJbFYMcTB7PG1jAsA0F8VkWhVn4HQvhmyBjBX00Q6DXQaZD6dfRA2M+i/c7duY 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: This is needed to eliminate linux/dma-mapping.h's dependency on linux/mm.h. Signed-off-by: Max Kellermann --- include/linux/mm.h | 25 +------------------------ include/linux/mm/vmalloc_addr.h | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+), 24 deletions(-) create mode 100644 include/linux/mm/vmalloc_addr.h diff --git a/include/linux/mm.h b/include/linux/mm.h index 68228f43e7ca..ad5971219ef6 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -9,6 +9,7 @@ #include #include #include +#include #include #include #include @@ -1072,30 +1073,6 @@ enum { int region_intersects(resource_size_t offset, size_t size, unsigned long flags, unsigned long desc); -/* Support for virtually mapped pages */ -struct page *vmalloc_to_page(const void *addr); -unsigned long vmalloc_to_pfn(const void *addr); - -/* - * Determine if an address is within the vmalloc range - * - * On nommu, vmalloc/vfree wrap through kmalloc/kfree directly, so there - * is no special casing required. - */ -#ifdef CONFIG_MMU -extern bool is_vmalloc_addr(const void *x); -extern int is_vmalloc_or_module_addr(const void *x); -#else -static inline bool is_vmalloc_addr(const void *x) -{ - return false; -} -static inline int is_vmalloc_or_module_addr(const void *x) -{ - return 0; -} -#endif - /* * How many times the entire folio is mapped as a single unit (eg by a * PMD or PUD entry). This is probably not what you want, except for diff --git a/include/linux/mm/vmalloc_addr.h b/include/linux/mm/vmalloc_addr.h new file mode 100644 index 000000000000..86ad2dc94960 --- /dev/null +++ b/include/linux/mm/vmalloc_addr.h @@ -0,0 +1,33 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef _LINUX_MM_VMALLOC_ADDR_H +#define _LINUX_MM_VMALLOC_ADDR_H + +#include // for bool + +struct page; + +/* Support for virtually mapped pages */ +struct page *vmalloc_to_page(const void *addr); +unsigned long vmalloc_to_pfn(const void *addr); + +/* + * Determine if an address is within the vmalloc range + * + * On nommu, vmalloc/vfree wrap through kmalloc/kfree directly, so there + * is no special casing required. + */ +#ifdef CONFIG_MMU +extern bool is_vmalloc_addr(const void *x); +extern int is_vmalloc_or_module_addr(const void *x); +#else +static inline bool is_vmalloc_addr(const void *x) +{ + return false; +} +static inline int is_vmalloc_or_module_addr(const void *x) +{ + return 0; +} +#endif + +#endif /* _LINUX_MM_VMALLOC_ADDR_H */ From patchwork Thu Feb 22 11:50:54 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Max Kellermann X-Patchwork-Id: 13567174 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 A6F4FC48BEB for ; Thu, 22 Feb 2024 11:51:40 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C577C6B008A; Thu, 22 Feb 2024 06:51:17 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id BDF896B008C; Thu, 22 Feb 2024 06:51:17 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9E6D56B0092; Thu, 22 Feb 2024 06:51:17 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 791826B008A for ; Thu, 22 Feb 2024 06:51:17 -0500 (EST) Received: from smtpin14.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 1E9CDA0DCF for ; Thu, 22 Feb 2024 11:51:17 +0000 (UTC) X-FDA: 81819274194.14.322F8DE Received: from mail-wm1-f47.google.com (mail-wm1-f47.google.com [209.85.128.47]) by imf16.hostedemail.com (Postfix) with ESMTP id 5A45718000E for ; Thu, 22 Feb 2024 11:51:15 +0000 (UTC) Authentication-Results: imf16.hostedemail.com; dkim=pass header.d=ionos.com header.s=google header.b=LXxXzMzX; dmarc=pass (policy=quarantine) header.from=ionos.com; spf=pass (imf16.hostedemail.com: domain of max.kellermann@ionos.com designates 209.85.128.47 as permitted sender) smtp.mailfrom=max.kellermann@ionos.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1708602675; 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-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=rnyD5PxkKV5o19zNsO0L5tf/fTdRWviw2NTc0WpmPto=; b=avOgARAAFmPPr6TJTp0u+3KSVqkq14HB/p43mBBIhDAFtfYMeKWZIeiN2NZvGDewSuRH/e oGCT9py/+jgTgDWgI40lzk6IhNxXYGVy97y3B6dN2gHs4UKRmY/Ksmm43Kgon3CbwDH1iT BFkROUAM6Lsq88SJ5CootWj8FfCyp6Q= ARC-Authentication-Results: i=1; imf16.hostedemail.com; dkim=pass header.d=ionos.com header.s=google header.b=LXxXzMzX; dmarc=pass (policy=quarantine) header.from=ionos.com; spf=pass (imf16.hostedemail.com: domain of max.kellermann@ionos.com designates 209.85.128.47 as permitted sender) smtp.mailfrom=max.kellermann@ionos.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1708602675; a=rsa-sha256; cv=none; b=CtnZty4Mg922xkIHlmU6JurM/KFYNG9dJsPp1kpz/4n6u/uzOGDsEDAd1AsEN+4vojzoSj P5+QBawP2NOQnziT5hLf+pY7RfmLQoJagoBcKFCtfNydg+ZnXoucoqCsuL+xDQ0kGb/YQo kkwq4nhYDpJHkMs17/5guj+a+s8Hh4I= Received: by mail-wm1-f47.google.com with SMTP id 5b1f17b1804b1-412698ac6f9so4597475e9.0 for ; Thu, 22 Feb 2024 03:51:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ionos.com; s=google; t=1708602674; x=1709207474; darn=kvack.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=rnyD5PxkKV5o19zNsO0L5tf/fTdRWviw2NTc0WpmPto=; b=LXxXzMzXS5H+aCuQLxhuM2qx10I6UYKxj0Zy4kGflPuCQea1ICej/CYj7wFJq2pow6 2nhpEO+7tTxhu4MAinUrKLRRDwFgLc55nQTeaBSZCnf2vdO5NFDFK/klhGDsSEeFWd02 /jKEWjyVlkGkOlG4sg9IFu5FaMxg0oyi3+jpAuONxuuNkiPxFtW9ozeommjBvCLPqneY yfrNEyW+ddyiNZ4kji5ORNOZOpVZaKlltkG/FxOCtERgGJEtvPnWAMqOJ9ZAjfgaowIJ 6UOSZyeJkXiYaDYGQADr1eQ6drbplr1dESQ4gIGssbQ8bKizMwYgCOEZqKzEnmfGXhSi +OeA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708602674; x=1709207474; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=rnyD5PxkKV5o19zNsO0L5tf/fTdRWviw2NTc0WpmPto=; b=utzeQzDr1j6DQ118aUGsr3brveR16J5hyB5KFM6B/fpkHz+aUWWPcFFccKTxxToEIU /+mltA/io7u3122W+jXuXE0GOxksiwOHN4tuRJpOexaNBTed2hYHWLyttgNi5mkrg4cP 5aPXtZ6LpXUZrMB1PYm3s3tk4vRyQw22c83C4lzw2948lGPK/AIPjt15EB5sRuGQQOYm 1zjSclWZDwtbJcgXKXykZMifElLb0lxFmNwxdFpfPQw1E739wXWHWFEtqw1YPM1yg4Rt 7YKIyBxHMWNVY0JeF0caRFhFmCBMVptUE0JaKdmE8mlhkSAYyOlecVTjE8HREjS1NqaA 9MdA== X-Forwarded-Encrypted: i=1; AJvYcCW8JwWFXHL9tKQcBxHBXMNCSNuvbwKHg5MEqRS8WRnf1Ti7tm33GHUVwtEZsPivhpC95y1VBGREUN3YVykB5J9gAIE= X-Gm-Message-State: AOJu0YwFwXhjV8Oux7C07FggrmzzuzoQ3d/37uSUJOqx4u8IKtLHCOCj 34e/RySleuaRUcqsxUiXOlZu+NyFRXLa6740Wt7G/Gr3/44jQ4eOWy+SGMsQ4CY= X-Google-Smtp-Source: AGHT+IFfueNkE9tnjKhfFyaIv+QALqBUvLT98iMXV3rV/HToXDFD1IoXBeXq5yhH3kCVsjL9LprabQ== X-Received: by 2002:a05:600c:444a:b0:411:c8a7:7b09 with SMTP id v10-20020a05600c444a00b00411c8a77b09mr1966316wmn.10.1708602674092; Thu, 22 Feb 2024 03:51:14 -0800 (PST) Received: from raven.intern.cm-ag (p200300dc6f010900023064fffe740809.dip0.t-ipconnect.de. [2003:dc:6f01:900:230:64ff:fe74:809]) by smtp.gmail.com with ESMTPSA id co18-20020a0560000a1200b0033d4c3b0beesm15044920wrb.19.2024.02.22.03.51.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Feb 2024 03:51:13 -0800 (PST) From: Max Kellermann To: akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: willy@infradead.org, Max Kellermann Subject: [PATCH v2 13/14] linux/mm.h: move high_memory to mm/high_memory.h Date: Thu, 22 Feb 2024 12:50:54 +0100 Message-Id: <20240222115055.1172877-14-max.kellermann@ionos.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240222115055.1172877-1-max.kellermann@ionos.com> References: <20240222115055.1172877-1-max.kellermann@ionos.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: 5A45718000E X-Rspam-User: X-Rspamd-Server: rspam05 X-Stat-Signature: f6zu4cky5qdpy9xjuqci9fa6enier56t X-HE-Tag: 1708602675-467078 X-HE-Meta: U2FsdGVkX19ff50BalWB2qadSzB/MfeoYG1IOD0vfjPNZ+K/+EvqZWpgsg6wYOv2WFZtdm8qCcVip1G/nE6EgRrvZo7EuSwWoXSjxY+s6WlWplAw9ssXlgKwkeQA6oZIjeSzjKQ0pmwLXdoILltfHr+WonnABifcPNkNkaekF7O367/Zdc+rc0GFik7UYH+TzU5I9YJqOYl92mGdl0cuyRBQdDWznmij8S0GQyZ9T9W+kcktxzlFTexSUSqeZLviT1DdbK1AZ6xqTvIq+FSWyWB4tpK+bT700riJjn4j1fVj8ZcQFiqkqCs6tf4WyDf3BQ//socnc7X2q6AHpwZ7HM4/ZSvX2D4VWHmADA/zxP+VdQ8LtgyMa76M941ck6Y3d+lEgQbZa7af8wvw42ha47eqds7/ui3Hgg0Sg1Bqfci7g8qaa627qLnTGPHrG/XnHbU+N0grHu8iqVswf+dnl0hgN49HcobKAlgvpupLnkavIejq02rNB8vPxr+So1elxT9aL8v2Tm/tKZ7sHqWuoLj8kPzig1n7szj6oNe0jDNcGKAWra6Hh8T4nYNqqrrPEZc49/L/64Nurs0zpll7Zn74SN7eKK0s12Zrk1bcVy9hfKrY5Vwh0LxG3FEF2JGOU8J6N9qFFeVebAtC6e32Mr4TwP20OhaEYtTRTWQpeOdyELruGYymNzLoSzRKoPKis/v22EjA87vVTnWA+gOZiZFGv0sHCAac2EqoF9nPIfzk43+Be4mOlescM2L35jtR5PrqiHn6kfOJR0K3GKrz50aDh+CG9/1QpWpZvbyfqyh0mXWXmyqbupO4tmEM6C9FQTLZoJK89+rK5QaeIA51bqvEBj1TXmryrGRLT7PNv9CHzGtxVFct3MvviQx3Sy7v9M7WJj06FAc+OtXkj8irvaP1hKWSpi+26Dr0/SVnhYxJaql0WlfF0YCQjZ9bNdKqyoXgVSpcdMlZ7Fnv25u x0+mNXIl 32CQ5v1puqeM7Frg2sBAHeC7NSJMeuc+CwW9UKvTEEYAu8smU1qMEflcFhuegNT0+yPERp0iwLQJhiyM75TuzjfwnJ4wvoXZ9wWte6sy022nx/zeaU49ohKu78alM5VZN145bBYL/ZSq38JpcQBlwLu/ewJxGMN5rV+ez 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: This variable is used by lots of arch/*/include/asm/ headers, but these do not (and should not) include the huge linux/mm.h header. Let's move this "extern" variable to a separate header and include this one in arch/. Signed-off-by: Max Kellermann --- arch/arm/include/asm/memory.h | 4 ++++ arch/arm/include/asm/pgtable.h | 2 ++ arch/csky/include/asm/page.h | 1 + arch/hexagon/include/asm/mem-layout.h | 4 ++++ arch/m68k/include/asm/page_mm.h | 1 + arch/m68k/include/asm/pgtable_mm.h | 1 + arch/parisc/include/asm/floppy.h | 1 + arch/powerpc/include/asm/book3s/32/pgtable.h | 4 ++++ arch/powerpc/include/asm/nohash/32/pgtable.h | 1 + arch/powerpc/include/asm/page.h | 1 + arch/x86/include/asm/floppy.h | 1 + arch/x86/include/asm/pgtable_32_areas.h | 4 ++++ drivers/mtd/nand/onenand/onenand_samsung.c | 1 + include/linux/mm.h | 2 +- include/linux/mm/high_memory.h | 7 +++++++ 15 files changed, 34 insertions(+), 1 deletion(-) create mode 100644 include/linux/mm/high_memory.h diff --git a/arch/arm/include/asm/memory.h b/arch/arm/include/asm/memory.h index ef2aa79ece5a..a67afb213e2e 100644 --- a/arch/arm/include/asm/memory.h +++ b/arch/arm/include/asm/memory.h @@ -387,6 +387,10 @@ static inline unsigned long __virt_to_idmap(unsigned long x) */ #define ARCH_PFN_OFFSET PHYS_PFN_OFFSET +#ifndef __ASSEMBLY__ +#include +#endif + #define virt_to_page(kaddr) pfn_to_page(virt_to_pfn(kaddr)) #define virt_addr_valid(kaddr) (((unsigned long)(kaddr) >= PAGE_OFFSET && (unsigned long)(kaddr) < (unsigned long)high_memory) \ && pfn_valid(virt_to_pfn(kaddr))) diff --git a/arch/arm/include/asm/pgtable.h b/arch/arm/include/asm/pgtable.h index be91e376df79..eb80f6a65619 100644 --- a/arch/arm/include/asm/pgtable.h +++ b/arch/arm/include/asm/pgtable.h @@ -11,6 +11,8 @@ #include #ifndef __ASSEMBLY__ +#include + /* * ZERO_PAGE is a global shared page that is always zero: used * for zero-mapped memory areas etc.. diff --git a/arch/csky/include/asm/page.h b/arch/csky/include/asm/page.h index 4a0502e324a6..016f722fbe43 100644 --- a/arch/csky/include/asm/page.h +++ b/arch/csky/include/asm/page.h @@ -32,6 +32,7 @@ #ifndef __ASSEMBLY__ +#include #include #define virt_addr_valid(kaddr) ((void *)(kaddr) >= (void *)PAGE_OFFSET && \ diff --git a/arch/hexagon/include/asm/mem-layout.h b/arch/hexagon/include/asm/mem-layout.h index e2f99413fe56..a09116c50043 100644 --- a/arch/hexagon/include/asm/mem-layout.h +++ b/arch/hexagon/include/asm/mem-layout.h @@ -10,6 +10,10 @@ #include +#ifndef __ASSEMBLY__ +#include +#endif + /* * Have to do this for ginormous numbers, else they get printed as * negative numbers, which the linker no likey when you try to diff --git a/arch/m68k/include/asm/page_mm.h b/arch/m68k/include/asm/page_mm.h index e0ae4d5fc985..f958655d1931 100644 --- a/arch/m68k/include/asm/page_mm.h +++ b/arch/m68k/include/asm/page_mm.h @@ -5,6 +5,7 @@ #ifndef __ASSEMBLY__ #include +#include #include /* diff --git a/arch/m68k/include/asm/pgtable_mm.h b/arch/m68k/include/asm/pgtable_mm.h index dbdf1c2b2f66..ec593656bdc5 100644 --- a/arch/m68k/include/asm/pgtable_mm.h +++ b/arch/m68k/include/asm/pgtable_mm.h @@ -13,6 +13,7 @@ #ifndef __ASSEMBLY__ #include +#include #include #include diff --git a/arch/parisc/include/asm/floppy.h b/arch/parisc/include/asm/floppy.h index b318a7df52f6..98ed37c5dc59 100644 --- a/arch/parisc/include/asm/floppy.h +++ b/arch/parisc/include/asm/floppy.h @@ -8,6 +8,7 @@ #ifndef __ASM_PARISC_FLOPPY_H #define __ASM_PARISC_FLOPPY_H +#include #include diff --git a/arch/powerpc/include/asm/book3s/32/pgtable.h b/arch/powerpc/include/asm/book3s/32/pgtable.h index 52971ee30717..03e0a32e1c2c 100644 --- a/arch/powerpc/include/asm/book3s/32/pgtable.h +++ b/arch/powerpc/include/asm/book3s/32/pgtable.h @@ -4,6 +4,10 @@ #include +#ifndef __ASSEMBLY__ +#include +#endif + /* * The "classic" 32-bit implementation of the PowerPC MMU uses a hash * table containing PTEs, together with a set of 16 segment registers, diff --git a/arch/powerpc/include/asm/nohash/32/pgtable.h b/arch/powerpc/include/asm/nohash/32/pgtable.h index 9164a9e41b02..8a9f5b546e4a 100644 --- a/arch/powerpc/include/asm/nohash/32/pgtable.h +++ b/arch/powerpc/include/asm/nohash/32/pgtable.h @@ -5,6 +5,7 @@ #include #ifndef __ASSEMBLY__ +#include #include #include #include /* For sub-arch specific PPC_PIN_SIZE */ diff --git a/arch/powerpc/include/asm/page.h b/arch/powerpc/include/asm/page.h index e5fcc79b5bfb..c541e71d3d5c 100644 --- a/arch/powerpc/include/asm/page.h +++ b/arch/powerpc/include/asm/page.h @@ -7,6 +7,7 @@ */ #ifndef __ASSEMBLY__ +#include #include #include #include diff --git a/arch/x86/include/asm/floppy.h b/arch/x86/include/asm/floppy.h index 6ec3fc969ad5..7756e984f146 100644 --- a/arch/x86/include/asm/floppy.h +++ b/arch/x86/include/asm/floppy.h @@ -10,6 +10,7 @@ #ifndef _ASM_X86_FLOPPY_H #define _ASM_X86_FLOPPY_H +#include #include /* diff --git a/arch/x86/include/asm/pgtable_32_areas.h b/arch/x86/include/asm/pgtable_32_areas.h index b6355416a15a..b339137b4f4e 100644 --- a/arch/x86/include/asm/pgtable_32_areas.h +++ b/arch/x86/include/asm/pgtable_32_areas.h @@ -3,6 +3,10 @@ #include +#ifndef __ASSEMBLY__ +#include +#endif + /* * Just any arbitrary offset to the start of the vmalloc VM area: the * current 8MB value just means that there will be a 8MB "hole" after the diff --git a/drivers/mtd/nand/onenand/onenand_samsung.c b/drivers/mtd/nand/onenand/onenand_samsung.c index fd6890a03d55..7c3cc270386d 100644 --- a/drivers/mtd/nand/onenand/onenand_samsung.c +++ b/drivers/mtd/nand/onenand/onenand_samsung.c @@ -15,6 +15,7 @@ #include #include #include +#include #include #include #include diff --git a/include/linux/mm.h b/include/linux/mm.h index ad5971219ef6..b5cfe35ee7f2 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -6,6 +6,7 @@ #include #include #include +#include #include #include #include @@ -81,7 +82,6 @@ static inline void totalram_pages_add(long count) atomic_long_add(count, &_totalram_pages); } -extern void * high_memory; extern int page_cluster; extern const int page_cluster_max; diff --git a/include/linux/mm/high_memory.h b/include/linux/mm/high_memory.h new file mode 100644 index 000000000000..e504aafd0d48 --- /dev/null +++ b/include/linux/mm/high_memory.h @@ -0,0 +1,7 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef _LINUX_MM_HIGH_MEMORY_H +#define _LINUX_MM_HIGH_MEMORY_H + +extern void * high_memory; + +#endif /* _LINUX_MM_HIGH_MEMORY_H */ From patchwork Thu Feb 22 11:50:55 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Max Kellermann X-Patchwork-Id: 13567175 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 D3C81C48BF8 for ; Thu, 22 Feb 2024 11:51:43 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 359B76B0092; Thu, 22 Feb 2024 06:51:18 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 2B8536B0093; Thu, 22 Feb 2024 06:51:18 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 10E5E6B0095; Thu, 22 Feb 2024 06:51:18 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id EC3AA6B0092 for ; Thu, 22 Feb 2024 06:51:17 -0500 (EST) Received: from smtpin09.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id CEBF080DA4 for ; Thu, 22 Feb 2024 11:51:17 +0000 (UTC) X-FDA: 81819274194.09.98C1E9B Received: from mail-wm1-f51.google.com (mail-wm1-f51.google.com [209.85.128.51]) by imf02.hostedemail.com (Postfix) with ESMTP id 0F55F80002 for ; Thu, 22 Feb 2024 11:51:15 +0000 (UTC) Authentication-Results: imf02.hostedemail.com; dkim=pass header.d=ionos.com header.s=google header.b="HU/DeWn4"; dmarc=pass (policy=quarantine) header.from=ionos.com; spf=pass (imf02.hostedemail.com: domain of max.kellermann@ionos.com designates 209.85.128.51 as permitted sender) smtp.mailfrom=max.kellermann@ionos.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1708602676; 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-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=FORSCnEJSDoW1xOoni46e3+631c/MspUPxiW79pGM2g=; b=QD9cXGiAAEehiPgoxnVNp6bwOsFqdqjdmfk0EDNA7F5nDTMNZQ9Ch4H4sAgArJw3DLhDS6 SIzjCnPBK+IW8KF/EYdTFB3WBIHQaE1QvT0Xybc2Mnvm+J6fWNyblgkCh9cNNHum7Mqzbz DAwpNH6uMAwlv3WYWQNtLdSXtm0Ew9A= ARC-Authentication-Results: i=1; imf02.hostedemail.com; dkim=pass header.d=ionos.com header.s=google header.b="HU/DeWn4"; dmarc=pass (policy=quarantine) header.from=ionos.com; spf=pass (imf02.hostedemail.com: domain of max.kellermann@ionos.com designates 209.85.128.51 as permitted sender) smtp.mailfrom=max.kellermann@ionos.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1708602676; a=rsa-sha256; cv=none; b=DsM0pdpH7CtetHaDDX6wRwprkKJnRVV5vpeLJvkg8RIgkrNeLxbCThB04G9wwZCROTVw4+ LN6Y87CMeCfhrwZH2OYFmzRMi34spe9i8znnGUFrjb4AeL4wgVVQXckFKOIkFHcW4BggUJ I3W15TfTM8PrNzre2/IujDq3lRUR+9s= Received: by mail-wm1-f51.google.com with SMTP id 5b1f17b1804b1-412730e5b95so16939975e9.3 for ; Thu, 22 Feb 2024 03:51:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ionos.com; s=google; t=1708602675; x=1709207475; darn=kvack.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=FORSCnEJSDoW1xOoni46e3+631c/MspUPxiW79pGM2g=; b=HU/DeWn4ORb2j2uuxN4/zQqNWJ+1XGkQFs0Omv6Thg2RskuF58LfVIoWlmanY4BuVU TxG1XMNSy7VI9oAiIU2vpbG6SDEK3ExzTe+1WMt9X+FoWHPtp88OXAgoi5vVI8NZwaci JVDgeVpDtOkvfW0ooSFzZ3GMm8/ZWWjxj1QBoyLTwfy1+zV4QXK91HiykvcAWxOx+rPJ X98wKh0xugOWqGDyNvc05I239kNCrcb4CSl3lE4jY0+gbsTOWN+RpLqKe6SrrAl05hgg ysh9FZASt0IRamkOmFX6e/AIsx+mOMO+X4M84+50vPRSGBfnMJio/pZXFBjiZkufG+3D Fnfg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708602675; x=1709207475; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=FORSCnEJSDoW1xOoni46e3+631c/MspUPxiW79pGM2g=; b=aXZUdVTsre2yqDYFRcPZvtB8ln9L4ju+ZZ8IPbafhYnWP7/APnJHw0z9+o32XyTgDS DRamKJoen95sEwSb1EREZ8iczTZmmvILToyKBx11yq1bR0IJH8D4DIj0Z6Ms09+va1Fj gkxS8c491jtUM5TqOOb4Rafseqk2iTdV22/r9+c3sX9MIwKwukh5x0F/mhoekhJzFxEw GH/XRKo5Z4OlcU1BEB2qN1ycwMDeckWrYxIpMsJ5TFTc4yTr/70qGVWTlbuMkVOS5+ii sy+pAbvvI5YrIGi6/iEo07NJRb1l2tYCCwadWFoVCMNj+L7uT1KhRDOcpYmIdfqjv5Oy A/6w== X-Forwarded-Encrypted: i=1; AJvYcCUolSJkXMXPcX/5Zx+sqDNVjjovQA9mQRauIjnpU/IAY78wcSyfzbwfcKeG1cd1F0PRSwhvu1+h9Lm+Nsns5Ubysyo= X-Gm-Message-State: AOJu0YyJlS/Y/xPR8uTd9j8ClwE+ex/PLbuQeLruRP6JaakZBNF6kzWu dTJNpaHqUPezqG+ZUEBeu0nm8iJdTWt9te7oBu8Bx7aUsAbiNin4el7FI5dE3z4= X-Google-Smtp-Source: AGHT+IEnpTEGPoO8JHL0sqB2DmBhjMLtnhAh5loH7/awl6AZKhYcFoFELJghLaiQ/sOhlIdWSxDH3g== X-Received: by 2002:a5d:64a7:0:b0:33d:ed4:5c86 with SMTP id m7-20020a5d64a7000000b0033d0ed45c86mr19274430wrp.63.1708602674795; Thu, 22 Feb 2024 03:51:14 -0800 (PST) Received: from raven.intern.cm-ag (p200300dc6f010900023064fffe740809.dip0.t-ipconnect.de. [2003:dc:6f01:900:230:64ff:fe74:809]) by smtp.gmail.com with ESMTPSA id co18-20020a0560000a1200b0033d4c3b0beesm15044920wrb.19.2024.02.22.03.51.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Feb 2024 03:51:14 -0800 (PST) From: Max Kellermann To: akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: willy@infradead.org, Max Kellermann Subject: [PATCH v2 14/14] include: reduce dependencies on linux/mm.h Date: Thu, 22 Feb 2024 12:50:55 +0100 Message-Id: <20240222115055.1172877-15-max.kellermann@ionos.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240222115055.1172877-1-max.kellermann@ionos.com> References: <20240222115055.1172877-1-max.kellermann@ionos.com> MIME-Version: 1.0 X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: 0F55F80002 X-Stat-Signature: rmmiwg9qzkx8w1dwutwr1pedddaq74gf X-Rspam-User: X-HE-Tag: 1708602675-735106 X-HE-Meta: U2FsdGVkX18RPiKLFsPLTcrfcWN5asHeAtnEImYffVLzV009qf/TyqruPH4r6z05Fh4Uj0l55xKuphxHL4465Ied9nffrpw9TiL2cmI1zWgita5+NTJOKRxGGigXXY7m+jAq55JigSKcl0rOy3pbQZO3H7WNMXfLNUrdt7p3Ro90WWILTAvfub8jnppoOSxDdXEXOzpuLRZtkxeG8+Pgfpy1UZU3Ouci3zNBmK44/11l+sE3EmfXj301p1sV+DHcpdh/CN2gJMKhwLIRfZGLd3Ovna770d7E3ih15HnQIb/eOh591e6mLfeGDB1SPkBB/xYhehh1iojA8T+a+3yObWwlHHii1Df9fg42sFG2x5l+e3nAfpMgsxxbRc3FSjS7cS5Zwvk7o2O7sNZd1eeKKqhwn7P4Ask27AVp9LBSgZgYKsNIy5f5pJgRY9rnLAfLQ1A8TZ3lqRRHmoQi5kCdPT/v7WYwWlhy2wpwSzSk8HZsf6qPM3mrkKWeXBqjjcxsxMmQd8Ejp0yCBUGbTV9hSonPZaeouvLpoJzMAb42ZNCR8rNztndcXhO6fw9SeB4sxu1ZRh71DWcU3iCfh6DVk7niIn93/sBwDyGAPTKuqrfGcAGt+Fvwcsdu1eOwe2RPV93qW6PyYirx1mLG+r/IMpQIo0ew26vyXVQv7ZB+FisL0styUZHDIpvWn/DUZOx+JiIhV194OiR3Hsf53n5yeHHNlCHy++bPrUprGzDDhrDa1fy/9/CJQNEmARdk6PWmnXM0qC9Y7z1xCNVihsvPRh8z2bvPU5Ff/h9L7LpGIMNiAzavL7Vh0Jd1jiQf3udvjIq63TxppoyyByqy01eUCt691V4aU0GvrA3pr/ePQ8quK5wCNbGIvSdjTFGbLI0gbmXTGnwc3mnLUoDMaGS3SB0F0oKjX9Wf9WaX/YY76iMYW73rEttgFIqZScRPJKzyXvJhmB3MNnMquogDClU opTTmy68 HkzPm5ccPE3AghPkRJyAWpkrsWo8eYdo/xsDPURoXr+3cRHPy/29aRyOV9k0AIJ3g3MQnb7fE8PZsaslti4ViLCYgWvYkKjbyeHfmLK9sNeGW+rSyO5+F0FAHMswR+pxuT0K0K+h/S12tTYSDcBcynJpQbWHacFhBO8Lz4eQbspXhQgbGhbipGv3t0y93P4E/5ZzuZOb3WYs9fdotHC4XGZwCpbQq0BpV9vV5JDbgLIV0e2PsT435Ge1ekysn9wxb3c9QiHtXDk7vG3dUkA3NIoE8Sku/NQsnd42y7imcEHV6dZGrKXnQrq4RZCbxOzFG/sJPYJQ6BwGuWUZgiqmqRMnjEq7u3b0pXi6MwvkdnEbuYbNAhi0BZbMV+wj/M/GL67sp 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: Replace with the smaller pieces that were just splitted out. This affects a few headers that are included by many, e.g. bio.h and highmem.h, which now no longer depend on the fat header. For this, several missing includes need to be added because they are no longer indirectly included, e.g. . Signed-off-by: Max Kellermann --- include/linux/bio.h | 2 ++ include/linux/dma-mapping.h | 1 + include/linux/highmem-internal.h | 2 ++ include/linux/highmem.h | 4 +++- include/linux/scatterlist.h | 2 +- include/linux/skbuff.h | 4 ++++ lib/scatterlist.c | 1 + 7 files changed, 14 insertions(+), 2 deletions(-) diff --git a/include/linux/bio.h b/include/linux/bio.h index 875d792bffff..e2f24d7235d3 100644 --- a/include/linux/bio.h +++ b/include/linux/bio.h @@ -5,7 +5,9 @@ #ifndef __LINUX_BIO_H #define __LINUX_BIO_H +#include // for struct kiocb, IOCB_NOWAIT #include +#include /* struct bio, bio_vec and BIO_* flags are defined in blk_types.h */ #include #include diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h index 4a658de44ee9..37d5591039c7 100644 --- a/include/linux/dma-mapping.h +++ b/include/linux/dma-mapping.h @@ -11,6 +11,7 @@ #include #include #include +#include /** * List of possible attributes associated with a DMA mapping. The semantics diff --git a/include/linux/highmem-internal.h b/include/linux/highmem-internal.h index a3028e400a9c..a479e6b7c54c 100644 --- a/include/linux/highmem-internal.h +++ b/include/linux/highmem-internal.h @@ -2,6 +2,8 @@ #ifndef _LINUX_HIGHMEM_INTERNAL_H #define _LINUX_HIGHMEM_INTERNAL_H +#include + /* * Outside of CONFIG_HIGHMEM to support X86 32bit iomap_atomic() cruft. */ diff --git a/include/linux/highmem.h b/include/linux/highmem.h index 00341b56d291..10a165a913ad 100644 --- a/include/linux/highmem.h +++ b/include/linux/highmem.h @@ -7,7 +7,9 @@ #include #include #include -#include +#include // for page_size() +#include // for folio_put() +#include #include #include diff --git a/include/linux/scatterlist.h b/include/linux/scatterlist.h index 0516e64dc03e..9221bba82b23 100644 --- a/include/linux/scatterlist.h +++ b/include/linux/scatterlist.h @@ -5,7 +5,7 @@ #include #include #include -#include +#include #include #ifdef CONFIG_UML diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index 28c7cb7ce251..06fedc08b998 100644 --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h @@ -16,6 +16,10 @@ #include #include #include +#include // for alloc_pages_node() +#include // for get_page(), put_page() +#include // for page_to_nid() +#include // for page_is_pfmemalloc() #include #include #include diff --git a/lib/scatterlist.c b/lib/scatterlist.c index 68b45c82c37a..03599396f15d 100644 --- a/lib/scatterlist.c +++ b/lib/scatterlist.c @@ -9,6 +9,7 @@ #include #include #include +#include #include #include