From nobody Sat Feb 7 12:18:29 2026 Received: from mail-ej1-f51.google.com (mail-ej1-f51.google.com [209.85.218.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 95D3679B9A for ; Tue, 12 Mar 2024 09:41:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.51 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710236513; cv=none; b=b/xIeK1ZiLnqeI8IsGtAgrQvRKRN9nvKKuGT4uvCQZmqnoJrw3erejs+hos3Es1RL2XPNA7h7y9+p4oSDwyRSAC3UO9O0X7I+x62yMvtNYPDICGmGCe9zKXjwV0l3tDXUeX2H4ztkCOaBxlfygCG0TmVswVozsXtZn2ptAS5UOg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710236513; c=relaxed/simple; bh=aE+p22tweMC/IDat2OPkdUMlUaO+IRnkn6m8Btrw+BU=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=QXxggiAxgs6lmvhfZNblrZvwvO3ryQP2Cr0ZSbUv1Cf0PmAeGWEucqAJYeABsKDdipP5uPt+RAL+QESdU/mcgfLBLBsshuBcA/yqj2RhYb9slQJfXSLwsY8942SWFafmjknTrmrgfT0mf1FXyTfNR/lsFjdjzo4B8h3WCuT3bNs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=ionos.com; spf=pass smtp.mailfrom=ionos.com; dkim=pass (2048-bit key) header.d=ionos.com header.i=@ionos.com header.b=V97jcgPo; arc=none smtp.client-ip=209.85.218.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=ionos.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ionos.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ionos.com header.i=@ionos.com header.b="V97jcgPo" Received: by mail-ej1-f51.google.com with SMTP id a640c23a62f3a-a44665605f3so743092566b.2 for ; Tue, 12 Mar 2024 02:41:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ionos.com; s=google; t=1710236509; x=1710841309; darn=vger.kernel.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=0dV8qz5b7vjFxc+nJLBNBJ+56OSa6LDyqLZDY8SGrTc=; b=V97jcgPoMvewcIRljua0qMNbYAmLdkUm8omOvRDOvw7XfyFmhiMyBLRNI/n2za3Bpa ZVbjGCv0Q4wmcjBNV6FEpy34JqUHr7EgNDQMxW6bxoQ/p/8XVGqmSfB9lccGUvIsV1mk gql0G25SHAQD7Up7ALvmrVkxYm2aaFeWyi1KZMAw2AasBCbOY2TYHTq6l/9nbOFszxC7 fXcrDCWNQqrJDIps5f/O9JBo/jkIPUVK7QNHJff+RKP2LnZfPaBa6maVVEDGneGJM5sN rcbDehLuCJxz44oqAnqPiq4ixoEHr/dpS09nSyDKKpp2EggJkkVF9SqCut69LznV5mDw eTKA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710236509; x=1710841309; 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=0dV8qz5b7vjFxc+nJLBNBJ+56OSa6LDyqLZDY8SGrTc=; b=juEAQmcRxgkeNg42KifkgoItw1yHOVq/RtSvVpR6ELt29YyT8cwAYtT+K36I1bY8gV hKPOxVDlMRa3Tf5uChygmcKcd9qDg1u+4bYnBEIVfj9ONNiR5NpV2LTy/EF+UliYQRue pzA5wXa0xcFaUfTfiFoRuf3o231cx6LU6HLnpgHWV/p97S9gKnAk0AJSScWD6OH5a8oL 6gn6APS5sl7tvh822z0YXT5xRtfUYYEAl04UpcDRaPw4jbTFQRJHZtPzt4UaWSJxYGCJ BWum0cCWtU/K5NUOiKgpjZEyHkVfhmUsjudbzfSwJYNtN2bHXOzF3dJ2yGkmLjb9TaAU 4skw== X-Forwarded-Encrypted: i=1; AJvYcCVsA2j4gcTwIi5Zya19kJrLjMDavoSOlN4Peu5lne7ruG+3e8paHfefg/YahwzWsBUpYP0D3YFWB+ulbaXutSom4I8brYAz/tjzmMCJ X-Gm-Message-State: AOJu0Yz0TOzxKU8GNxHz7pYGNjRQe5tO8Hb1L5NEfbAmfdAzDUZX8hQ9 skMT6G1VoGg972VDw2+8TSz4+ZyXXUaIyyp3Zehi7CWKhEAio1nrMVk48yrZYgg= X-Google-Smtp-Source: AGHT+IGrxpm0eSCROeFSVIEIba08X0zlEkLFpXxq0Se/EN1b10t9i0f+FR5p5s277YyLY4fp4vl2zw== X-Received: by 2002:a17:907:a809:b0:a46:1a14:356a with SMTP id vo9-20020a170907a80900b00a461a14356amr4291481ejc.53.1710236509046; Tue, 12 Mar 2024 02:41:49 -0700 (PDT) Received: from raven.blarg.de (p200300dc6f010900023064fffe740809.dip0.t-ipconnect.de. [2003:dc:6f01:900:230:64ff:fe74:809]) by smtp.gmail.com with ESMTPSA id jw22-20020a170906e95600b00a4623030893sm2091961ejb.126.2024.03.12.02.41.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Mar 2024 02:41:48 -0700 (PDT) From: Max Kellermann To: akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: willy@infradead.org, sfr@canb.auug.org.au, Max Kellermann Subject: [PATCH v4 01/15] drivers: add missing includes on linux/mm.h (and others) Date: Tue, 12 Mar 2024 10:41:19 +0100 Message-Id: <20240312094133.2084996-2-max.kellermann@ionos.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240312094133.2084996-1-max.kellermann@ionos.com> References: <20240312094133.2084996-1-max.kellermann@ionos.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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/bcm2835-dma.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/page-flags.h | 3 +++ include/linux/scatterlist.h | 6 ++++++ include/scsi/scsicam.h | 3 +++ kernel/dma/ops_helpers.c | 1 + kernel/dma/remap.c | 1 + mm/dmapool.c | 1 + 36 files changed, 52 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 =20 #ifdef CONFIG_PCI + +#include // for VMALLOC_* + unsigned long pcibios_min_io =3D 0x1000; EXPORT_SYMBOL(pcibios_min_io); =20 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" =20 #ifdef PAGE_KERNEL_NOCACHE diff --git a/drivers/crypto/intel/qat/qat_common/adf_gen4_pm_debugfs.c b/dr= ivers/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/bcm2835-dma.c b/drivers/dma/bcm2835-dma.c index 9d74fe97452e..1d971999fd39 100644 --- a/drivers/dma/bcm2835-dma.c +++ b/drivers/dma/bcm2835-dma.c @@ -31,6 +31,7 @@ #include #include #include +#include // for ZERO_PAGE() =20 #include "virt-dma.h" =20 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/qco= m/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 @@ =20 #include #include +#include // for PAGE_ALIGN() #include #include #include diff --git a/drivers/firmware/qcom/qcom_scm-smc.c b/drivers/firmware/qcom/q= com_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/buf= fer/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 @@ =20 #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 =20 #include "io_pagetable.h" diff --git a/drivers/iommu/iommufd/selftest.c b/drivers/iommu/iommufd/selft= est.c index 7a2199470f31..bcecf44681fe 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 724ae7c2ab3b..f248e4194b49 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 @@ * */ =20 +#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 4c67e2c5a82e..e0549b4b1c33 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 @@ =20 #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 442786685515..c113ed8e8751 100644 --- a/drivers/mtd/spi-nor/core.h +++ b/drivers/mtd/spi-nor/core.h @@ -9,6 +9,8 @@ =20 #include "sfdp.h" =20 +#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 e5f243dd4288..75e05c3518f4 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/remo= teproc_core.c index f276956f2c5c..938220fe29f5 100644 --- a/drivers/remoteproc/remoteproc_core.c +++ b/drivers/remoteproc/remoteproc_core.c @@ -18,6 +18,7 @@ =20 #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 =20 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 =20 +#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 @@ =20 #include #include +#include // for SZ_* =20 #include #include diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c index 6f7e5010a673..48f694d1bc46 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 =20 diff --git a/include/linux/huge_mm.h b/include/linux/huge_mm.h index de0c89105076..55b94db3bd5c 100644 --- a/include/linux/huge_mm.h +++ b/include/linux/huge_mm.h @@ -7,6 +7,8 @@ =20 #include /* only for vma_is_dax() */ =20 +#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 2e925b5eba53..4e72c2429342 100644 --- a/include/linux/iommu.h +++ b/include/linux/iommu.h @@ -14,6 +14,7 @@ #include #include #include +#include // for copy_struct_from_user() =20 #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 =20 +#include + #if IS_ENABLED(CONFIG_NVME_KEYRING) =20 key_serial_t nvme_tls_psk_default(struct key *keyring, diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h index 652d77805e99..c7243b85328b 100644 --- a/include/linux/page-flags.h +++ b/include/linux/page-flags.h @@ -12,6 +12,9 @@ #ifndef __GENERATING_BOUNDS_H #include #include +#ifdef CONFIG_HUGETLB_PAGE_OPTIMIZE_VMEMMAP +#include // for DECLARE_STATIC_KEY_FALSE +#endif #endif /* !__GENERATING_BOUNDS_H */ =20 /* 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 =20 +#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/include/scsi/scsicam.h b/include/scsi/scsicam.h index 08edd603e521..6eb9fb7a57d0 100644 --- a/include/scsi/scsicam.h +++ b/include/scsi/scsicam.h @@ -13,6 +13,9 @@ =20 #ifndef SCSICAM_H #define SCSICAM_H + +#include // for sector_t + int scsicam_bios_param(struct block_device *bdev, sector_t capacity, int *= ip); bool scsi_partsize(struct block_device *bdev, sector_t capacity, int geom[= 3]); unsigned char *scsi_bios_ptable(struct block_device *bdev); 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() =20 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 =20 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 --=20 2.39.2 From nobody Sat Feb 7 12:18:29 2026 Received: from mail-ed1-f42.google.com (mail-ed1-f42.google.com [209.85.208.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 34F6B78295 for ; Tue, 12 Mar 2024 09:41:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.42 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710236514; cv=none; b=pLd6dyB63FFKKOlfACuV/or0fSYIvkHXeKBbUoSrONkQGUWBH1/iPnDL3yklCrsRwJkSrgI4fkUZtRUYspstg6E4MT65TAuxl7lNsGAJKRwOvDjus581zqgZCTW8JD4S0zCSPbvlWv2a7eZt0l3Zs/BDVXpS/nxU4n9ud2gAYBQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710236514; c=relaxed/simple; bh=7E++P3NE3gX/uG8sJhez163L//hFb7dWE0h0h4Q6OTA=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=J0VPzO4f9e49k7KxSFoFBV45lRaLKTEETpoQvBniHcaGbsX1MBIz1wJEzM/LraZYZk6SFet0pHHf+wRC00YtC0K2+PWJp9412LZVdkOCWaEvdOUhT+C72MHgoZ/Wo1T/ktxCK3dw2QCy92vaeacxvN5rND2wXGsfUPx7riW67lg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=ionos.com; spf=pass smtp.mailfrom=ionos.com; dkim=pass (2048-bit key) header.d=ionos.com header.i=@ionos.com header.b=cJizL0tL; arc=none smtp.client-ip=209.85.208.42 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=ionos.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ionos.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ionos.com header.i=@ionos.com header.b="cJizL0tL" Received: by mail-ed1-f42.google.com with SMTP id 4fb4d7f45d1cf-5673b5a356eso5698344a12.0 for ; Tue, 12 Mar 2024 02:41:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ionos.com; s=google; t=1710236510; x=1710841310; darn=vger.kernel.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=cJizL0tLRNPBnW2KUbcF4XuuG0UxvAbO5W7kReIyc692B52VNoFHQQtxhea+zwX2s7 bL4hZprBO+DI4aOzo5SW7UcbpHR9ZbBwO/HFYjTKBqYPiUDA81ms/s8VIsIH/i+81Cri /EeybGAv10jftyZNyvkGFPrgELRB0mh7fsNvrcDOzBzVVQ/RAEHlTqdht+tPns3rnDBm zAyA+9g3GvUfY3QDArWFQOwaISYIfIzPQUp8mrzGuzfr6YeTs9ImCftsQEDB6sBAUCzq ODEf9i1bFToNmOz2H054PvltuhMfE36pjrmeCieqOEfJQIXUyMLkNkwwCSQmsrzdQFdH 0gzQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710236510; x=1710841310; 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=DYvVBwmLie3+kE6PKVCMp1vKILgh77/c1SE7m1KNSUnu+6b3j74w7ysakYjoSfs3Xi 6jKpa1zkVzZP7q1CgfaRZLbdYz0KTFoUSIHcxy6QFRsbeBHN0r2LU0BznNHeKSmU+exm rYMy2oLbwEpo4BNN7klt9AmyTAr24CKEwBGiDar/0EU1gmYsA98IzGOU9j7raHaQEuxG f8IHGHu5SX2yBOtOjIL9D45YSMMhob/flQ3kmvBM9oc+kQ+jBzzr5N7lF2p/71jhO7Mo kWF1CdLPr+9/pVoo8eWxuwEUX/iGWFSDT2fdJY/50iW01sRCXfmDyWV785QkrFhdewrf 0m2Q== X-Forwarded-Encrypted: i=1; AJvYcCWel4YGqcnTvP6sQitAjfg2D81US2Mq6dnuVyZSurJVfZYwyz9/zfKpDRUEMjJjR5Pe7SBSGaBTuSNt3bEXPb+1sIO7rUEg/b0n0fWi X-Gm-Message-State: AOJu0YyzWzmvwX83G1EyJKHxB5nSUz8nbmndSdkNn/K9zTF1YiMLy5Zr +en72Ag5E72ozUC5ZyT0nVw0WVTBgSb9/+GHo/OVU9MWWM+xdm2uoeELX0ave5k= X-Google-Smtp-Source: AGHT+IFSzWKZX27uBwzNvn0on/otGZNxxkMdnvFDf8T+nQ/1Mylgu1PLZ/eWjNO9eX/pEk0r12IZeA== X-Received: by 2002:a17:907:d049:b0:a46:1e17:fbe6 with SMTP id vb9-20020a170907d04900b00a461e17fbe6mr970350ejc.9.1710236510553; Tue, 12 Mar 2024 02:41:50 -0700 (PDT) Received: from raven.blarg.de (p200300dc6f010900023064fffe740809.dip0.t-ipconnect.de. [2003:dc:6f01:900:230:64ff:fe74:809]) by smtp.gmail.com with ESMTPSA id jw22-20020a170906e95600b00a4623030893sm2091961ejb.126.2024.03.12.02.41.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Mar 2024 02:41:49 -0700 (PDT) From: Max Kellermann To: akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: willy@infradead.org, sfr@canb.auug.org.au, Max Kellermann Subject: [PATCH v4 02/15] include/drm/drm_gem.h: add poll_table_struct forward declaration Date: Tue, 12 Mar 2024 10:41:20 +0100 Message-Id: <20240312094133.2084996-3-max.kellermann@ionos.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240312094133.2084996-1-max.kellermann@ionos.com> References: <20240312094133.2084996-1-max.kellermann@ionos.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable After eliminating includes of linux/mm.h, the following build failure occurred: ./include/drm/drm_file.h:443:45: warning: =E2=80=98struct poll_table_struc= t=E2=80=99 declared inside parameter list will not be visible outside of th= is definition or declaration 443 | __poll_t drm_poll(struct file *filp, struct poll_table_struct *wai= t); | ^~~~~~~~~~~~~~~~~ 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 =E2=80=98__poll_t= (*)(struct file *, struct poll_table_struct *)=E2=80=99 {aka =E2=80=98unsi= gned int (*)(struct file *, struct poll_table_struct *)=E2=80=99} from inco= mpatible pointer type =E2=80=98__poll_t (*)(struct file *, struct poll_tabl= e_struct *)=E2=80=99 {aka =E2=80=98unsigned int (*)(struct file *, struct p= oll_table_struct *)=E2=80=99} [-Werror=3Dincompatible-pointer-types] 447 | .poll =3D 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; =20 /* * FIXME: Not sure we want to have drm_minor here in the end, but to avoid --=20 2.39.2 From nobody Sat Feb 7 12:18:29 2026 Received: from mail-ej1-f53.google.com (mail-ej1-f53.google.com [209.85.218.53]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 980D97829A for ; Tue, 12 Mar 2024 09:41:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.53 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710236515; cv=none; b=a6qSwmaCtomqvZYRBVtzwQfHIm58AJRn01ncunvlzNzFZ30F3e/+yopaD7eH4e4XutzB0co+AGeRxwxqje76dMjH+BMgAZ/5nOL9pq61weXiCvK9/mckNqoyPW4/7hmj2qSxshujaPAwKY+lqB+zEFZDfxL4ZmMdLh8PwJrYcsc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710236515; c=relaxed/simple; bh=DWv4Ts4UPDewpPAZDKo61Q6cBJ8156Q/JPUenZNlwS8=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=sG0kyI1S3C3F7+VG3zrnxW52L1ep/69sWmimDSSe6LuzEX6CHI7xCCoon5WauKgsxh4GU6QCef6B7yXNAPmb7xDBB5Z2+hzARGEqxjjtFhrEf9w5ikKx08RR2u/IuvVI197atcFZ2Gw4aQxHadSpsPQIO+/RFtNG8PfeP78ShPE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=ionos.com; spf=pass smtp.mailfrom=ionos.com; dkim=pass (2048-bit key) header.d=ionos.com header.i=@ionos.com header.b=cTqTNznD; arc=none smtp.client-ip=209.85.218.53 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=ionos.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ionos.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ionos.com header.i=@ionos.com header.b="cTqTNznD" Received: by mail-ej1-f53.google.com with SMTP id a640c23a62f3a-a450bedffdfso687327066b.3 for ; Tue, 12 Mar 2024 02:41:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ionos.com; s=google; t=1710236512; x=1710841312; darn=vger.kernel.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=TwZhGhfqKNwGAAazIH0NZHq5xaKIh/aom8Ka+wD6k0o=; b=cTqTNznDZmvsPWVZT66oPREe0PSlZgk0NQqVYHSzR+qcxnpzwFdstF5c8OX5VWCkfj StjaUDvEJzJ09p3jujvrg1LTG8YopjXvB6JlO7Jx99+q9vVbp2HexjKtZBEm1WuH2yiM Q9CPH6rN+rapJ/mM0Z4jshMBponam/Dciljxa8l+at+tIwHWutUv2nOrfODhalbg4ccb 2XO4zk/TXn19NFGFE2U+urVGJphWkLS2cedWAh+TNghKWrT5aGgvxsjECXD/28jMOvG+ CVShTxv+Y1xW4uQdCDPI0iE3lr8g72thu/TZxFdQrIp4M2GlcmviVtw76skyDRnJv4Fc pPfg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710236512; x=1710841312; 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=TwZhGhfqKNwGAAazIH0NZHq5xaKIh/aom8Ka+wD6k0o=; b=w5TMknCmPjrO+n9KBf+ylokwNZTq3B+AvOV8/FMZFAZmUSz4JFq/tcbDDJo/eeBAoW NX1YxB9VAMP7i6rQa5Df14d8jSeocjrSSBqpnKMSmvS/9NIvTxbizdCV4Qan5cIT62Fd hiquTzOEJbOkYQS83bjEiXLe9ho0rn9fMxHRJnZwmR388+KUMkWW3wcvLWxP/yL/Wx4B Zfz8QiTQnGLbmdGySZTYvKCPeyMWgkMJpL0Og61M2/kdSbrwvO1ZWGhPUR/s5rzoAh9b gTxL/MkNnMrT8oBhOGKNZaOv/HNwzar57BHs/jLnpbmdKnDhuE+mXDPhDsn9YWfmwqpq x4qQ== X-Forwarded-Encrypted: i=1; AJvYcCXzlhKIg1sI+foqIKX6qpNtSjq59+7njWOEAk912KJkgkDPFEA/i6oryC096QQG/mfEGzqlCL/OqL216nV/ISxu/74pxvxE6LKBQ+i5 X-Gm-Message-State: AOJu0Yy6sebJzcKUaGRNYsIMy9e56Wv9US7aMN+FBtKClLwWPvvmGi0M amhUx+Cp0qrkRssYVFNG4QgLjb8LicsoJWg7uKQZBg32v9u8jsTYg4ahg1VKFgQ= X-Google-Smtp-Source: AGHT+IGZ51L07Hxzh1l+kWJcWu3Z+jyW9NEQT6L12fUL6Sj5QODioFM9B75fNjp+LPCzAWlnCP3kmw== X-Received: by 2002:a17:906:264b:b0:a45:ba06:e501 with SMTP id i11-20020a170906264b00b00a45ba06e501mr5018173ejc.57.1710236512023; Tue, 12 Mar 2024 02:41:52 -0700 (PDT) Received: from raven.blarg.de (p200300dc6f010900023064fffe740809.dip0.t-ipconnect.de. [2003:dc:6f01:900:230:64ff:fe74:809]) by smtp.gmail.com with ESMTPSA id jw22-20020a170906e95600b00a4623030893sm2091961ejb.126.2024.03.12.02.41.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Mar 2024 02:41:50 -0700 (PDT) From: Max Kellermann To: akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: willy@infradead.org, sfr@canb.auug.org.au, Max Kellermann Subject: [PATCH v4 03/15] include/scsi/scsicam.h: forward-declare struct block_device Date: Tue, 12 Mar 2024 10:41:21 +0100 Message-Id: <20240312094133.2084996-4-max.kellermann@ionos.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240312094133.2084996-1-max.kellermann@ionos.com> References: <20240312094133.2084996-1-max.kellermann@ionos.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" After eliminating includes of linux/mm.h, the following build failure occurred: In file included from drivers/scsi/fdomain.c:87: ./include/scsi/scsicam.h:16:31: error: 'struct block_device' declared insi= de parameter list will not be visible outside of this definition or declara= tion [-Werror] 16 | int scsicam_bios_param(struct block_device *bdev, sector_t capacit= y, int *ip); | ^~~~~~~~~~~~ ./include/scsi/scsicam.h:17:27: error: 'struct block_device' declared insi= de parameter list will not be visible outside of this definition or declara= tion [-Werror] 17 | bool scsi_partsize(struct block_device *bdev, sector_t capacity, i= nt geom[3]); | ^~~~~~~~~~~~ ./include/scsi/scsicam.h:18:40: error: 'struct block_device' declared insi= de parameter list will not be visible outside of this definition or declara= tion [-Werror] 18 | unsigned char *scsi_bios_ptable(struct block_device *bdev); | ^~~~~~~~~~~~ drivers/scsi/fdomain.c: In function 'fdomain_biosparam': drivers/scsi/fdomain.c:475:45: error: passing argument 1 of 'scsi_bios_pta= ble' from incompatible pointer type [-Werror=3Dincompatible-pointer-types] 475 | unsigned char *p =3D scsi_bios_ptable(bdev); | ^~~~ | | | struct block_device * ./include/scsi/scsicam.h:18:54: note: expected 'struct block_device *' but= argument is of type 'struct block_device *' 18 | unsigned char *scsi_bios_ptable(struct block_device *bdev); | ~~~~~~~~~~~~~~~~~~~~~^~~~ Signed-off-by: Max Kellermann --- include/scsi/scsicam.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/scsi/scsicam.h b/include/scsi/scsicam.h index 6eb9fb7a57d0..c0de038b76b5 100644 --- a/include/scsi/scsicam.h +++ b/include/scsi/scsicam.h @@ -16,6 +16,8 @@ =20 #include // for sector_t =20 +struct block_device; + int scsicam_bios_param(struct block_device *bdev, sector_t capacity, int *= ip); bool scsi_partsize(struct block_device *bdev, sector_t capacity, int geom[= 3]); unsigned char *scsi_bios_ptable(struct block_device *bdev); --=20 2.39.2 From nobody Sat Feb 7 12:18:29 2026 Received: from mail-ej1-f41.google.com (mail-ej1-f41.google.com [209.85.218.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4423B79DBB for ; Tue, 12 Mar 2024 09:41:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.41 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710236516; cv=none; b=dXT9hKkHP7saYVpEAqVMoA90KQQUgSWxfeM9WzaSt+TrBzmIaUAKulZqt9hNFon8KtefSOAZjhoIfwBptQZ24CppUuCsQKK1q2Yp6vPJRrP4eZuvRP+nOuLKpFJfzXbyoFhYpswI/jRiOSO+PDZuSVOMT0tzQX4XXOyEJe71xw4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710236516; c=relaxed/simple; bh=6XSamrQ8GvcwYgiZq1oDc5VOoarijJtGGH5zDeCqxHU=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=AE7mj+JvBNR9TxpG/Y/LvRmiOqHXd0EJDcTORA8r9ySN2tayIxywpOYrBhneKsdbTNKMqcdjGLoHFhiLmXmm/c/P+b+A7/k2tWZ3uOra7E4npJDGwJs6XLthtC8Hdzqqm/Nde/z/Aj/M78hqSitd5yGSKFqAX5GsbT/FU2mbnBg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=ionos.com; spf=pass smtp.mailfrom=ionos.com; dkim=pass (2048-bit key) header.d=ionos.com header.i=@ionos.com header.b=CA83FBTD; arc=none smtp.client-ip=209.85.218.41 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=ionos.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ionos.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ionos.com header.i=@ionos.com header.b="CA83FBTD" Received: by mail-ej1-f41.google.com with SMTP id a640c23a62f3a-a44d084bfe1so475867066b.1 for ; Tue, 12 Mar 2024 02:41:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ionos.com; s=google; t=1710236512; x=1710841312; darn=vger.kernel.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=UOXvgd5nL7gApAixwLBmVSPDbvkCXFf36Bu9a1YyE0M=; b=CA83FBTD+qLbM9Ls/kv19mIHtAIObQIf7OilBdbl3NoB6mpG8uxHdzn1gvCn7XM9SO 9JrvRRn14Goia07M66CJuEvgJ7+T7tkLgCQsA2m/qTRP/iqMy4SZuWonHSkE9Qq8DW9S rkCqWwHSmqSD7IfZJvS5HEFonWNBaIowRlzOQuMrhCbvtzKovlu5M5C4Z8YPAW/9RUgj AnTCZ0Psn9+61pktgjU7O3b1G6CYz2Y3xlAnjkU6kqnY7YulvCKdPfvaAIa4o1LYWEeO 2b4bu5wSxIS0KZZi05gcN2j6E7Wfn5sp/EQVF6JAHTG6tC0pULWeIdw7EZvxgvrhE23e g71A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710236512; x=1710841312; 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=UOXvgd5nL7gApAixwLBmVSPDbvkCXFf36Bu9a1YyE0M=; b=bMqe/YJ5Aurk/YPal4vsmEQTIKoKxf0bBKNgsJWq39r699fYn6dkIlWeborXJ2w7pp pdXsGjUpU+elF+GMzF/DwrDE/yyL3d9D3H6bxQbnIHt9uV4zbl/hF/85272wOxebRFmo OEfCSJF5+FxKtaWiH7a5/0GPvt96tfJ0cEU44gX1lz0G9kgEVgSiyBcCC5XT9ymQW7TL GotxGlDSOTOLlkOtixkvKJBDLnI0YD2HBwimim47foiu/q78gO0audjxTD5NAeHXY1Qa KRBHcGspbVADrFYYLghyeXZEopcw5hiQuQX8OHZhsE3BQWo4D9Ld9uOx6mR+FnwQ23WY 1Htw== X-Forwarded-Encrypted: i=1; AJvYcCXajyALZiK2zF2TGKeH/tmebEy6C5B8KPIeVVtuTC12UUuyn4ji1JuV7vrvWMbu1d0jxcd9BS2am1E/oJ6ep06Umu4bsXA8/HwrCjPl X-Gm-Message-State: AOJu0YyELUng9ALiWLDDqgEk/cWFxuGGqaBfDRKYj5VZcGSBUyqEUzFW e0J07GLzh2vOVTTms8VPU+KsYrdQ+Se44zwpMm3U9fvCjAJKRIN+RUXrzi/xrbs= X-Google-Smtp-Source: AGHT+IGJUp5RAZLCr3udJzv79aMWS8KJbP01FoMgnjIiqVrmS+CbiURoWNKsIrAZW9gur1I3s6sCLg== X-Received: by 2002:a17:907:1888:b0:a45:c997:2267 with SMTP id lj8-20020a170907188800b00a45c9972267mr5996063ejc.65.1710236512626; Tue, 12 Mar 2024 02:41:52 -0700 (PDT) Received: from raven.blarg.de (p200300dc6f010900023064fffe740809.dip0.t-ipconnect.de. [2003:dc:6f01:900:230:64ff:fe74:809]) by smtp.gmail.com with ESMTPSA id jw22-20020a170906e95600b00a4623030893sm2091961ejb.126.2024.03.12.02.41.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Mar 2024 02:41:52 -0700 (PDT) From: Max Kellermann To: akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: willy@infradead.org, sfr@canb.auug.org.au, Max Kellermann Subject: [PATCH v4 04/15] linux/mm.h: move page_kasan_tag() to mm/page_kasan_tag.h Date: Tue, 12 Mar 2024 10:41:22 +0100 Message-Id: <20240312094133.2084996-5-max.kellermann@ionos.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240312094133.2084996-1-max.kellermann@ionos.com> References: <20240312094133.2084996-1-max.kellermann@ionos.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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 b43102ca365d..f2d32e2da433 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -14218,6 +14218,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 0436b919f1c7..e140ee45f49c 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -2,6 +2,7 @@ #ifndef _LINUX_MM_H #define _LINUX_MM_H =20 +#include #include #include #include @@ -27,7 +28,6 @@ #include #include #include -#include #include #include =20 @@ -1818,60 +1818,6 @@ static inline void vma_set_access_pid_bit(struct vm_= area_struct *vma) } #endif /* CONFIG_NUMA_BALANCING */ =20 -#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 defa= ult - * value 0x00 maps to 0xff. - */ - -static inline u8 page_kasan_tag(const struct page *page) -{ - u8 tag =3D KASAN_TAG_KERNEL; - - if (kasan_enabled()) { - tag =3D (page->flags >> KASAN_TAG_PGSHIFT) & KASAN_TAG_MASK; - tag ^=3D 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 ^=3D 0xff; - old_flags =3D READ_ONCE(page->flags); - do { - flags =3D old_flags; - flags &=3D ~(KASAN_TAG_MASK << KASAN_TAG_PGSHIFT); - flags |=3D (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_kasa= n_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 defa= ult + * value 0x00 maps to 0xff. + */ + +static inline u8 page_kasan_tag(const struct page *page) +{ + u8 tag =3D KASAN_TAG_KERNEL; + + if (kasan_enabled()) { + tag =3D (page->flags >> KASAN_TAG_PGSHIFT) & KASAN_TAG_MASK; + tag ^=3D 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 ^=3D 0xff; + old_flags =3D READ_ONCE(page->flags); + do { + flags =3D old_flags; + flags &=3D ~(KASAN_TAG_MASK << KASAN_TAG_PGSHIFT); + flags |=3D (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 */ --=20 2.39.2 From nobody Sat Feb 7 12:18:29 2026 Received: from mail-ej1-f41.google.com (mail-ej1-f41.google.com [209.85.218.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A958679DDA for ; Tue, 12 Mar 2024 09:41:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.41 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710236517; cv=none; b=AaYL5oZAqw1r6gDytfeVcrghCYLseQayl1Wef1Uubegx2THNv008/wOXXJhI1nYBYQqiIyovng5FEl19CcUkvGbPnXoFSNTF7Wb83+NnXCEONlv+kuaC8c+wvRVi64hAgxv2pY/4fpwxQD/rglbBglwBhVan5OCGZkilCNjeD+s= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710236517; c=relaxed/simple; bh=WbgrH40EXEUiQSR1Yyn9b7sUNNxFQNIbVUvs4s+s9y8=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=ItoCniBtK+rG2oDfh6YsGORHKwWfJuKfw0cTqfl9h9Np/sgP1HBnaRmdxMwLo8Rfq9o2QE7snNE0le1I7t2NpoJq0YgotjuwgPi+UjRGuTTHE7XCUdiWikK87Qu6r/Xxt3I+MpxHDbBp9RYUIoiiYZmZFNCEIg6rj2YY+61lTZU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=ionos.com; spf=pass smtp.mailfrom=ionos.com; dkim=pass (2048-bit key) header.d=ionos.com header.i=@ionos.com header.b=B1cO7JY9; arc=none smtp.client-ip=209.85.218.41 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=ionos.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ionos.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ionos.com header.i=@ionos.com header.b="B1cO7JY9" Received: by mail-ej1-f41.google.com with SMTP id a640c23a62f3a-a45aa7cb2b3so481484066b.3 for ; Tue, 12 Mar 2024 02:41:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ionos.com; s=google; t=1710236514; x=1710841314; darn=vger.kernel.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=9wE2HsEwQuIKqCaqriShH9hKkj+cYk+gvkRx/+6+3to=; b=B1cO7JY9JQ8K9AIWlyjExpZOe/wCCZIgXmKBbN290Vm6LYM+fbc4sJL5kObj5F5/1d GuC1cQv5haK82MA+6pwjuHEq3flEHFPTbKiQjgCsuiqbXJfJRiKm8r6hr6yRZpeEBf9H XwJA1y1pA7P/Mn/mGsrvQ9t/stI1zsMs20gJn6EQw591klPhZIP7B/R9zw5MYeaH0txf tfLQfeKY04xl0nPzJ4wKHModuuJQGU9FyqZvITkZ3ZttQ+c0Q/R3NAPyJtMfd12od/5k fVk8iSqIVyJVmPffpJDVRA7wMKhShYaPIovWuBgLSIVZZcBz/jn4yQVky+XqCJr58PPF o0xQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710236514; x=1710841314; 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=9wE2HsEwQuIKqCaqriShH9hKkj+cYk+gvkRx/+6+3to=; b=cedoWGsXKhF6au7q+JEjMREC59KqxL72ITjCiB+C3o9jsMzbN1uCnRX2M98LlE8TlW SZak+c0qLh72Aidjg2hc7Ai/M3Z1cQ26U7wRlbzw2hCsada/AYL1FHaGdHkuaxfE9kR3 UddjbnU6KVFKBzoQZss9Wv65plTqZ5XJeo79M/DlpYcnUOfbmccqRKr3KOyFLqXpuOiC 8XCPVR2NgyRF5KICmba23n+TEexRipBeaH0gRkcsOacHDKiSc14ObdOhSrXgarGkwwX3 OwcXJgy85Lwie19yWgy5l45E8OdZgvjFxYV/o9UtrUTU1qSxQGhwvYaCEyLLZNAYJSHY iqHg== X-Forwarded-Encrypted: i=1; AJvYcCWjDLudPd4ZjXcJ+2QZOX1OZBQNIHeeCcu12lt78LhSvLilXzV7nLP9l4nYmwty4rAXOEfp5VOi7hMEDPEKFQYkQJX6ZBT1X/+yQvjN X-Gm-Message-State: AOJu0YwRFtUYCGu36LBDAYXWsZafslBPfa6pJWH+mEGV2z9zfVMsQtzh KY0nVAd0+o1JxZkWDCISdWBwnm2eDytzHvfM3GIDxgwwo2SF9XWGmylbkWdI/dxfvM1uvKSX96Q 7 X-Google-Smtp-Source: AGHT+IHwESUJTLeXYVU6c5C17eRydF4PJMg9KLfv6dX8WUbheMpCuO1M61+d7bvgT7hUFtR7+f1vtQ== X-Received: by 2002:a17:906:3a9a:b0:a46:2751:1358 with SMTP id y26-20020a1709063a9a00b00a4627511358mr2898595ejd.62.1710236514117; Tue, 12 Mar 2024 02:41:54 -0700 (PDT) Received: from raven.blarg.de (p200300dc6f010900023064fffe740809.dip0.t-ipconnect.de. [2003:dc:6f01:900:230:64ff:fe74:809]) by smtp.gmail.com with ESMTPSA id jw22-20020a170906e95600b00a4623030893sm2091961ejb.126.2024.03.12.02.41.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Mar 2024 02:41:52 -0700 (PDT) From: Max Kellermann To: akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: willy@infradead.org, sfr@canb.auug.org.au, Max Kellermann Subject: [PATCH v4 05/15] linux/mm.h: move section functions to mm/page_section.h Date: Tue, 12 Mar 2024 10:41:23 +0100 Message-Id: <20240312094133.2084996-6-max.kellermann@ionos.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240312094133.2084996-1-max.kellermann@ionos.com> References: <20240312094133.2084996-1-max.kellermann@ionos.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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 e140ee45f49c..79c1f924d4b5 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -3,6 +3,7 @@ #define _LINUX_MM_H =20 #include +#include #include #include #include @@ -1637,10 +1638,6 @@ static inline bool is_nommu_shared_mapping(vm_flags_= t flags) } #endif =20 -#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 @@ -1838,19 +1835,6 @@ static inline pg_data_t *folio_pgdat(const struct fo= lio *folio) return page_pgdat(&folio->page); } =20 -#ifdef SECTION_IN_PAGE_FLAGS -static inline void set_page_section(struct page *page, unsigned long secti= on) -{ - page->flags &=3D ~(SECTIONS_MASK << SECTIONS_PGSHIFT); - page->flags |=3D (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_sectio= n.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 secti= on) +{ + page->flags &=3D ~(SECTIONS_MASK << SECTIONS_PGSHIFT); + page->flags |=3D (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 */ --=20 2.39.2 From nobody Sat Feb 7 12:18:29 2026 Received: from mail-ej1-f48.google.com (mail-ej1-f48.google.com [209.85.218.48]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AF13A7A136 for ; Tue, 12 Mar 2024 09:41:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.48 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710236518; cv=none; b=Gbqfwv39S+FwwZ49FEPvUlBdDOCx9aP4Ushem0fwSazSn+Dzcb0EV8vKYho2JzY8Y9IJIp3KJ0eMMSBAYTP3lIn/KNs6huewB9R6cr7VWbXggzdHwjWcDe04vubOAnqKuYjQ6WuTguc1tp0pTAl1HKmVWvgaMG74j/erfOl3aw4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710236518; c=relaxed/simple; bh=7TBD917famya0UMoNWGhR2gZVEy1ZqrdJunlSs1U06E=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=jPWzPsdaPSs7GJtlPdYl+NbHgrALKxQVJuofFRFKOd6IBADyQJkchuolCUinrlQxPO3FghDAy0+phygwtVE9ba/iHDzyW4oFD5pA0asv//p+pDwSR+qnDGJKm5JOydk9NzUJPlyEvZsKS2GLIUgrh3iSrT4AoxzgYNmfS9C4D1g= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=ionos.com; spf=pass smtp.mailfrom=ionos.com; dkim=pass (2048-bit key) header.d=ionos.com header.i=@ionos.com header.b=KETwIXC0; arc=none smtp.client-ip=209.85.218.48 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=ionos.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ionos.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ionos.com header.i=@ionos.com header.b="KETwIXC0" Received: by mail-ej1-f48.google.com with SMTP id a640c23a62f3a-a4644bde1d4so56084366b.3 for ; Tue, 12 Mar 2024 02:41:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ionos.com; s=google; t=1710236515; x=1710841315; darn=vger.kernel.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=9QtTxRX/inj0OtKTHCIe6FPb0V6jffrKP/nT087XKzU=; b=KETwIXC015fXkXmZSPZ43QFrlXLllMBqEECIlYcAF8xMBAB46MCBpDMLhAVY0j9YZf 1CrVf4VWdEBX6PYCiUkluM2UAXzXq5KNtfZQ81Q7YI2+r0PCZG9gmzmyPS3UdMZBeieW by69KdZgaLMKovdQrRSg9sMXWnJ/BCZJx+ajSh/0nDdr6IN1pXlxJS0TiMqS/CGffb42 Ogfyig8Gf61GOejz3VRSpsMO58ff+EX+F3eaiTIabXx0eP+7XyW0mhgA6UkFTX9sgvpF 2h5mdHS8yHMoyQ11hkOcOpJOXsWvkXyokSnhPIof03CzyjbnOnR6x0+l1H8+aX9w6xFP THWg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710236515; x=1710841315; 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=9QtTxRX/inj0OtKTHCIe6FPb0V6jffrKP/nT087XKzU=; b=cX3x1lrJ+IFZtZIcfC/zFWoKnjyrHFvDN+p8eJSzdktJjFZU8lEVxFuLKoWOvNFRTx aXBF7W8iigGB9DF1UdXe5hQB8Je865/5g6FSlpD6Za5wa/JA9hixKTqlemWsEWHK/PVa WyS7ewBucTeGIkDHkgKljkcwRIBZ6hgssyKXo107FghMlAEE/61XYXJV4D1UtQYNwb5v acoqNMSHT2H+92MreJKmF/XY5ujRfEpyCuXuIDrRi0p/MgyoW3/H7PRuBXO49LujAy5T P40hYfOAmNOLeBpPm0lPXN8+Z+H2tqAhRp0grr9fwiJHYPbnsLVZ9ye2SqEvJc1vX0dD bOFg== X-Forwarded-Encrypted: i=1; AJvYcCUkFcw3hX4aoYVdCcsimagACi9un5bPPcqCBYuv3T5iXKDmjEySJzB9tN7PMQKGHtzptmpng8v1mZCmCaYy8VVn9Va3feHRVoOMaJ8S X-Gm-Message-State: AOJu0Yyrt36XmPvMHlTD1ew2dWCBamvL85cdyh/sjwCBfQCPJxXYPTq1 u2FNHykXxcQ4P94vdUi5NW+HFHXgBgCOKFj8SzWs2ROnhYI3kqzlMst/oYT4wmw= X-Google-Smtp-Source: AGHT+IFns2Ypn2XVsNVNAKrCcBt1TN2yH+bK3v2AhDeQNnfgdKRGlRgshyozXFibXBgkrU0IXHzkGg== X-Received: by 2002:a17:906:234a:b0:a45:cdb2:b6db with SMTP id m10-20020a170906234a00b00a45cdb2b6dbmr5768531eja.46.1710236515272; Tue, 12 Mar 2024 02:41:55 -0700 (PDT) Received: from raven.blarg.de (p200300dc6f010900023064fffe740809.dip0.t-ipconnect.de. [2003:dc:6f01:900:230:64ff:fe74:809]) by smtp.gmail.com with ESMTPSA id jw22-20020a170906e95600b00a4623030893sm2091961ejb.126.2024.03.12.02.41.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Mar 2024 02:41:54 -0700 (PDT) From: Max Kellermann To: akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: willy@infradead.org, sfr@canb.auug.org.au, Max Kellermann Subject: [PATCH v4 06/15] linux/mm.h: move page_address() and others to mm/page_address.h Date: Tue, 12 Mar 2024 10:41:24 +0100 Message-Id: <20240312094133.2084996-7-max.kellermann@ionos.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240312094133.2084996-1-max.kellermann@ionos.com> References: <20240312094133.2084996-1-max.kellermann@ionos.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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 79c1f924d4b5..713cedc03b88 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -2,7 +2,7 @@ #ifndef _LINUX_MM_H #define _LINUX_MM_H =20 -#include +#include #include #include #include @@ -104,10 +104,6 @@ extern int mmap_rnd_compat_bits __read_mostly; #define __pa_symbol(x) __pa(RELOC_HIDE((unsigned long)(x), 0)) #endif =20 -#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 @@ -211,14 +207,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 *); =20 -#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) =20 @@ -2137,44 +2125,6 @@ static inline int arch_make_folio_accessible(struct = folio *folio) */ #include =20 -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 =3D 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); =20 /* @@ -2237,10 +2187,6 @@ static inline void clear_page_pfmemalloc(struct page= *page) */ extern void pagefault_out_of_memory(void); =20 -#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_addres= s.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 __pag= e_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 =3D 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 */ --=20 2.39.2 From nobody Sat Feb 7 12:18:29 2026 Received: from mail-ej1-f52.google.com (mail-ej1-f52.google.com [209.85.218.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4EB817A713 for ; Tue, 12 Mar 2024 09:41:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.52 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710236520; cv=none; b=Pc/+yQDRI6yGFCzyI+DkBEmJPR4rsm54arU6cKc82uBb2ri/o0Xe6qnMO4Gzc5tMnUFX+uptjVFxTxOtN0CP9ktIUBvxTD2eHfQIllqHFBtcGpp7Gpw9tdsQk4FN7rKi78FZOSHtwgYMH0aVTAdgB93979qaqlRK5Ynfkcd3x44= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710236520; c=relaxed/simple; bh=oP7Nqn8yuoYUkUvIrSzyGSI4sXVkm22lBDg3rwCJ9kE=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=Q6bV8RbyRi8RaP3P2D1Ygf9JV1SChO6DMvtg7acus+pDzo2xkI/aBc2tXLLDD7sEC91att2kYWtQNAcRa/QolyidTfoYoQ3cDWnRDuE6y1FZyN56k19VX0JEMih3P0Q0DDBBsP2VtB11tuQwfd28UFIhaicMrnjoTLO7BMjA634= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=ionos.com; spf=pass smtp.mailfrom=ionos.com; dkim=pass (2048-bit key) header.d=ionos.com header.i=@ionos.com header.b=BMj+d4Qm; arc=none smtp.client-ip=209.85.218.52 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=ionos.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ionos.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ionos.com header.i=@ionos.com header.b="BMj+d4Qm" Received: by mail-ej1-f52.google.com with SMTP id a640c23a62f3a-a4645485da6so50087666b.1 for ; Tue, 12 Mar 2024 02:41:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ionos.com; s=google; t=1710236516; x=1710841316; darn=vger.kernel.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=pOCd08dVcNL3Vsd080U9IACgrN+4/kX0/WIiYLCuiY0=; b=BMj+d4QmPEnzhOwOq9YE5bayC4vLqgzgcHTK8aKg1rAc4VGv++O7UDu+C2jjFyXBIz TMx2P51+tG9wCPtlInMWXcwp0mLTX6qlMUZnohy6tJ5afOzRxfmW0kkc7mqsqJY9nRJ9 VyPAH63+GlkXX7UHbbMF8Yxt+qlbJ+U1KqCtC1lyiF+6+6T6vwkDPI1kZHeF6UyxIsku pZPxgSjH6KGiZo0QNevsP69aZKeLktWL9F3BztT8MRTYF+nKFU+4lsZyxWRpu3R5rnFu ASslpqG7u9wGx9siaNHmnnCyMWugS+CENrdBA3AfhNgYtPzMRh9782/mYJGLkagNdEWE 0P9g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710236516; x=1710841316; 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=pOCd08dVcNL3Vsd080U9IACgrN+4/kX0/WIiYLCuiY0=; b=qh6lKlFcRS2HKtPh7V/XTeWoM4uAAE3Xz2NfrGkmHRVyZCDpcr5+XT5uUnu/fglT3r sXkMEL8daSN3TkiqoJkIOdqtnHehH7ZQILiVxJaYrDgAOR4hLiqgELyBlW2w1kkSY2Fa dcwVIoqzYCg6XdztrBN6e4yxoDOzpoIqrk/SuaLjWNQjNrNZF45sVEMvpUPnYe56Gn3R eKcRfcTaWssM9YXTwUqRqPmeoOtjOlbUzH8oAjx63/6vTHcv2QQthQrW1p+4IdntJyDq jqnadSVFHwRnSyfNq3r/fA8NVKnOUVgGKDxbve2PC1McPqt88EnfnCnxR9fdghIAHyJK w1zg== X-Forwarded-Encrypted: i=1; AJvYcCWmI78RjoSeFtcDX2cid7NjAcTNC8DO/CPOzzyaNSPGYgltOqJlYgdP4To0JU2NYpo1wyrQfV8ALTLkZAyXZ4dUrdenXEq+iPL+9aFW X-Gm-Message-State: AOJu0Yw1mEoA/vDmS1XXwpXx9WbjDUyvORn8cX7c2M+KMXOBjl/jKLUk qPUISvAmnl2bUQqoYL7wiLAZP21bKrIfYRi45sw3e7FYwzAPvJZczS4bkY3WtFw= X-Google-Smtp-Source: AGHT+IHjOIF4GXnxhEXYczDPqX+KWpyAlclam9FjYiLmhYYld2nrVA/ZGxZiKu/mMUbtJ1A/57F7ng== X-Received: by 2002:a17:906:9c87:b0:a45:ba06:e512 with SMTP id fj7-20020a1709069c8700b00a45ba06e512mr6914716ejc.6.1710236516574; Tue, 12 Mar 2024 02:41:56 -0700 (PDT) Received: from raven.blarg.de (p200300dc6f010900023064fffe740809.dip0.t-ipconnect.de. [2003:dc:6f01:900:230:64ff:fe74:809]) by smtp.gmail.com with ESMTPSA id jw22-20020a170906e95600b00a4623030893sm2091961ejb.126.2024.03.12.02.41.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Mar 2024 02:41:55 -0700 (PDT) From: Max Kellermann To: akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: willy@infradead.org, sfr@canb.auug.org.au, Max Kellermann Subject: [PATCH v4 07/15] linux/mm.h: move folio_size(), ... to mm/folio_size.h Date: Tue, 12 Mar 2024 10:41:25 +0100 Message-Id: <20240312094133.2084996-8-max.kellermann@ionos.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240312094133.2084996-1-max.kellermann@ionos.com> References: <20240312094133.2084996-1-max.kellermann@ionos.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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 713cedc03b88..0d291ff61db3 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -2,6 +2,7 @@ #ifndef _LINUX_MM_H #define _LINUX_MM_H =20 +#include #include #include #include @@ -1068,38 +1069,6 @@ int vma_is_stack_for_current(struct vm_area_struct *= vma); struct mmu_gather; struct inode; =20 -/* - * 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 =3D (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 definiti= on - * 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 =20 /* @@ -1306,39 +1275,6 @@ unsigned long nr_free_buffer_pages(void); =20 void destroy_large_folio(struct folio *folio); =20 -/* 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 @@ -1979,23 +1915,6 @@ static inline void set_page_links(struct page *page,= enum zone_type zone, #endif } =20 -/** - * 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 -} - /* Only hugetlbfs can allocate folios larger than MAX_ORDER */ #ifdef CONFIG_ARCH_HAS_GIGANTIC_PAGE #define MAX_FOLIO_NR_PAGES (1UL << PUD_ORDER) @@ -2003,33 +1922,6 @@ static inline long folio_nr_pages(struct folio *foli= o) #define MAX_FOLIO_NR_PAGES MAX_ORDER_NR_PAGES #endif =20 -/* - * 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 =3D (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. @@ -2049,36 +1941,6 @@ static inline struct folio *folio_next(struct folio = *folio) return (struct folio *)folio_page(folio, folio_nr_pages(folio)); } =20 -/** - * 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 =3D (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 definiti= on + * 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 =3D (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 */ --=20 2.39.2 From nobody Sat Feb 7 12:18:29 2026 Received: from mail-ej1-f49.google.com (mail-ej1-f49.google.com [209.85.218.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 12FED78662 for ; Tue, 12 Mar 2024 09:41:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.49 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710236521; cv=none; b=uifIwy06lYilxAUXMqo2pir4ome99wBc2Sk++jhgQDBs5bdtUANP1BxIT3a20vz7iueihzLRmgDFRlg7hDm+U24Vj4lvKebUopsDbKPdTR3OhDKfIbBXWmIYnI/tZjgXoFrUisDXhzpmAq2PIG0VMNKOWD/7vOh2Q0lM+xi7+ws= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710236521; c=relaxed/simple; bh=vokolUNNjWemvOpIVyP0bPJJZO5YFTXD/1zFkqXp+GE=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=HvRJW69+ELHKEJk7z6fHvN7J6J/35HzkQlGDHEiQJ2ZDi8VjH771/87DcY75BRHn+fCLGvFHvPGXhzuuOdFjrRuSKPwwTg6llsOEpfHxLMVPfVlnvx2D5I3TZp34WYpkbdyXrxpQOuMy2W5+q9+tqy/G3LkAPoWpONUkCUJ5c6Y= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=ionos.com; spf=pass smtp.mailfrom=ionos.com; dkim=pass (2048-bit key) header.d=ionos.com header.i=@ionos.com header.b=RspeanrF; arc=none smtp.client-ip=209.85.218.49 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=ionos.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ionos.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ionos.com header.i=@ionos.com header.b="RspeanrF" Received: by mail-ej1-f49.google.com with SMTP id a640c23a62f3a-a3ddc13bbb3so1131195266b.0 for ; Tue, 12 Mar 2024 02:41:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ionos.com; s=google; t=1710236517; x=1710841317; darn=vger.kernel.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=tPRAHmknVEgQF0+eI0cWSAplWfhzwY2EyeY5NbL7yXE=; b=RspeanrFD/iO01lBT5nrw8I7iMYd3NbB9Ceo6iyTNq4H9h3B54jDqJb8vIXDRy0G5r 7u4VIZ+lLArqMMNqdxoCP23kpuW9/9zF5BoKINhqnopqf3jPLYEh20XD8y0XZFGTl1y6 +0C259SkRzjizGfVG2+gFXlZ5PuseDNBpPqHnOUJo1J8csUYEq2Ww44E72GFEi2hAB2U 1KTkPl7MbtmAtIJHlsTSF+zRB0soTTgECmU2GWmBhYJJyTwqc5ChAVqdxHq9p46h40rw 8OeBd1CQtNr/7+hcAYp5D/DAn/7XLGG8OcKLvnNVda6vi2Ubv2xVgCXwHv/SJPPXOX9p 7IsQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710236517; x=1710841317; 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=tPRAHmknVEgQF0+eI0cWSAplWfhzwY2EyeY5NbL7yXE=; b=VASNjpZI4IwDCzKw0pCKRZp9kd38WUaUCPqgj4NrJBYXbrJNOqCmHJ4WKOUJ/4P9hk OGjMstnCuZp5fS4zkiqgMXQng0AfenD/IbiCs8DPFbCL7wtZl0m7nQu8iyXjp36IwuOU Z8dbNmDvm4f/YTMY+F/jf073sIF8Q/fpuTG0CSlBDUmuVAokXTuJfz7C2hBzWP2934wf +mhIoNlSa0rr2ybe7GEdlpbQHWpe6yNx+ScmRMBQ7iCbQbe7ok+RPn0sUi2sdPaKT2/s XLB/uzY8AGZDN4yXy4x/cTQn0K+9t0blvLft7jPKhL2yR3tCbXsR00oaHv3P2VU04HHc S0oA== X-Forwarded-Encrypted: i=1; AJvYcCV8y0CZlOAc0wik9wKE8G0QjiGLIcOulMD6h4uhk+SpkoOPabo0W+5VeqZK5j3OzvXvduBGdVaaIeEndSluZnWLSNUFLLl6rkJ3i8LG X-Gm-Message-State: AOJu0Yypa/obI3+r5rU81shum0HTpCLqOo2wwR4brVsrE7Bn74ZHuGcs teecdsEKpzN9KkdqPOx/5x3L6hQvlwOIh6B+ccyDqUUsjtPwov8dF5SBjBc7p6Gp6IT/o5bSfQY Y X-Google-Smtp-Source: AGHT+IFpb+EqT1uOp7qLMTVjHTnEYVneJSFf9T7njrEKUR2vn/eqj2u6x7yeSAPGnaQTnMQUYnssdQ== X-Received: by 2002:a17:907:868a:b0:a45:b616:29fc with SMTP id qa10-20020a170907868a00b00a45b61629fcmr9967232ejc.0.1710236517463; Tue, 12 Mar 2024 02:41:57 -0700 (PDT) Received: from raven.blarg.de (p200300dc6f010900023064fffe740809.dip0.t-ipconnect.de. [2003:dc:6f01:900:230:64ff:fe74:809]) by smtp.gmail.com with ESMTPSA id jw22-20020a170906e95600b00a4623030893sm2091961ejb.126.2024.03.12.02.41.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Mar 2024 02:41:56 -0700 (PDT) From: Max Kellermann To: akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: willy@infradead.org, sfr@canb.auug.org.au, Max Kellermann Subject: [PATCH v4 08/15] linux/mm.h: move folio_next() to mm/folio_next.h Date: Tue, 12 Mar 2024 10:41:26 +0100 Message-Id: <20240312094133.2084996-9-max.kellermann@ionos.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240312094133.2084996-1-max.kellermann@ionos.com> References: <20240312094133.2084996-1-max.kellermann@ionos.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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 0d291ff61db3..e6c2df977abc 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -2,6 +2,7 @@ #ifndef _LINUX_MM_H #define _LINUX_MM_H =20 +#include #include #include #include @@ -1922,25 +1923,6 @@ static inline void set_page_links(struct page *page,= enum zone_type zone, #define MAX_FOLIO_NR_PAGES MAX_ORDER_NR_PAGES #endif =20 -/** - * 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 */ --=20 2.39.2 From nobody Sat Feb 7 12:18:29 2026 Received: from mail-ed1-f46.google.com (mail-ed1-f46.google.com [209.85.208.46]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7B31A7AE61 for ; Tue, 12 Mar 2024 09:42:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.46 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710236522; cv=none; b=O3IGhG4mv4vahITLpI/YdEf64eBS9PDhSqYPw6gpmv4nIvmEqTtTpA+9n4NYnAMCvgnNPobocw/NiTPDA3K/qWpOg72aYlR9MLYMAT0LYrAtPFK6jA3eFqoia2FTvvBo96KrVX8SykCkrb43y1usPmNeFDgljlgvur60bIrLuvs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710236522; c=relaxed/simple; bh=MIHkIFvab96I9R+obMDPY3PJG78+nlUxbYh17e4Y/Ic=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=Dta/pbD9qbZZ+ieQg7CKzJRlSWBTQAP/YHzxsKDJotU0AgXRYT3Zkn4rQn9mzbZ3UN3mngwfEZGhFL0/slE0TEhAvfm4zjE/eP9iVVAAUzr0lYPg29+TJMYuNL3da6z0J1y3wxRNufKaksBnp67ONPYzQ6vftRScY9r57RnOpsE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=ionos.com; spf=pass smtp.mailfrom=ionos.com; dkim=pass (2048-bit key) header.d=ionos.com header.i=@ionos.com header.b=bQ7pjCUr; arc=none smtp.client-ip=209.85.208.46 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=ionos.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ionos.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ionos.com header.i=@ionos.com header.b="bQ7pjCUr" Received: by mail-ed1-f46.google.com with SMTP id 4fb4d7f45d1cf-56878bb1abdso336709a12.1 for ; Tue, 12 Mar 2024 02:42:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ionos.com; s=google; t=1710236519; x=1710841319; darn=vger.kernel.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=TT7smv1j1+eH6dLDpyJyxapeCn0BRAoD8ideYTGL8g4=; b=bQ7pjCUrKl4j7J/tjcVdLvXvbOfqqC9/4CPtS+o690FrzLP+Aq94tQx/PbcW4jO7Jc c49Hrj/HX9xqk/cDU0Rk7YCzIpMMbMYTrNhhy/KkrL/128kRnF/f0xQsrVH29kvfKzOx sr0zXU0oUnY0SDEIq/HUnxAXQQ7IThMzTxuO0Efr0IynSCqJzXTbh/FEZzy+DjAOJhTN JBSeY00tHhEInF9cO2pE39zIdQCRG2MnLoz+hDZLBvbSk4fW8esBf81Qy1j5Kc+i+sy4 IGJy+mK+id9JWZOURIN37x8ChhOXdUKAqoQMCv11FIebOZZugq2A0rPEg3RIvuPc5w6X 3YDQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710236519; x=1710841319; 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=TT7smv1j1+eH6dLDpyJyxapeCn0BRAoD8ideYTGL8g4=; b=mkyFAjVTNl88DIQhZl6zwaqSuntsiQola8r4LvpaoDRrgG13gDUsWuhy9+N0dZK0eL PuWElzqtZ2Ce63SjJAu/Qb9JixCy3PqVPn+eoVaXpIhpp3r+4cJh8ov8WvZuLoT2fOSv kKsZ4hVCS7jsrWwu5xmeIHMlJGSVMFk9NOuEaM0y0pS9ldaE7InQDhAL/DH++Go1soWe 9H9JcevjvTeozfYN6nU7JciOBsVrt8kzGc6hcXvVCtbqdIC11soxAukHAV3L72TM6Yxu ocbaErOegm+X0RqKcFD4Ua0bm+sa2Dz+nKIcBc3Kvv3JUji+ZFN2REcUNw7f3Zrz8ZpT HSbg== X-Forwarded-Encrypted: i=1; AJvYcCXdtvQxbQQmVW+msDCABDJZr9I9AX9chQ4v8A0vTxMVv3++Jtt0TiIQEyhNz4z6nCBfI/hk/Lagrzlc2iCiJ8Y+KANyT2jDom7x2ep/ X-Gm-Message-State: AOJu0Yy4F6FwiIgw4Sd81VugKMKoz/SPSz8zxi8wIUcu3KW75Ck//VJb 35UL++QJUGHSvlCo/5Ubz72cI6sIwtC8Xm2jQy4dZgaG/zwZMHBx+CdGmVI4ULGM25gnXA9ziL0 Q X-Google-Smtp-Source: AGHT+IH7z82KjX3aHCRWUOCeL5FyYqD0JcQ3ejtaHjG0l89tCOrVbvS2n36rt9l5T0g5qz32g+2nTg== X-Received: by 2002:a17:906:7751:b0:a43:f22e:57a6 with SMTP id o17-20020a170906775100b00a43f22e57a6mr852298ejn.67.1710236518882; Tue, 12 Mar 2024 02:41:58 -0700 (PDT) Received: from raven.blarg.de (p200300dc6f010900023064fffe740809.dip0.t-ipconnect.de. [2003:dc:6f01:900:230:64ff:fe74:809]) by smtp.gmail.com with ESMTPSA id jw22-20020a170906e95600b00a4623030893sm2091961ejb.126.2024.03.12.02.41.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Mar 2024 02:41:57 -0700 (PDT) From: Max Kellermann To: akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: willy@infradead.org, sfr@canb.auug.org.au, Max Kellermann Subject: [PATCH v4 09/15] linux/mm.h: move devmap-related declarations to mm/devmap_managed.h Date: Tue, 12 Mar 2024 10:41:27 +0100 Message-Id: <20240312094133.2084996-10-max.kellermann@ionos.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240312094133.2084996-1-max.kellermann@ionos.com> References: <20240312094133.2084996-1-max.kellermann@ionos.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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 | 25 +-------------------- include/linux/mm/devmap_managed.h | 37 +++++++++++++++++++++++++++++++ 2 files changed, 38 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 e6c2df977abc..61f1312a626e 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -2,6 +2,7 @@ #ifndef _LINUX_MM_H #define _LINUX_MM_H =20 +#include #include #include #include @@ -1357,30 +1358,6 @@ vm_fault_t finish_fault(struct vm_fault *vmf); * back into memory. */ =20 -#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 ref= s) -{ - 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 ref= s) -{ - 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 <=3D 127u) diff --git a/include/linux/mm/devmap_managed.h b/include/linux/mm/devmap_ma= naged.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_br= anch_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 ref= s) +{ + 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 ref= s) +{ + 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 */ --=20 2.39.2 From nobody Sat Feb 7 12:18:29 2026 Received: from mail-ed1-f51.google.com (mail-ed1-f51.google.com [209.85.208.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C77387B3CE for ; Tue, 12 Mar 2024 09:42:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.51 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710236525; cv=none; b=aNhZ+9TVe/LC3D3VM0QidAlS2g0MckU9n6G74uIA07T5ITIflmdLkQsOiqHbFV2CWgrhhSa8Vd5pmFNduRFvlloSCVl7l83RhZW8QpMJ2YVGsJ1kFfN1ir6FXum+RLY0WtBA/6dV1wCXYI7tsrMciRWy3lXzzh2pUklfY9txU8k= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710236525; c=relaxed/simple; bh=EQUfjee+ktFtbPacxxVNShczG8NOQAbKrjDXd0cHtHY=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=SEdCrfZ2EZDwP7GT0Z1VY9U/WB1Lm3unQrLDo5icukkAlyE3zvcgVyl826i5nzv5bnw6djzbhD9jPWTzcaHW3by45nYGzg0tu0LY0Tr2aM80g/F6FVejAUHfpWD5GAUHF4xWvuwaf8bumBpDMFPT3r6UpaSpNxHRRIpyGD+CciY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=ionos.com; spf=pass smtp.mailfrom=ionos.com; dkim=pass (2048-bit key) header.d=ionos.com header.i=@ionos.com header.b=EqysVt4X; arc=none smtp.client-ip=209.85.208.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=ionos.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ionos.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ionos.com header.i=@ionos.com header.b="EqysVt4X" Received: by mail-ed1-f51.google.com with SMTP id 4fb4d7f45d1cf-563d56ee65cso4963773a12.2 for ; Tue, 12 Mar 2024 02:42:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ionos.com; s=google; t=1710236520; x=1710841320; darn=vger.kernel.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=cowoIpweWt3L2bjBHT1kUeTpunMOhbiTNwgqFnKsuAs=; b=EqysVt4Xk94VwtrtIx/V8feGL0ze/U40MiN7j17E/9iITvJcvmDKptIF1UUb3JyvSJ iTnxNfs3Vz46J/Ii4etN0ObXko6Vtnj1rzcJ3jJroj7qn5NnxpTGHFCoYIhhcm/U0ne7 JXR4jZGAdUt4rYtYJVSQdkaJ14qZgpkdLL2bP7mTBoG3eAkIKVWWOJTPSPG82WWaswCX bcBWSnVbxiI/9g8cdfRTHeyg4QBsDEEqW4vwnPuew4g3TNJJa2v0G63Kg7GdX3Mf+qwE f9NhjTQVW6edIk3PUrL9oasxJyGpUWYeZnYHiqxQasU+M9ipsRl35HBNCx29+8Sn8gAL lYBw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710236520; x=1710841320; 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=cowoIpweWt3L2bjBHT1kUeTpunMOhbiTNwgqFnKsuAs=; b=L8dcG7fxtrLggSh5nW10QgAsbEBLo7jAk6WtaoGmZXMuaTnpnjuHvedAtl9Y4zI+tt dNs3MtWNHVsQK2PnjDJ5Q9iqUHBK2ImEPqOeWZzuS3o4idzHYus4INHZrkRYT2v+lkvm C76hYYhRgz7s4mvnfw3HQLvIQyKshKjKfyEXs4Z8RjSu0uAqqdREfVYTkRGau/EXkm3X oy2xOmPmqkAErW0egGH+qVDzhuvF6bVwyO8xLzrKUt5cfUnDCzHyPQgiOcs1iflxhoOK 3948AUFe3dxZH5Wg09pHHVo4BJ7fl6m/b2b/SoqJaOK4Pr7U5n5v70Fuhkbt+2MTayfE /iKw== X-Forwarded-Encrypted: i=1; AJvYcCWQzROTbJ31C9QExDbZeTN0481vEYwR+ysY+V65ugV2L/ihqJQgQXn1db85X8H1eI4vWqnd9+f49klfa7GTwiyu6rn/8FLr4imx/gDZ X-Gm-Message-State: AOJu0YxZMOqUDwGRDHagFiV43qfqy1Y2WWeAlw2TOtT6qkOO9sAv/o90 9iE4ZPVOMBzN2DuVUfB6FpX/m/olVXuYPQLMjuB3yiiHoRFLELQ3XJMZZ3Zdae0= X-Google-Smtp-Source: AGHT+IGPpXWDroxQd4i0sT/HxrCfRJ8qOljXYjIyFDDgh8QZaaJHbQtjUCu33nAKlDQHqMsEteNl8w== X-Received: by 2002:a17:907:d40d:b0:a46:17dd:33da with SMTP id vi13-20020a170907d40d00b00a4617dd33damr5713928ejc.29.1710236520027; Tue, 12 Mar 2024 02:42:00 -0700 (PDT) Received: from raven.blarg.de (p200300dc6f010900023064fffe740809.dip0.t-ipconnect.de. [2003:dc:6f01:900:230:64ff:fe74:809]) by smtp.gmail.com with ESMTPSA id jw22-20020a170906e95600b00a4623030893sm2091961ejb.126.2024.03.12.02.41.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Mar 2024 02:41:59 -0700 (PDT) From: Max Kellermann To: akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: willy@infradead.org, sfr@canb.auug.org.au, Max Kellermann Subject: [PATCH v4 10/15] linux/mm.h: move usage count functions to mm/folio_usage.h Date: Tue, 12 Mar 2024 10:41:28 +0100 Message-Id: <20240312094133.2084996-11-max.kellermann@ionos.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240312094133.2084996-1-max.kellermann@ionos.com> References: <20240312094133.2084996-1-max.kellermann@ionos.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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 | 172 +------------------------------ include/linux/mm/folio_usage.h | 182 +++++++++++++++++++++++++++++++++ 2 files changed, 183 insertions(+), 171 deletions(-) create mode 100644 include/linux/mm/folio_usage.h diff --git a/include/linux/mm.h b/include/linux/mm.h index 61f1312a626e..e8a914e7bebd 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -2,9 +2,9 @@ #ifndef _LINUX_MM_H #define _LINUX_MM_H =20 -#include #include #include +#include #include #include #include @@ -1073,51 +1073,6 @@ struct inode; =20 #include =20 -/* - * 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 u= sers) - */ -static inline int put_page_testzero(struct page *page) -{ - VM_BUG_ON_PAGE(page_ref_count(page) =3D=3D 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); =20 enum { @@ -1266,8 +1221,6 @@ static inline struct folio *virt_to_folio(const void = *x) return page_folio(page); } =20 -void __folio_put(struct folio *folio); - void put_pages_list(struct list_head *pages); =20 void split_page(struct page *page, unsigned int order); @@ -1358,129 +1311,6 @@ vm_fault_t finish_fault(struct vm_fault *vmf); * back into memory. */ =20 -/* 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 <=3D 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 =3D compound_head(page); - if (WARN_ON_ONCE(page_ref_count(page) <=3D 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); -} - -void folios_put_refs(struct folio_batch *folios, unsigned int *refs); - -/* - * 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. - * - * Like folio_put(), but for a batch 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. The folios batch is returned - * empty and ready to be reused for another batch; there is no need to - * reinitialise it. - * - * 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_batch *folios) -{ - folios_put_refs(folios, NULL); -} - -static inline void put_page(struct page *page) -{ - struct folio *folio =3D 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, overlo= ad * the page's refcount so that two separate items are tracked: the origina= l page diff --git a/include/linux/mm/folio_usage.h b/include/linux/mm/folio_usage.h new file mode 100644 index 000000000000..4a7e9cd74909 --- /dev/null +++ b/include/linux/mm/folio_usage.h @@ -0,0 +1,182 @@ +/* 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 + +struct folio_batch; + +/* + * 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 u= sers) + */ +static inline int put_page_testzero(struct page *page) +{ + VM_BUG_ON_PAGE(page_ref_count(page) =3D=3D 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 <=3D 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 =3D compound_head(page); + if (WARN_ON_ONCE(page_ref_count(page) <=3D 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); +} + +void folios_put_refs(struct folio_batch *folios, unsigned int *refs); + +/* + * 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. + * + * Like folio_put(), but for a batch 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. The folios batch is returned + * empty and ready to be reused for another batch; there is no need to + * reinitialise it. + * + * 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_batch *folios) +{ + folios_put_refs(folios, NULL); +} + +static inline void put_page(struct page *page) +{ + struct folio *folio =3D 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 */ --=20 2.39.2 From nobody Sat Feb 7 12:18:29 2026 Received: from mail-ej1-f53.google.com (mail-ej1-f53.google.com [209.85.218.53]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 36B337866B for ; Tue, 12 Mar 2024 09:42:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.53 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710236524; cv=none; b=h8BbgNjWGu73RiN//rvoK4b+FnmXxxCh4YNkB84NlN9Fco2hugeFE/uRX0V2siiSwBU8kSYmmbew7Lfg03VB9STyzW14omLgrlMhDpI3OEd5gvqLVvIbQMnuIMyUN0R6PZGaQjTKeJTlLE2rAPJVUydCm/MsedBp5ezQ+W8xkzk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710236524; c=relaxed/simple; bh=NEV56k/1bcmu9rz0L5zz1lY42ec57ywMmk7znO1WYnM=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=ZdGLPFTMhZt1iOOsBcwrFjmFW/0mfrau7CRSQvOKj5tp/uQcNqcek1Iq+HV+QQavqwR8X2XjcIn1pG7hIn5uqW4dqu+9t+recgse7wreZ7vgALwXm5BWxgbxXEA7F3ovzjvKUfbuU+wlPeVIvtPuY6BXm8OfetDOu+1fjFLnYwg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=ionos.com; spf=pass smtp.mailfrom=ionos.com; dkim=pass (2048-bit key) header.d=ionos.com header.i=@ionos.com header.b=XZoEYIcn; arc=none smtp.client-ip=209.85.218.53 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=ionos.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ionos.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ionos.com header.i=@ionos.com header.b="XZoEYIcn" Received: by mail-ej1-f53.google.com with SMTP id a640c23a62f3a-a45cdb790dfso545729566b.3 for ; Tue, 12 Mar 2024 02:42:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ionos.com; s=google; t=1710236520; x=1710841320; darn=vger.kernel.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=KC2kNgBeF7Vel8Ro1rxtb7kBWctFnYPn6ChmmeyuWYw=; b=XZoEYIcnINJYx2Q82RNXNLwqjk6pwQ37uDR2uhQ7M8w6V6HYDbrK4Xg3IfBGvIf1Jm tEmRQVqCYSyQGExekQpXNh3jsZ0Wn6enxsEtjWLetmMfxA3DfBZKd+tqvf7gz6T0Ghw1 fWXHcYOaxTOwKnrU3Qhl305pJFAHfQLE70B4L6msNo597GoZ7TBmzW4n6OMi1lHvFNQ2 7i9df18KtvTckICKTQFc6X9HJMt0tyYi1iTXUqLVSbHffSG5a9xQjEeQAPE97FZbsP3q Iek3MMH1UXnu6DAdjmJVBNBtZoYawGsdiRtctKio97ePwLkQwKw69r2tlQp9DyBaSVMJ o9Ow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710236520; x=1710841320; 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=KC2kNgBeF7Vel8Ro1rxtb7kBWctFnYPn6ChmmeyuWYw=; b=U+jsh1Z0YK6rucMOclTgB2RzfGcx6L+EShQ2DeSNH4Al+tVt4zvxwFRXPC2yvcvtii /+gmD2UP/A6gfsgtmdlNRjQ5vSJv7LMLLFM23DWZ9VuKYhGGRj3dZpvMSRjFz9a7n/Pn 0jhsiH4lvdaFcpwNPCSZYvnTUs/OSqBfnHz0dYldg96fpnL8ZpqPoQKNhnhMOz7UBu1c 9/jlwrbiMgHfiZejn+QrId3wswg114xCBpKMvT+wVeyu0B8cgfXxI9jnJY2uRp1GlYNV wKdnbZKzHduEc0Hl+5f8BjBWxtf3zFwz097eAerCkdD8uIIcFupJ0+0sIspzjo9vPdc0 5k4Q== X-Forwarded-Encrypted: i=1; AJvYcCXJOswxNLxxBAzcnCV1xDNys2i4da2x7Ff3aop9e5gyZCsU2xtJT748sg3XCK3yjaAsf4sN39ZDgRU/WBMs8QLWYRTRmEpGDaSG646h X-Gm-Message-State: AOJu0Yy83RIjlb5PpCDOjmk88MJnmDfiIMbD6Y6XOVf72ODcvG5/lDfK 7P9g//7GsM5Abac0kp2w2nTsLvHzsPZLb6LlM77vOEHr0+QI4toyecZkRWfxpvQ= X-Google-Smtp-Source: AGHT+IE7UDJ1nLsSaEjUG1+PH6IJCzOExfGwyVhrMeJ4rHCcxaB2l8oErbSbMLUVuRymbgh224TGQw== X-Received: by 2002:a17:907:3594:b0:a43:f182:66c4 with SMTP id ao20-20020a170907359400b00a43f18266c4mr5390555ejc.17.1710236520620; Tue, 12 Mar 2024 02:42:00 -0700 (PDT) Received: from raven.blarg.de (p200300dc6f010900023064fffe740809.dip0.t-ipconnect.de. [2003:dc:6f01:900:230:64ff:fe74:809]) by smtp.gmail.com with ESMTPSA id jw22-20020a170906e95600b00a4623030893sm2091961ejb.126.2024.03.12.02.42.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Mar 2024 02:42:00 -0700 (PDT) From: Max Kellermann To: akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: willy@infradead.org, sfr@canb.auug.org.au, Max Kellermann Subject: [PATCH v4 11/15] linux/mm.h: move page_zone_id() and more to mm/folio_zone.h Date: Tue, 12 Mar 2024 10:41:29 +0100 Message-Id: <20240312094133.2084996-12-max.kellermann@ionos.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240312094133.2084996-1-max.kellermann@ionos.com> References: <20240312094133.2084996-1-max.kellermann@ionos.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" This is needed to eliminate linux/skbuff.h's dependency on linux/mm.h. Signed-off-by: Max Kellermann --- include/linux/mm.h | 28 +-------------------------- include/linux/mm/folio_zone.h | 36 +++++++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+), 27 deletions(-) create mode 100644 include/linux/mm/folio_zone.h diff --git a/include/linux/mm.h b/include/linux/mm.h index e8a914e7bebd..b3f83fb26aca 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -5,6 +5,7 @@ #include #include #include +#include #include #include #include @@ -1370,33 +1371,6 @@ static inline bool is_nommu_shared_mapping(vm_flags_= t flags) } #endif =20 -/* - * 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 -int page_to_nid(const struct page *page); -#else -static inline int page_to_nid(const struct page *page) -{ - return (PF_POISONED_CHECK(page)->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..572fe37068f1 --- /dev/null +++ b/include/linux/mm/folio_zone.h @@ -0,0 +1,36 @@ +/* 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 +int page_to_nid(const struct page *page); +#else +static inline int page_to_nid(const struct page *page) +{ + return (PF_POISONED_CHECK(page)->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 */ --=20 2.39.2 From nobody Sat Feb 7 12:18:29 2026 Received: from mail-ej1-f50.google.com (mail-ej1-f50.google.com [209.85.218.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BF22B7B3E6 for ; Tue, 12 Mar 2024 09:42:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.50 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710236524; cv=none; b=tSj/HSP4ugRUvultd8hO7MtJ0EtQGArGqd84y0RFy4Mtg/BF5qUNX/9piOHkXZoahHBbTAWyYTtvRUJlEwASVaw8+KO2bp2YH9q94T60eBzGWVByYzF4gzdHRd4PauOLCUmqSXLv4fNyoSe/nc3QIYFx1CQjBr9royGRCEwCDqI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710236524; c=relaxed/simple; bh=gvv5QAtWzHwpsz/x1Apq4Lva4NNrjhRHP3W2M/SGVoQ=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=jrDIPTARTtkA+f81jQv5z6EfhRTBTntj56Ki9y8E3crfs+EfQCo+4LIOUjsAwnXcing+xJKB3Exlz3BIwCS3TPDGgEKwKPOBXn7CFDEt/j3UstvC2uG5kCWOsxiO+OObjFT6weAhrKfC221dmtU3vqyrIyaqDvps4vfQsn1ty6w= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=ionos.com; spf=pass smtp.mailfrom=ionos.com; dkim=pass (2048-bit key) header.d=ionos.com header.i=@ionos.com header.b=a6A1MDjS; arc=none smtp.client-ip=209.85.218.50 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=ionos.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ionos.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ionos.com header.i=@ionos.com header.b="a6A1MDjS" Received: by mail-ej1-f50.google.com with SMTP id a640c23a62f3a-a4467d570cdso452711266b.3 for ; Tue, 12 Mar 2024 02:42:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ionos.com; s=google; t=1710236521; x=1710841321; darn=vger.kernel.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=i50xlwbZc74AakEZHNdRuLF9vXbOX6ErFGehWmkuapg=; b=a6A1MDjSnHX30cuq3bLIPtgO3DM+C7o/Np68DxDFPC7/u1fGpLRnviMRg5DNW7NmG/ 5vDp80t4n69zZvjfyQH1swFa9JPh65BmcpwSOYxCO13HX4YP8bFKyyQdduOTxZv0/IBo VajA8rgkLp60/Q4vAWa86dwzFAvl+h0DmHFEdKpXr4jxbUP6MJyicgz+g1o1gLaZHJEP XfUd0UjYIS3J4Phjpr3eUToOapiron/SSD6qcB9rLsfUd8PRxq9APpwdPzq1AHMW8JFg S5gph1wc2Rzm8NaPXrCVKkYT3DglJHNxhLTH/OEMHUgN9jVDaie2BSN1j2AQlWZmUhBd Yduw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710236521; x=1710841321; 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=i50xlwbZc74AakEZHNdRuLF9vXbOX6ErFGehWmkuapg=; b=KTXZf/ibD0jur/9GMIPXdFG/x2JzCkwJcS4KAgtr9L9+sDniu9HBnskHIlCqjR6DHE ni+/qh6llne2XAPQO4FAynzfjUMAiJ+kpTHaVz8q0QzXVeAzY8kkCwwuSV36VO4yNah9 iMLkTHIlbjWfjwHvZ/4ENJb7HVC6guvmazpysyWTxtz+Jrbm0M2MjlIa+V32hPzDI+XS CD5cWTpLmKLmbArHmOQCr52USZf4Ef5sUApGTh+no2wxTxXehN11LUiwja9v++SRcDA5 1k3AAmxgVSOtfY0uE1kqRFApeHjGkYG4NrKgjdOL58HqzI7ukIsTU0fP/7Nks0cYQTWp wdgg== X-Forwarded-Encrypted: i=1; AJvYcCXblIB6dmzYgNZcaKR2dltNePo16f294+wtHAkt0ecuzQO2gu+kY36k/ZPCs5imM18WeDl12gBumd+yx8PA8bnFJj5UeQ/fnuo4mmWz X-Gm-Message-State: AOJu0Yzu/LyPv6czEqG+Qt9w2XXWPaiP9DvrIELoG2sjwOx995LMNy0P vz4SJrYSk4+3iCwrZOCuf7mZrMlZ2myowwOTxrY1OrEcGacYf6HeSAk5r8Ko4fg= X-Google-Smtp-Source: AGHT+IHE1rmIWCBb38RKNMnxPLtWxqbctrPPIxbV0WrCoKWmsRzG7Lzagrq8yH3gH7FOwHCKd2fZew== X-Received: by 2002:a17:907:7714:b0:a45:a98f:2cf7 with SMTP id kw20-20020a170907771400b00a45a98f2cf7mr5679209ejc.57.1710236521219; Tue, 12 Mar 2024 02:42:01 -0700 (PDT) Received: from raven.blarg.de (p200300dc6f010900023064fffe740809.dip0.t-ipconnect.de. [2003:dc:6f01:900:230:64ff:fe74:809]) by smtp.gmail.com with ESMTPSA id jw22-20020a170906e95600b00a4623030893sm2091961ejb.126.2024.03.12.02.42.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Mar 2024 02:42:00 -0700 (PDT) From: Max Kellermann To: akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: willy@infradead.org, sfr@canb.auug.org.au, Max Kellermann Subject: [PATCH v4 12/15] linux/mm.h: move pfmemalloc-related functions to pfmemalloc.h Date: Tue, 12 Mar 2024 10:41:30 +0100 Message-Id: <20240312094133.2084996-13-max.kellermann@ionos.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240312094133.2084996-1-max.kellermann@ionos.com> References: <20240312094133.2084996-1-max.kellermann@ionos.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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 b3f83fb26aca..07262ae43c5d 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -8,6 +8,7 @@ #include #include #include +#include #include #include #include @@ -1763,50 +1764,6 @@ static inline pgoff_t page_index(struct page *page) return page->index; } =20 -/* - * 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 =3D (void *)BIT(1); -} - -static inline void clear_page_pfmemalloc(struct page *page) -{ - page->lru.next =3D 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 =3D (void *)BIT(1); +} + +static inline void clear_page_pfmemalloc(struct page *page) +{ + page->lru.next =3D NULL; +} + +#endif /* _LINUX_MM_PFMEMALLOC_H */ --=20 2.39.2 From nobody Sat Feb 7 12:18:29 2026 Received: from mail-ej1-f43.google.com (mail-ej1-f43.google.com [209.85.218.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7E7A77AE7E for ; Tue, 12 Mar 2024 09:42:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.43 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710236525; cv=none; b=VzzZptNxODj4fnF4yCacGI4okNiQWr9j7yX7PqZE1a2jSbTStK90NF0Zy5HT2C2mRN+d4bjgt7QUeGQ+MV5VeJTWsIZptejFj7h52JCvHWtHbokh1DjZkVoXerlKcTsO+h3G1pJSGQ3p3Qp+N2BcixvDYiBCq8y9VaWxFv71N9U= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710236525; c=relaxed/simple; bh=1xnF40lCeTl2Fq3HZQkpBaNZnb2sADMKOS6Vo+/oJd8=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=JDaS6duHDO49GkiC3mmnQsK9c+WJp+AkwaY8L3/PfUKN6Usa3/fLN4G8Dfr5QLAwaizIAQ3xZIGoAfjAwZf++bxtgAD7MppOY7GR/X4wJpOHWFBbQd+o/eub0wiTnBBX64tWsq/dKfq19en+yK+17iyu2dbDyY3iSHlIz9aDLmk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=ionos.com; spf=pass smtp.mailfrom=ionos.com; dkim=pass (2048-bit key) header.d=ionos.com header.i=@ionos.com header.b=EsHeLtO5; arc=none smtp.client-ip=209.85.218.43 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=ionos.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ionos.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ionos.com header.i=@ionos.com header.b="EsHeLtO5" Received: by mail-ej1-f43.google.com with SMTP id a640c23a62f3a-a462a1b7754so229099766b.2 for ; Tue, 12 Mar 2024 02:42:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ionos.com; s=google; t=1710236522; x=1710841322; darn=vger.kernel.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=ATfCxZ0IifVoQF3dNCoyZLQIGDsbM/UfOW1XioKp6uI=; b=EsHeLtO5q8anzv4sSkYwfur+GKcXshEprOZRDPodtcMIZjOPA9whmWwZ8sYuL/sv6e YGTwz2FEjduHgNcZ6mUwfcBH3k/8pEhfFRWyya6h2M0qj5ShbkFOphAZDR39+o+LH4Hw aJaja36P9CRm/xmvcSsfNKiTGPu4kK/mAF1TQVJq1RHayOMbdqkxPK1bSZiwFEozeevm 3YZv1fc68rQipR1d2REfibYy5zDJC9lmFumtPfFPCTfqWAm4vw4Zy6px75HgsggeIRWQ OXM8WPaO3gFL8IEQ2sNKFZ2+/tw5We9F4HBcoCwvA1bVANQKEKf4QCs+Z+e1gVG5P7MD GfMg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710236522; x=1710841322; 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=ATfCxZ0IifVoQF3dNCoyZLQIGDsbM/UfOW1XioKp6uI=; b=rwF+54lsNzGvFTVq0bvXoRBkQuHoAVA1GwU18jOHvXSTcdmCDoUDfhtytzvEL8AxwL hFbyebn99U0waKNXTl1tw20vk0P938cgsC7CT1+VdMCZsHfRId6VoVrR9Le8rMneFK63 5UpVpkJ5f/JJhGCzQlcVYcx8ciqnx4TofboA4DyQj7ZUPTqjVT6azaAf0gunDs2g/kiH UeUQ3caaWhgflBCGmXO0OaKUI8j/2DaHWxzWwUqw8tuJsTH83Ijb8D9RDkTnuf/XJPon RiC96InemZTdYYZY5nShUkuZ2ifiWP30AWF5VO47hwVV4gn4W31s8CPeJaiBCpL2WSs3 E8Qg== X-Forwarded-Encrypted: i=1; AJvYcCVGQ83/o0t11PjPB3FZkOwyV4jfunuW0LfiT7SQtpzHlgDLrI2ZrLM4hNWlDiXfLkCCc+44xJfhVAFltrLCMAlecVPR7gY25SUqnKiT X-Gm-Message-State: AOJu0YwD3JDCcM26HFHngxSViFKz75ky2EsYZQR7a5dy2L2pbg5zi80Y dSIUxmD5yVUBHAU3sit2gtno+E66WpzkMjBEOmnByIZ7x6/fuIKFOBJcZXA+9FhQZcdzh7K7M0h H X-Google-Smtp-Source: AGHT+IFm4FuW4Q6fcKByW+nr4fxGN22zpZHPL0egfaVaa7jH0Kxg7oTwjuowI6oi5Qt4kRMHasE2rA== X-Received: by 2002:a17:907:c706:b0:a45:6cc0:8f19 with SMTP id ty6-20020a170907c70600b00a456cc08f19mr6331728ejc.38.1710236521930; Tue, 12 Mar 2024 02:42:01 -0700 (PDT) Received: from raven.blarg.de (p200300dc6f010900023064fffe740809.dip0.t-ipconnect.de. [2003:dc:6f01:900:230:64ff:fe74:809]) by smtp.gmail.com with ESMTPSA id jw22-20020a170906e95600b00a4623030893sm2091961ejb.126.2024.03.12.02.42.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Mar 2024 02:42:01 -0700 (PDT) From: Max Kellermann To: akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: willy@infradead.org, sfr@canb.auug.org.au, Max Kellermann Subject: [PATCH v4 13/15] linux/mm.h: move is_vmalloc_addr() to mm/vmalloc_addr.h Date: Tue, 12 Mar 2024 10:41:31 +0100 Message-Id: <20240312094133.2084996-14-max.kellermann@ionos.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240312094133.2084996-1-max.kellermann@ionos.com> References: <20240312094133.2084996-1-max.kellermann@ionos.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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 07262ae43c5d..80fc7df2856a 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -9,6 +9,7 @@ #include #include #include +#include #include #include #include @@ -1086,30 +1087,6 @@ enum { int region_intersects(resource_size_t offset, size_t size, unsigned long f= lags, unsigned long desc); =20 -/* 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_add= r.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 */ --=20 2.39.2 From nobody Sat Feb 7 12:18:29 2026 Received: from mail-ej1-f50.google.com (mail-ej1-f50.google.com [209.85.218.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BB9E07BAF2 for ; Tue, 12 Mar 2024 09:42:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.50 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710236526; cv=none; b=r4dWH4kLIf4f0GTpRV8F21688AVIamhZUKfUrC04enveYtN72TDM8PT/qUjZPCQEHu8sZN0WxVXWZ3yZdaNvqsxWgMGkRoN+UnMVNzYaeUSCeesrmV1DP75sKmSLjNwksz2Ps/z5OKIxHgSS2/YG16ONEHBk3kW++fadFlv1HwI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710236526; c=relaxed/simple; bh=tQ04io/+Nt7goSdFZ2lW5EdMWfpzf2N9Kt4X/6vn+vU=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=Zoe3htkjB9U3dFjI7LDaZHl0G/crfBiMgF5T+spzaY2AGmmoh5AirR+cKFNpo8snFRRGS6SEx4U8nMXOaf8izpiF8eqWjsIcshTd4tDT8VeC3IusvHkH3OMtN+ZV55HA7PXKOmm7Fu2vO8fFEugALH1OQKYEQuXJlRPDb9c6X4c= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=ionos.com; spf=pass smtp.mailfrom=ionos.com; dkim=pass (2048-bit key) header.d=ionos.com header.i=@ionos.com header.b=LB8LaDCu; arc=none smtp.client-ip=209.85.218.50 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=ionos.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ionos.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ionos.com header.i=@ionos.com header.b="LB8LaDCu" Received: by mail-ej1-f50.google.com with SMTP id a640c23a62f3a-a45cdb790dfso545735166b.3 for ; Tue, 12 Mar 2024 02:42:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ionos.com; s=google; t=1710236523; x=1710841323; darn=vger.kernel.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=H98hGtgyPjAfoBc3hVuyxWtvFj6EPdBcbjtg4+paKuk=; b=LB8LaDCuHEaS2MHtZse5RCO18/Ate72/27v+PddKIowX/i3hEEL69v37vBiWsOyjz2 buH6FnzjSiTorABtBcJrb3dATsEDK1DaZtR3GbzBM7vbaEGoet6UzVMuGCBk6QaPidTi U5irUBP5+K2Ty+xpSHAwa+NBlcfAR1MEcWxdsMPExJYrWCregASYdFrvwkOlRlrZ10N+ jjl7FKwwaZZcCKvn21g5HxNJU3t4HruXxFCDohnwV52yVh/D+a38JWMfBm2dr7AP1i7o MrDT7TJP8Sx2fJEP927+SodZv8Jxi+slN5K06/QM+NZZjYJOttw81y62zG7HpK2DPmOc uAtA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710236523; x=1710841323; 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=H98hGtgyPjAfoBc3hVuyxWtvFj6EPdBcbjtg4+paKuk=; b=GgjF3W26E8sWXPcw5tI0d/NrHMV7RQ+zurVJ1x1EFU4E3U9lqSFy0V7tyJGfUZiYxK h+UWe2tKXD3mkXyhb3ivjn2r7L2kAa/ORZqejNoFDhiPjXKdjlc9ZDxMM1p7C7Iq5y5j KFZfDhqXwINF6IW1Lh0z5V0GmWlSFw2p3LISPu+3EBS31LqsHTVCMNhHoUTXQQO72OMD 1DQGibRm4HBKS6wK0DAuubp06WyYR/ujWPXDH2y0WH5b6bEI20oG/v5n+3/46jmKZ+Mz y+P+FgRcBlh9qxxNxjpq/8oJ9ZVCCnOJ7ac2ehzkRfsi4BrTLAg84gDco3AR2dVJ9iZH uAVQ== X-Forwarded-Encrypted: i=1; AJvYcCV+zIvnuZhQV2+lB/1Sjbqjux4voKlFBr0bZM5+YjXaNvoBZo2NpywwvTJtWqPco3cQczhgEifTwHgeOF5sPDcysJPGLh5qN5bJ9Kam X-Gm-Message-State: AOJu0YzTdyCyCWY38gnylaiihjeBXvcEPUccf3z2ASAdcGazVopiixso OFybCO30kgwQ+RbB7Eg92fzsgfv7+F+Mph5e3bKMON+dvo5yQvOrOQ4QhoINob0= X-Google-Smtp-Source: AGHT+IHpv90+P4zxSDURZ7ttG7/z0EYrKrLjaG5oEbvP3KEWBv4oQ9xKxdnYYEq8UAt6cIlNMDUY2g== X-Received: by 2002:a17:906:a241:b0:a43:fd9e:2d44 with SMTP id bi1-20020a170906a24100b00a43fd9e2d44mr5256532ejb.42.1710236523257; Tue, 12 Mar 2024 02:42:03 -0700 (PDT) Received: from raven.blarg.de (p200300dc6f010900023064fffe740809.dip0.t-ipconnect.de. [2003:dc:6f01:900:230:64ff:fe74:809]) by smtp.gmail.com with ESMTPSA id jw22-20020a170906e95600b00a4623030893sm2091961ejb.126.2024.03.12.02.42.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Mar 2024 02:42:02 -0700 (PDT) From: Max Kellermann To: akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: willy@infradead.org, sfr@canb.auug.org.au, Max Kellermann Subject: [PATCH v4 14/15] linux/mm.h: move high_memory to mm/high_memory.h Date: Tue, 12 Mar 2024 10:41:32 +0100 Message-Id: <20240312094133.2084996-15-max.kellermann@ionos.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240312094133.2084996-1-max.kellermann@ionos.com> References: <20240312094133.2084996-1-max.kellermann@ionos.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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 l= ong x) */ #define ARCH_PFN_OFFSET PHYS_PFN_OFFSET =20 +#ifndef __ASSEMBLY__ +#include +#endif + #define virt_to_page(kaddr) pfn_to_page(virt_to_pfn(kaddr)) #define virt_addr_valid(kaddr) (((unsigned long)(kaddr) >=3D 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 =20 #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 0ca6c408c07f..17ccc91c3cd6 100644 --- a/arch/csky/include/asm/page.h +++ b/arch/csky/include/asm/page.h @@ -32,6 +32,7 @@ =20 #ifndef __ASSEMBLY__ =20 +#include #include =20 #define virt_addr_valid(kaddr) ((void *)(kaddr) >=3D (void *)PAGE_OFFSET = && \ diff --git a/arch/hexagon/include/asm/mem-layout.h b/arch/hexagon/include/a= sm/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 @@ =20 #include =20 +#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_m= m.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__ =20 #include +#include #include =20 /* diff --git a/arch/m68k/include/asm/pgtable_mm.h b/arch/m68k/include/asm/pgt= able_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 @@ =20 #ifndef __ASSEMBLY__ #include +#include #include #include =20 diff --git a/arch/parisc/include/asm/floppy.h b/arch/parisc/include/asm/flo= ppy.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 =20 +#include #include =20 =20 diff --git a/arch/powerpc/include/asm/book3s/32/pgtable.h b/arch/powerpc/in= clude/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 @@ =20 #include =20 +#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/in= clude/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 =20 #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/pag= e.h index e411e5a70ea3..9ae87fc2c648 100644 --- a/arch/powerpc/include/asm/page.h +++ b/arch/powerpc/include/asm/page.h @@ -7,6 +7,7 @@ */ =20 #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 =20 +#include #include =20 /* 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 @@ =20 #include =20 +#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 80fc7df2856a..1d7b4c781995 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -6,6 +6,7 @@ #include #include #include +#include #include #include #include @@ -82,7 +83,6 @@ static inline void totalram_pages_add(long count) atomic_long_add(count, &_totalram_pages); } =20 -extern void * high_memory; extern int page_cluster; extern const int page_cluster_max; =20 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 */ --=20 2.39.2 From nobody Sat Feb 7 12:18:29 2026 Received: from mail-ej1-f42.google.com (mail-ej1-f42.google.com [209.85.218.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9E8D47C0BC for ; Tue, 12 Mar 2024 09:42:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.42 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710236527; cv=none; b=DqJWLGTQrcBJPGHM8+svPN7ufpktWGiQH9VlznfNbPP21Kl1rifBybt4ysqpS54Uz0GNzTdqqHpO4WkQDBvwT0F64rkFwqzDqkATzDPgCZ5kxjXKaOdDcX+riyrMvW9YLIvkBRg9MJE54qUUAMkMcM2PWknw/rva/Ne6FZ+KPP4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710236527; c=relaxed/simple; bh=zLQTClvlEzGI/x44WBlT/FrIRLpjouIvXQ6mUIYW7FY=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=FGtSTYZGBJ/v/UAJw5AtNBVJ5K6TUCxqwGb4L4WlzCl59WZbMVrYnmVufeMIiDjIFz6WIVMx7PsqCFJ775OYWP5qnnT66BrMdA8fGmfEDBqaLDA75CZWHMDmi5yaq20mblmKcpSQ1zURA9nNjnpZ7sJkgHU0IIjCNMmffWBmHWc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=ionos.com; spf=pass smtp.mailfrom=ionos.com; dkim=pass (2048-bit key) header.d=ionos.com header.i=@ionos.com header.b=a7t0xL1+; arc=none smtp.client-ip=209.85.218.42 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=ionos.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ionos.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ionos.com header.i=@ionos.com header.b="a7t0xL1+" Received: by mail-ej1-f42.google.com with SMTP id a640c23a62f3a-a446b5a08f0so949702666b.1 for ; Tue, 12 Mar 2024 02:42:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ionos.com; s=google; t=1710236524; x=1710841324; darn=vger.kernel.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=Jrscdt21PtPY517djC+TvV15g1fCQxv1c3sR3dIsMR0=; b=a7t0xL1+yZpk3D/c4AXn/nqxuiH7M95uXiteXoVAtvHKtYwP+fFa8XJbQvUjizIG/g UCylibaS+aaraSxx4crrWL9Via55L0IWuyG5ENGUCgjuaqs4jPugMF9qjielVnO8l4g1 LnpOifUiYgPGXDxIs9PNB7YYzx9EjqMvyVwWiidSkGHvOHUHvgf0WM+59HGQ4lqZAZfi aTCjB+SIWHvZwDPgSIPwwx8bMv08qjVOpo5Qpt9WARPt/S40Qh+YaXryns05KVL4paQd dqDrxMuMY2jB2amcrDxIgGZFQrO8pEynL54SSkUf1572nx2/Jd0/mdIIcpQNtYkiU83H BJoQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710236524; x=1710841324; 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=Jrscdt21PtPY517djC+TvV15g1fCQxv1c3sR3dIsMR0=; b=I5lRzyRf9Ka3ksbvgiX9tQSLfy6yMzGd87i6O+UBJOlXGN2XgbkYfSvBXIWvRcBSXX rRY3Y0eG7HlGC5juzZ/GL9sVvIYgIlgumej8N8L8nCY2qaitPzQYroC+KO9ewEsTQH+L FSTsZDGaOZwd5JRmMd3ehs1o2jEYyHEc4nIQOvZMxq4bFiSOBR7UjZ31zynsND/CyVjY t+tcBJK3yaaVoM1KPlfJEB1f7iUSnm6h3SQETFnnKMo40NSUXvP2sJ2bshAgq+xM24/k TiQ5GrD1uxfMkw3u0JcnZgQLhmjxalRxX3PVMV69wPJOcLT+uuobchAGHtEUjgN00Tji dH+A== X-Forwarded-Encrypted: i=1; AJvYcCX8K5qqwNqMRz0Duw3Bf80itvWPAwVOvxawV+QxEswamX4s82KIxfUvklyrjNtMjedv0couLQooGWvnk2N1noRG+eXAAMtozhz5e6yf X-Gm-Message-State: AOJu0Yzvmcz0KF0Otm/XHtFzgobNqfmWICBkAXYGWr4+0FuVoy7dMTw/ NuUf3YS83nDvrhjl11e09WXNpvJKCM4KHy+LPS1s6DdtM923a4+k2Zmpe1MEyJo= X-Google-Smtp-Source: AGHT+IH+55sS4D1Wofdn/P5aBaDbVhmB1/EaSYmDeSmBmhB/cebupf3IhOpDFPGmtUJAfiNuT3MXBw== X-Received: by 2002:a17:907:d50a:b0:a43:ffe1:7d1 with SMTP id wb10-20020a170907d50a00b00a43ffe107d1mr8979316ejc.17.1710236524165; Tue, 12 Mar 2024 02:42:04 -0700 (PDT) Received: from raven.blarg.de (p200300dc6f010900023064fffe740809.dip0.t-ipconnect.de. [2003:dc:6f01:900:230:64ff:fe74:809]) by smtp.gmail.com with ESMTPSA id jw22-20020a170906e95600b00a4623030893sm2091961ejb.126.2024.03.12.02.42.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Mar 2024 02:42:03 -0700 (PDT) From: Max Kellermann To: akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: willy@infradead.org, sfr@canb.auug.org.au, Max Kellermann Subject: [PATCH v4 15/15] include: reduce dependencies on linux/mm.h Date: Tue, 12 Mar 2024 10:41:33 +0100 Message-Id: <20240312094133.2084996-16-max.kellermann@ionos.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240312094133.2084996-1-max.kellermann@ionos.com> References: <20240312094133.2084996-1-max.kellermann@ionos.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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 =20 +#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 =20 /** * List of possible attributes associated with a DMA mapping. The semantics diff --git a/include/linux/highmem-internal.h b/include/linux/highmem-inter= nal.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 =20 +#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 =20 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 =20 #ifdef CONFIG_UML diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index 3023bc2be6a1..7b61eac3baa4 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 =20 --=20 2.39.2