From patchwork Tue Jun 4 09:08:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Max Kellermann X-Patchwork-Id: 13684913 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 745B8C25B78 for ; Tue, 4 Jun 2024 09:09:12 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id ED8FC6B008A; Tue, 4 Jun 2024 05:09:10 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id E5F376B008C; Tue, 4 Jun 2024 05:09:10 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D01026B0092; Tue, 4 Jun 2024 05:09:10 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id AA7B86B008A for ; Tue, 4 Jun 2024 05:09:10 -0400 (EDT) Received: from smtpin11.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 606B0A1A74 for ; Tue, 4 Jun 2024 09:09:10 +0000 (UTC) X-FDA: 82192632060.11.13D83E4 Received: from mail-ej1-f48.google.com (mail-ej1-f48.google.com [209.85.218.48]) by imf07.hostedemail.com (Postfix) with ESMTP id 5C9354000D for ; Tue, 4 Jun 2024 09:09:08 +0000 (UTC) Authentication-Results: imf07.hostedemail.com; dkim=pass header.d=ionos.com header.s=google header.b=V2Mzib0l; spf=pass (imf07.hostedemail.com: domain of max.kellermann@ionos.com designates 209.85.218.48 as permitted sender) smtp.mailfrom=max.kellermann@ionos.com; dmarc=pass (policy=quarantine) header.from=ionos.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1717492148; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=F9nIWEpeq+x9zjwKZn660Hrmucb48woIRSOtfjCvxw0=; b=Dc2DuHlRQg6vdpuaHFbgkED/M4fdndNCaKfV/SR+t/UgKhx0VcmJRbCpypETvAEAog6dRc rFmGCdpRXBXju2HT0Mn5oGivHh/now9PpK5n1pUeLI3vk1ytIu9etsuOFfGrPGRJyxKz1e SklWtOwpv6S+46LIZIqHGhQ5i1Utb+g= ARC-Authentication-Results: i=1; imf07.hostedemail.com; dkim=pass header.d=ionos.com header.s=google header.b=V2Mzib0l; spf=pass (imf07.hostedemail.com: domain of max.kellermann@ionos.com designates 209.85.218.48 as permitted sender) smtp.mailfrom=max.kellermann@ionos.com; dmarc=pass (policy=quarantine) header.from=ionos.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1717492148; a=rsa-sha256; cv=none; b=xmRYGbws8h5l0MuN92pU6nxuwpdl3Y//n9BTUQUs2KrMeYITc2Iv2LH2ncfJ1WatvRo69r uDY84lmPAKsSgqe9Zo6EYUqjgO/2AP7+lpydi46C0eDMpAtYDui4rWIfbtEoQIiAF3VuHD S15H0ihFwd9crPR6JGj6o/xKa1E7ySg= Received: by mail-ej1-f48.google.com with SMTP id a640c23a62f3a-a68b54577aaso315393366b.3 for ; Tue, 04 Jun 2024 02:09:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ionos.com; s=google; t=1717492147; x=1718096947; darn=kvack.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=F9nIWEpeq+x9zjwKZn660Hrmucb48woIRSOtfjCvxw0=; b=V2Mzib0lBBOam4xVY6GZ3X5d6nhEiii2uN07V4iKVLgI5eW5KlFfza1bMMO7BFuiFT PM07/bNrXTuM94VxtfRD3HPtDwQtpJbX869dDDWDZ/DVLj2kD5tJWoWGUKHQE6FUYmU1 CaWM7ikIaNcnBkA4vcfO8az75gJfJ1sYE+I9zf1IUVQ6ZccgINcJ3jlC/ZlbHvjuH/Pa yyUTs3ae9OK7MPHKq5bvBqYbaZSf7DdfS+DCAy1JW1dep7hbYDw/WVfp4xH9HFOrA77j 0YyCmSPKD1QhcvdG3gfsgmF0Q3FCYzlTMmz6SQN0vxhmtMMP1p1JEuxjTYB1sPy1/rZQ D9fw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717492147; x=1718096947; 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=F9nIWEpeq+x9zjwKZn660Hrmucb48woIRSOtfjCvxw0=; b=HhzcIgKQ5J84nwrL0Ka8Myx+a0VFftYC43o0ciufuv7bzK9r8nYg30IpdYnRLPYTLU orHO3W6lkEsOQhCIoVOffa/xnbPDfxJ3H454Zf+kwVCWXlII6CuofFgDNcq7DE3rokdN AJfeKDJ73Di62pj4RR4Rt0OQOp/FuwvvkgP4/huaNNsZ6lgGLhuGxPMirKjsrPMPVWMV y1kd27mo9A8akxKzZ2BicfrXky+YRzCwAUZViqIHeVixHQnnyl8bbiPIz1eC3hf/a0vq 73SMOeIQUomNA0O/wC0hm1b+HKSZuDB9R8HUoYq1FZpB/D/ZSJ2ZdPLQs3Q5HoeM2YVH zFmg== X-Forwarded-Encrypted: i=1; AJvYcCWfcRk0G5byr+ynyEdW64g8TpQODblsKoaChb8iIlKFOWTz7HJEKoV1XsBiD1my85pgSJBOEm42lyyuEg+DHDJG2+M= X-Gm-Message-State: AOJu0YwRafTiaKMj/E2futq+hPf2heWfRsg41NkWSnFUENIkk1kXvex5 aACvAdTXgWM7Zm3gV9+6xrP/8PVNodOlNAM2vKsc5MyvmPc9vpnflIkZK8+dXHw= X-Google-Smtp-Source: AGHT+IH/QWdZZ4hxij414qaSi16QQPTkgw/+VI8cd7eUev+6bYbrIXWUDGZs5ah4lxOjZno8KDMAsg== X-Received: by 2002:a17:906:31c7:b0:a59:b61f:b96d with SMTP id a640c23a62f3a-a681fe4d0c3mr753625466b.5.1717492146689; Tue, 04 Jun 2024 02:09:06 -0700 (PDT) Received: from raven.blarg.de (p200300dc6f4f9200023064fffe740809.dip0.t-ipconnect.de. [2003:dc:6f4f:9200:230:64ff:fe74:809]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a68fa49e66fsm328376766b.129.2024.06.04.02.09.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Jun 2024 02:09:06 -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, david@redhat.com, Max Kellermann Subject: [PATCH v6 01/15] drivers: add missing includes on linux/mm.h (and others) Date: Tue, 4 Jun 2024 11:08:31 +0200 Message-Id: <20240604090845.2182265-2-max.kellermann@ionos.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240604090845.2182265-1-max.kellermann@ionos.com> References: <20240604090845.2182265-1-max.kellermann@ionos.com> MIME-Version: 1.0 X-Stat-Signature: k9ih4oy1yxbfipdqzsw6999m8497bzme X-Rspamd-Queue-Id: 5C9354000D X-Rspam-User: X-Rspamd-Server: rspam10 X-HE-Tag: 1717492148-344241 X-HE-Meta: U2FsdGVkX18f4wUau0kAkf+HgKrZTlWqhxoxBByRgN0Jm5b+Omh0qGnHOZ5flBMWfhnEcaCjUOtqWH8FkCd9psFZQ5UAz266l8rXVJ6c5X3xDeXnAfeRizbqadGfuVbBf3LYzDU2XKdZjtkfyS/j/RNO/vm8WdRTN6qbK420IKUv6bz5Ij8KfOAdS+O81QNEDd9tHEwbV9EYVbkdHlPGnBjwz7OnFp5qUxaSe5l5rVQGAu0/mWy4lrEP8vKUeZOy5TlQEZqtnZSv3JMzx61Cpz6WptnDuqayX9AmgNx82Rp0dzfh9HGl74pKSN0QN73M3MZ4f9+/9q+fIzhavSTsHQJG8GPdRVp6tBsRNu6o2zCV8pLAHxxOb9m7qBW4q9wxXFe9L2YAnj7AhxfATTox6SNckuF+a8fj8s2vXzX4vER/AV0+nXCuHNN4b+3R6NnTpPPqFDJp1D9IoiW8zOYpl3xPPDQRW9rTyxQye6VwfNPuI7mNz2FiYYyPhztuYgftuSDIDmnguU6MHBmAb1JARuuHL021vv5SEj+ttIUYiuRvMG9+g2ZORUpuvqqBIvtzYSIpBfpXOb2bF8pQxPuTMs6wdSPgizdNrJSjkJ+QRL/LkFc/vtnwBggLzl9+Mosg3bdsuYjBCBZNXJnyC9oQwvwLg5hU5M8D8PbvgFyfL2b4nkBzcORvDt9jXdG9qLVgWPE6b4+4BvhhOxdbgpRvKJ4F9naMFKoAgNql+EKtfjkzpifAI1vE59V7TC5eESx4sPFmnpsPzW77EcXFq/TsViCPvEdowvCv09XPbM1DmUkTJckHi88HgKEmiaUyogTkej96CoJ+GIq5sevEwVie2AL3byAtQ7zbLGI+27V6cqy5r1oXkOWvogwHGZZ5pRd3+SOvmq4tDKCeBYUNytKWpYKDuWL0uXYmTwX+BSZzclbae13pbQtRRB77QwW+lkO34tuEVhU+yXpmCbiJH0H HSNlM77y W98fHQUIDWqRbiWzgXfOYariLQoR067nHUjEyld74kPOAO6bH5Xu6rnIxuUlnUO3xkihhSM4xoN/PUU9lXfCoEns2Kpss5UoneoYTcKKJyjREVbhlkCndby/G+8qH3cTAfmJI0zBR5hBOJlUhxrgLgeYVBCxC01wwLy2gGm4Un94zGxh922D5NVKo+NSzgvdTxjwEIlMnxTdLlDbomK75W1ROeuVGUsKU2NTToyzwgP7grqtLVu+Aqc30dIl+f1nvcgQHAPA+pPo6Q0Zvf+/gzsCYTYKlIpX536mQgl2icEltkBYeHycBlozaLc/7NIiRQkS3vxr7GcNwAzastScZXflkjsCmDKc2iS7zbqalShgDswbqE8kIuDucwzSCjN6SHlrb X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: After developing the other patches in this series, I had lots of build failures because "#include " was missing. This patch fixes those build failures by adding the missing "#include" lines. To allow bisects, it is ordered before the others. Signed-off-by: Max Kellermann --- arch/arm/mm/iomap.c | 3 +++ drivers/comedi/comedi_buf.c | 1 + drivers/crypto/intel/qat/qat_common/adf_gen4_pm_debugfs.c | 1 + drivers/dma/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/mtk_scp.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/linux/vmstat.h | 1 + include/scsi/scsicam.h | 3 +++ kernel/dma/ops_helpers.c | 1 + kernel/dma/remap.c | 1 + kernel/rcu/rcutorture.c | 1 + mm/dmapool.c | 1 + 39 files changed, 55 insertions(+) diff --git a/arch/arm/mm/iomap.c b/arch/arm/mm/iomap.c index 415d0a454237..9873d8156908 100644 --- a/arch/arm/mm/iomap.c +++ b/arch/arm/mm/iomap.c @@ -29,6 +29,9 @@ EXPORT_SYMBOL(ioport_unmap); #endif #ifdef CONFIG_PCI + +#include // for VMALLOC_* + unsigned long pcibios_min_io = 0x1000; EXPORT_SYMBOL(pcibios_min_io); diff --git a/drivers/comedi/comedi_buf.c b/drivers/comedi/comedi_buf.c index 393966c09740..23b07ebc97ca 100644 --- a/drivers/comedi/comedi_buf.c +++ b/drivers/comedi/comedi_buf.c @@ -10,6 +10,7 @@ #include #include #include +#include // for PAGE_KERNEL* #include "comedi_internal.h" #ifdef PAGE_KERNEL_NOCACHE diff --git a/drivers/crypto/intel/qat/qat_common/adf_gen4_pm_debugfs.c b/drivers/crypto/intel/qat/qat_common/adf_gen4_pm_debugfs.c index ee0b5079de3e..c9b2787baac7 100644 --- a/drivers/crypto/intel/qat/qat_common/adf_gen4_pm_debugfs.c +++ b/drivers/crypto/intel/qat/qat_common/adf_gen4_pm_debugfs.c @@ -1,6 +1,7 @@ // SPDX-License-Identifier: GPL-2.0-only /* Copyright(c) 2023 Intel Corporation */ #include +#include // for simple_read_from_buffer() #include #include #include diff --git a/drivers/dma/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() #include "virt-dma.h" diff --git a/drivers/dma/dma-axi-dmac.c b/drivers/dma/dma-axi-dmac.c index bdb752f11869..7538459f1d8a 100644 --- a/drivers/dma/dma-axi-dmac.c +++ b/drivers/dma/dma-axi-dmac.c @@ -15,6 +15,7 @@ #include #include #include +#include // for PAGE_ALIGN() #include #include #include diff --git a/drivers/dma/sh/rcar-dmac.c b/drivers/dma/sh/rcar-dmac.c index 40482cb73d79..784da367665c 100644 --- a/drivers/dma/sh/rcar-dmac.c +++ b/drivers/dma/sh/rcar-dmac.c @@ -12,6 +12,7 @@ #include #include #include +#include // for PAGE_ALIGN() #include #include #include diff --git a/drivers/firmware/qcom/qcom_scm-legacy.c b/drivers/firmware/qcom/qcom_scm-legacy.c index 029e6d117cb8..01e082c7163c 100644 --- a/drivers/firmware/qcom/qcom_scm-legacy.c +++ b/drivers/firmware/qcom/qcom_scm-legacy.c @@ -5,6 +5,7 @@ #include #include +#include // for PAGE_ALIGN() #include #include #include diff --git a/drivers/firmware/qcom/qcom_scm-smc.c b/drivers/firmware/qcom/qcom_scm-smc.c index 16cf88acfa8e..a5c74d8996fe 100644 --- a/drivers/firmware/qcom/qcom_scm-smc.c +++ b/drivers/firmware/qcom/qcom_scm-smc.c @@ -5,6 +5,7 @@ #include #include #include +#include // for PAGE_ALIGN() #include #include #include diff --git a/drivers/firmware/raspberrypi.c b/drivers/firmware/raspberrypi.c index ac34876a97f8..b7858014a59c 100644 --- a/drivers/firmware/raspberrypi.c +++ b/drivers/firmware/raspberrypi.c @@ -10,6 +10,7 @@ #include #include #include +#include // for PAGE_ALIGN() #include #include #include diff --git a/drivers/iio/buffer/industrialio-buffer-dma.c b/drivers/iio/buffer/industrialio-buffer-dma.c index 13b1a858969e..d3e82d25df70 100644 --- a/drivers/iio/buffer/industrialio-buffer-dma.c +++ b/drivers/iio/buffer/industrialio-buffer-dma.c @@ -6,6 +6,7 @@ #include #include +#include // for PAGE_ALIGN() #include #include #include diff --git a/drivers/iommu/iommufd/ioas.c b/drivers/iommu/iommufd/ioas.c index 742248276548..40c4942406cd 100644 --- a/drivers/iommu/iommufd/ioas.c +++ b/drivers/iommu/iommufd/ioas.c @@ -5,6 +5,8 @@ #include #include #include +#include +#include #include #include "io_pagetable.h" diff --git a/drivers/iommu/iommufd/selftest.c b/drivers/iommu/iommufd/selftest.c index 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 @@ * */ +#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 694fc083b1bd..1e7421995f6b 100644 --- a/drivers/misc/fastrpc.c +++ b/drivers/misc/fastrpc.c @@ -10,6 +10,7 @@ #include #include #include +#include // for find_vma() #include #include #include diff --git a/drivers/misc/genwqe/card_dev.c b/drivers/misc/genwqe/card_dev.c index 4441aca2280a..ce3acb938ca6 100644 --- a/drivers/misc/genwqe/card_dev.c +++ b/drivers/misc/genwqe/card_dev.c @@ -17,6 +17,7 @@ #include #include +#include // for struct vm_operations_struct #include #include #include diff --git a/drivers/misc/uacce/uacce.c b/drivers/misc/uacce/uacce.c index bdc2e6fda782..af815b8a718e 100644 --- a/drivers/misc/uacce/uacce.c +++ b/drivers/misc/uacce/uacce.c @@ -2,6 +2,7 @@ #include #include #include +#include // for struct vm_operations_struct #include #include #include diff --git a/drivers/mtd/spi-nor/core.h b/drivers/mtd/spi-nor/core.h index 1516b6d0dc37..6b48bb57b638 100644 --- a/drivers/mtd/spi-nor/core.h +++ b/drivers/mtd/spi-nor/core.h @@ -9,6 +9,8 @@ #include "sfdp.h" +#include // for SZ_* + #define SPI_NOR_MAX_ID_LEN 6 /* * 256 bytes is a sane default for most older flashes. Newer flashes will diff --git a/drivers/pci/p2pdma.c b/drivers/pci/p2pdma.c index 4f47a13cb500..ef37ea6c09fc 100644 --- a/drivers/pci/p2pdma.c +++ b/drivers/pci/p2pdma.c @@ -16,6 +16,7 @@ #include #include #include +#include // for VM_MAYSHARE #include #include #include diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index aac5daad3188..780d6b4f923b 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/mtk_scp.c b/drivers/remoteproc/mtk_scp.c index b885a9a041e4..4f4f1e51d160 100644 --- a/drivers/remoteproc/mtk_scp.c +++ b/drivers/remoteproc/mtk_scp.c @@ -16,6 +16,7 @@ #include #include #include +#include #include "mtk_common.h" #include "remoteproc_internal.h" diff --git a/drivers/remoteproc/remoteproc_core.c b/drivers/remoteproc/remoteproc_core.c index f276956f2c5c..938220fe29f5 100644 --- a/drivers/remoteproc/remoteproc_core.c +++ b/drivers/remoteproc/remoteproc_core.c @@ -18,6 +18,7 @@ #include #include +#include // for PAGE_ALIGN() #include #include #include diff --git a/drivers/soc/qcom/rmtfs_mem.c b/drivers/soc/qcom/rmtfs_mem.c index df850d073102..15c2f6e5eaff 100644 --- a/drivers/soc/qcom/rmtfs_mem.c +++ b/drivers/soc/qcom/rmtfs_mem.c @@ -6,6 +6,7 @@ #include #include #include +#include // for remap_pfn_range() #include #include #include diff --git a/drivers/spi/spi-aspeed-smc.c b/drivers/spi/spi-aspeed-smc.c index bbd417c55e7f..e45f64761e5e 100644 --- a/drivers/spi/spi-aspeed-smc.c +++ b/drivers/spi/spi-aspeed-smc.c @@ -11,6 +11,7 @@ #include #include #include +#include // for SZ_* #include #include diff --git a/drivers/spi/spi-bcm2835.c b/drivers/spi/spi-bcm2835.c index e1b9b1235787..d8ed5575a9c6 100644 --- a/drivers/spi/spi-bcm2835.c +++ b/drivers/spi/spi-bcm2835.c @@ -33,6 +33,8 @@ #include #include +#include // for ZERO_PAGE() + /* SPI register offsets */ #define BCM2835_SPI_CS 0x00 #define BCM2835_SPI_FIFO 0x04 diff --git a/drivers/spi/spi-intel.c b/drivers/spi/spi-intel.c index 3e5dcf2b3c8a..cf8e4f1c4d93 100644 --- a/drivers/spi/spi-intel.c +++ b/drivers/spi/spi-intel.c @@ -8,6 +8,7 @@ #include #include +#include // for SZ_* #include #include diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c index 2a972752ff1b..12ad62415312 100644 --- a/drivers/virtio/virtio_ring.c +++ b/drivers/virtio/virtio_ring.c @@ -12,6 +12,7 @@ #include #include #include +#include // for PAGE_ALIGN() #include #include diff --git a/include/linux/huge_mm.h b/include/linux/huge_mm.h index 020e2344eb86..c48fdb486bb3 100644 --- a/include/linux/huge_mm.h +++ b/include/linux/huge_mm.h @@ -7,6 +7,8 @@ #include /* only for vma_is_dax() */ +#include // for pmd_t + vm_fault_t do_huge_pmd_anonymous_page(struct vm_fault *vmf); int copy_huge_pmd(struct mm_struct *dst_mm, struct mm_struct *src_mm, pmd_t *dst_pmd, pmd_t *src_pmd, unsigned long addr, diff --git a/include/linux/iommu.h b/include/linux/iommu.h index 7bc8dff7cf6d..d56e17a0fdf6 100644 --- a/include/linux/iommu.h +++ b/include/linux/iommu.h @@ -14,6 +14,7 @@ #include #include #include +#include // for copy_struct_from_user() #define IOMMU_READ (1 << 0) #define IOMMU_WRITE (1 << 1) diff --git a/include/linux/nvme-keyring.h b/include/linux/nvme-keyring.h index e10333d78dbb..9e033850b967 100644 --- a/include/linux/nvme-keyring.h +++ b/include/linux/nvme-keyring.h @@ -6,6 +6,8 @@ #ifndef _NVME_KEYRING_H #define _NVME_KEYRING_H +#include + #if IS_ENABLED(CONFIG_NVME_KEYRING) key_serial_t nvme_tls_psk_default(struct key *keyring, diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h index f04fea86324d..4d7265bbd93e 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 */ /* diff --git a/include/linux/scatterlist.h b/include/linux/scatterlist.h index 77df3d7b18a6..0516e64dc03e 100644 --- a/include/linux/scatterlist.h +++ b/include/linux/scatterlist.h @@ -8,6 +8,12 @@ #include #include +#ifdef CONFIG_UML +#include // for virt_to_page(), page_to_phys() +#else +#include // for virt_to_page(), page_to_phys() +#endif + struct scatterlist { unsigned long page_link; unsigned int offset; diff --git a/include/linux/vmstat.h b/include/linux/vmstat.h index 131966a4af78..67c2505d3b78 100644 --- a/include/linux/vmstat.h +++ b/include/linux/vmstat.h @@ -4,6 +4,7 @@ #include #include +#include // for folio_zone(), folio_nr_pages() #include #include #include 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 @@ #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() static struct page *dma_common_vaddr_to_page(void *cpu_addr) { diff --git a/kernel/dma/remap.c b/kernel/dma/remap.c index 27596f3b4aef..87b3c874d370 100644 --- a/kernel/dma/remap.c +++ b/kernel/dma/remap.c @@ -3,6 +3,7 @@ * Copyright (c) 2014 The Linux Foundation */ #include +#include // for vmap(), PAGE_ALIGN() #include #include diff --git a/kernel/rcu/rcutorture.c b/kernel/rcu/rcutorture.c index 08bf7c669dd3..a1527f855f2a 100644 --- a/kernel/rcu/rcutorture.c +++ b/kernel/rcu/rcutorture.c @@ -47,6 +47,7 @@ #include #include #include +#include // for mem_dump_obj() #include #include "rcu.h" diff --git a/mm/dmapool.c b/mm/dmapool.c index f0bfc6c490f4..b8e23fdc81d7 100644 --- a/mm/dmapool.c +++ b/mm/dmapool.c @@ -25,6 +25,7 @@ #include #include #include +#include // for want_init_on_alloc() #include #include #include From patchwork Tue Jun 4 09:08:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Max Kellermann X-Patchwork-Id: 13684914 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 29737C25B7E for ; Tue, 4 Jun 2024 09:09:15 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 253CF6B008C; Tue, 4 Jun 2024 05:09:12 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 2034B6B0092; Tue, 4 Jun 2024 05:09:12 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 004EE6B0095; Tue, 4 Jun 2024 05:09:11 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id D4FDE6B008C for ; Tue, 4 Jun 2024 05:09:11 -0400 (EDT) Received: from smtpin08.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 7A1CA80A8A for ; Tue, 4 Jun 2024 09:09:11 +0000 (UTC) X-FDA: 82192632102.08.FC3620C Received: from mail-ej1-f49.google.com (mail-ej1-f49.google.com [209.85.218.49]) by imf03.hostedemail.com (Postfix) with ESMTP id 815C920006 for ; Tue, 4 Jun 2024 09:09:09 +0000 (UTC) Authentication-Results: imf03.hostedemail.com; dkim=pass header.d=ionos.com header.s=google header.b=NVJxf3l6; spf=pass (imf03.hostedemail.com: domain of max.kellermann@ionos.com designates 209.85.218.49 as permitted sender) smtp.mailfrom=max.kellermann@ionos.com; dmarc=pass (policy=quarantine) header.from=ionos.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1717492149; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=BL1pmIo7s1MX4N9LU8kIbt0i/wU5mZK2rTJkOzRk4Zc=; b=LlXhAb6Csry4Ia7cwQzLEdiL0z2xN7vpR8bnh3cQwlPp4V2uZATsz627sJKwolFU8DBUvG jxhBHOUBevPOI/C9bl4ByA95KdrxgzuxbPcBKHNf1TB6rY5qmyuuHLg7GFrPpO42lIHKmz wlh3Oy7SSGqR/HSik4kpN/CXudXMnpo= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1717492149; a=rsa-sha256; cv=none; b=eZe4/L0gm7OkZkAbArliOluVdHlZ75hR86pN97Q5qHoom4r64GDe9viRO9UkE1lf+3oUvk EtZ+9yPC/FtqhWAvMfmLehm6XX/XN6C/D6B3a9gd9VHH++OZOROyeUCsFPnSyPkHx++5Dr Rau3ctO1d0I2zBYORWMGblQgIWqNb0I= ARC-Authentication-Results: i=1; imf03.hostedemail.com; dkim=pass header.d=ionos.com header.s=google header.b=NVJxf3l6; spf=pass (imf03.hostedemail.com: domain of max.kellermann@ionos.com designates 209.85.218.49 as permitted sender) smtp.mailfrom=max.kellermann@ionos.com; dmarc=pass (policy=quarantine) header.from=ionos.com Received: by mail-ej1-f49.google.com with SMTP id a640c23a62f3a-a69607c6ccaso53866866b.2 for ; Tue, 04 Jun 2024 02:09:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ionos.com; s=google; t=1717492148; x=1718096948; darn=kvack.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=BL1pmIo7s1MX4N9LU8kIbt0i/wU5mZK2rTJkOzRk4Zc=; b=NVJxf3l6CE/n9RMCk7tuP56B4zUekS8WCyNvA42sus1m68p1W7bUdcXjMVUFxTvLqU W9dyUBHvkWzxvp3nvVcxcObZ8cvqOso8f+8IuH+ONT7k4uQX5ZIcwXAGC1qm8KbUHIx6 UMSX5PlBjp3Mp+wUvCkxN4KraCZTmSp9rlIUFXSsYw46Ro59lo6/aGDo/i3uvvx8DuuH J/rr4u8Oscc38wOujiMXaIcyTcGkcPv3NcxnjcPiOZyjNSu+9dyTsPBhuY/LXHNv6B47 nRtm2dLcmWVAxHfO/0VjC2GmWSKPZjxnkFH9O++sZS0yUEigvWfBJVJ2XQrQgDgQXVQC tqkQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717492148; x=1718096948; 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=OrU0Ggw455/vFFVzbubmsIULlfXnRUjZAssvPseXyyYHrULxg/aSTc0g/eganRYVYe 1mSXjN1seMq1uND5dFFrXOP89R/Ky6munUb2flsvetP4MC+O8jVbIjsaWuK02ccnyvX4 GPvxNlG8tClvx0+C5D3GcsQ2f8KhMgsXXWWl72wyxSuTR+7ia1hMuX3LXzfjBteYp6S8 mv6MiLQhJ+4uuK+8h9ZyDPL48oX+6TMUcf085/i43NHbZhXWvPv/aORf6E08lZA4B9qw X1hvnnHh4fN6RwsEYjM2/pXWkO7UCw2JYBRNz9yGH9GVW9z3fEjnnRjHov73JCxWKaOF PO0A== X-Forwarded-Encrypted: i=1; AJvYcCUtim93WDrhHk2BF2nepqZPyHb7RYgJp2c5cVFboTDwZjL7vOjIECsByhzkhrDPTfgO3RIt96saP4qA3GoiSpXgQ/8= X-Gm-Message-State: AOJu0Yxq8CDnqb0ze8yKoszkbHFIbg8tW8r0/o3FQx7HZao4N9uFSb1X Gw+oTsz0a/8EHVA0KVMcxYHxQ16f2SPCXXQQqlMSbN8V+eel4Ms/MUyzGmsZ71g= X-Google-Smtp-Source: AGHT+IFF9eijKFo0jcGZn+um4NEghvBvIsaStj/BEJsY3lBQq9sQLzDiRHTklTVApw9KdQGhS/rGUw== X-Received: by 2002:a17:906:3b47:b0:a68:e429:1d96 with SMTP id a640c23a62f3a-a68e4291f3dmr482446466b.75.1717492148072; Tue, 04 Jun 2024 02:09:08 -0700 (PDT) Received: from raven.blarg.de (p200300dc6f4f9200023064fffe740809.dip0.t-ipconnect.de. [2003:dc:6f4f:9200:230:64ff:fe74:809]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a68fa49e66fsm328376766b.129.2024.06.04.02.09.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Jun 2024 02:09:07 -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, david@redhat.com, Max Kellermann Subject: [PATCH v6 02/15] include/drm/drm_gem.h: add poll_table_struct forward declaration Date: Tue, 4 Jun 2024 11:08:32 +0200 Message-Id: <20240604090845.2182265-3-max.kellermann@ionos.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240604090845.2182265-1-max.kellermann@ionos.com> References: <20240604090845.2182265-1-max.kellermann@ionos.com> MIME-Version: 1.0 X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: 815C920006 X-Rspam-User: X-Stat-Signature: pnn5pga43isdawycsg4tcx1j1ehft3qz X-HE-Tag: 1717492149-280090 X-HE-Meta: U2FsdGVkX1/mg1npwefHCA6GluBwYTOpsuJTKqPo17YERv2Tt3HedpFL+hZT9m2g3Q9tQVb1rZh3lV75/Vdj9SGIdrmJWrdiNcI7B9z93ikhW/0SIkG2JYDz4zWICW1sH2/4PiHVnKYr3Fe1y1QwYjSgSHKb7XM//LWvzC4TPV5W5qZLW1q1jHafz3Ed8tYbd91HzaX8mFYSxMptjil07wiXx0YUxM+TbyFokrnCviTqNg06OtLt0Q6yXqYt9hEzUbZTIkmxPwjI2KDJe5pdr+eZ7jfL79X+u5D2jvl0eZ379jq2PYktEMmZOKP8M7mdsEUYaXE2OguZ5M+lRO5DcvOR2QA72qPTpFut492KzYujRJsK+MGnOmQvl83Y2CVJse5uAtYUw7VWD/335KSUssjgZixJOy1y6+99BP2AJvF+E4J/Woz6yJUmCvMKHhowIE/172ozi29MHLZbF9Dd262Pju36WYZCN26nAS7GIuMdhjQX3uVW6yOZzHa/7potPZdVtAJte/eJjH6t5rEEeoni2atM7c9r80Bks8wUDUed8afABAndoXxbNCurXEYIXj3mg4lw1rdvbmUHrbYDWdgLVYb65quxnEE7UOmmaBeZKXM74JfTnzwejAjop0j5HhepjTr2io5ncFUvmS1pAbxrvthpz+9aUns6grQMz6/oDEOGEfD0eVKnsPNwQ/GFaFljwhvkJq9HP+WEGJJApZNBJGlkYb9qk2pWNIExpadLDo+JSFgqvLHHyIjyqumXIiKxILI+nRqroTrULUcyIvQZI1Y8gcgvmnb39GhGrWGCFQdB4Qg6anhAx4hmK3kO6P3Zc3fwYVbr1EvtZaT2awZ+IDE+Ki/rLwT4KtIoMByWVV6Yv/yGUD7YugE19WblIfO3MEppLGDaW3S5Wff5fZWZg+6csRg1jJah+NJsDLUzIZqrDGnZHwMC2gt+t6BFVisI4JR2gcIzrD8zetb t4pwIZUD WMFxVWQlowQ0zinFiNLj4pTWgJ3kdhtLF2ZhZJ47nESnieSVEDQ3zoAoYKHNoH/uwraSbUYvOu4m+7k+KoSAnI+I6nirWPR86iMjFy9ohAxB34Eb/knQ78VFYNAd5eOMJogvbslhHS03Iat5GqmzRPyl834MoG6jnVaKjk1sTsvvMlf78C8NTzZu35HvBuzrcX9VVnMkMRw28jzbSScUpd1JChH/RbsUkBmXuop74Owje5EjuCZJfyoPipyKl3uDH9pKMbdzGsQyxO33/mRGs/U9Zh5l3aX7Y67PFkp8n+Slf3s/CZV5B4p1c32ZlDK0p5hHD18x6OB5VpNV5D4hCsbjRrMzz/aJm0FZq0smcIb5CES9nUfjm4Xrbw9VsN21D0DhRRXBSUJFs6HfMu6qHFF3s6zSf4TYsVYjPyTgvf6oTVDz2ic2Jhhs66Yoh14x9Qw2Oxv2hKCTsULg= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: After eliminating includes of linux/mm.h, the following build failure occurred: ./include/drm/drm_file.h:443:45: warning: ‘struct poll_table_struct’ declared inside parameter list will not be visible outside of this definition or declaration 443 | __poll_t drm_poll(struct file *filp, struct poll_table_struct *wait); | ^~~~~~~~~~~~~~~~~ In file included from drivers/gpu/drm/imagination/pvr_gem.h:12, from drivers/gpu/drm/imagination/pvr_fw.h:9: ./include/drm/drm_gem.h:447:27: error: initialization of ‘__poll_t (*)(struct file *, struct poll_table_struct *)’ {aka ‘unsigned int (*)(struct file *, struct poll_table_struct *)’} from incompatible pointer type ‘__poll_t (*)(struct file *, struct poll_table_struct *)’ {aka ‘unsigned int (*)(struct file *, struct poll_table_struct *)’} [-Werror=incompatible-pointer-types] 447 | .poll = drm_poll,\ | ^~~~~~~~ The compiler is confused, and that can be fixed easily by forward-declaring the struct expicitly. Signed-off-by: Max Kellermann --- include/drm/drm_file.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/drm/drm_file.h b/include/drm/drm_file.h index ab230d3af138..f24ade9f766f 100644 --- a/include/drm/drm_file.h +++ b/include/drm/drm_file.h @@ -44,6 +44,7 @@ struct drm_device; struct drm_printer; struct device; struct file; +struct poll_table_struct; /* * FIXME: Not sure we want to have drm_minor here in the end, but to avoid From patchwork Tue Jun 4 09:08:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Max Kellermann X-Patchwork-Id: 13684915 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id CB896C25B78 for ; Tue, 4 Jun 2024 09:09:17 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 31A876B0095; Tue, 4 Jun 2024 05:09:13 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 2793E6B0096; Tue, 4 Jun 2024 05:09:13 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0A5D16B0098; Tue, 4 Jun 2024 05:09:13 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id D89856B0095 for ; Tue, 4 Jun 2024 05:09:12 -0400 (EDT) Received: from smtpin02.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 9A731A0981 for ; Tue, 4 Jun 2024 09:09:12 +0000 (UTC) X-FDA: 82192632144.02.A37EBA4 Received: from mail-ej1-f47.google.com (mail-ej1-f47.google.com [209.85.218.47]) by imf20.hostedemail.com (Postfix) with ESMTP id A8EE41C001A for ; Tue, 4 Jun 2024 09:09:10 +0000 (UTC) Authentication-Results: imf20.hostedemail.com; dkim=pass header.d=ionos.com header.s=google header.b=YCnoUSMR; spf=pass (imf20.hostedemail.com: domain of max.kellermann@ionos.com designates 209.85.218.47 as permitted sender) smtp.mailfrom=max.kellermann@ionos.com; dmarc=pass (policy=quarantine) header.from=ionos.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1717492150; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=TwZhGhfqKNwGAAazIH0NZHq5xaKIh/aom8Ka+wD6k0o=; b=v1hul8VC/QsHPeld7n7Bf2/v/2URo3OZNBK17D+vJ9m01fR9q0TO3kPxJrfpfbbmYk8nD3 VvaP8VZJfq+Jdr322NGc0/czdNr+4X+MHKDtSsVpcNH+GUnuSHTYfENNM4/yuYd5i1IKaG PcT4VQPXeD0LNvVwicYu2Hu72juR2Xk= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1717492150; a=rsa-sha256; cv=none; b=xm+dfvoPqwmk2oWE4IAPjNoDmemq8B+qneTZSKfZybo0g9k2loJmLINrSjB0XylFntQYkb 2/TFVSQLhxH3Z6PGc3+zBL3TdHpqF9VF6tJ1okJVoDU1qXJ1URMsGjWVLbJP6Q9hDvHOK7 K+dn9iq4sIaNpuKjcLtqIaTk7al0kOo= ARC-Authentication-Results: i=1; imf20.hostedemail.com; dkim=pass header.d=ionos.com header.s=google header.b=YCnoUSMR; spf=pass (imf20.hostedemail.com: domain of max.kellermann@ionos.com designates 209.85.218.47 as permitted sender) smtp.mailfrom=max.kellermann@ionos.com; dmarc=pass (policy=quarantine) header.from=ionos.com Received: by mail-ej1-f47.google.com with SMTP id a640c23a62f3a-a6341cf2c99so583459466b.0 for ; Tue, 04 Jun 2024 02:09:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ionos.com; s=google; t=1717492149; x=1718096949; darn=kvack.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=TwZhGhfqKNwGAAazIH0NZHq5xaKIh/aom8Ka+wD6k0o=; b=YCnoUSMRU5XfBD8nOTYV7I0gK6C2uAI0Mig1cvYhJbCTd+UcRlCnrqeMdB79l4sJgL AEkPtr9FN/0WBCtcU9S7XxdYYJyM0K1TgO2l8L0o7aFHOozOGXomiOsoGON4EJdvrmh/ p4WecM3Dz4kMxNtT8onZZFgEr2y4nHdhUC2Pz0vQi8yvYvGbBbFKpg8ld4QNz7s3vov/ jCUFhnEy10/iOi87sBdxpmePkCt7Sx9JWHKao6E/c077Q9T4XoubR/s4OxbmXgLfCdr9 jyR89tJe1DAiLF+eP4KqXBI/RCO8ysNI8CdLVtlTT1ZrwiW14DXfn5w4MRwS+n7Rzuhx Ke5g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717492149; x=1718096949; 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=bCkGyZj/QEXBOdm3phARlkn2kk+CBGudNuUtZ3AsyodkYv22ILGZX6qQGrvlPoa5KR bbYiCw2908qeEu6CBKDwmhQGnlOaO64rx90+gni9FWjm1DMprE5RVC6JOVC1qD/9JOZB zlytQQgMIta4wVPHWJg6XehO5Yd2p4txWd/VFYOoqqh0IP6t4SCIUqwRv8Dh9bQY+AmE i+kWBM2XjFOy0I6LBrpqdM0AJF3Gki9GMaVHW01IIysPCmXNAjax2bQc/sZ/OB2Cqydu /djeHelK8zZkiyY0ttET6+sgLuccyi2IX4ZpKaGk3CN71sJ9KgItm53YtaqgSsilwvBj QM+w== X-Forwarded-Encrypted: i=1; AJvYcCWhRlhPVW2XXiL+cXkc+aMjZ9B9/fElm5OAyUz+OQAy3gttGeuX4eCMCsjCnlC4UMFxN2LckKEAvr0JUK5Bit6x2io= X-Gm-Message-State: AOJu0YzM6RrtRQ7mP3tILY7aj33nJsYjK1u6V9dd+l8zNLtGtb0jGOM2 B0lzcdsrJcBzbrmNp6R+BuUfkasThPu6qLOLRbR6vys2BX5y5SUjxtmfSFs/U1c= X-Google-Smtp-Source: AGHT+IHidc0HMkZpoHuW0F0Uuz8Q2jiGIktaIZ3mnWU/29ySDASkCqqcBJVcUe29ebu6h5fIJXGpJA== X-Received: by 2002:a17:906:4bd3:b0:a65:ab25:24da with SMTP id a640c23a62f3a-a681ff4540amr819129466b.22.1717492149299; Tue, 04 Jun 2024 02:09:09 -0700 (PDT) Received: from raven.blarg.de (p200300dc6f4f9200023064fffe740809.dip0.t-ipconnect.de. [2003:dc:6f4f:9200:230:64ff:fe74:809]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a68fa49e66fsm328376766b.129.2024.06.04.02.09.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Jun 2024 02:09:08 -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, david@redhat.com, Max Kellermann Subject: [PATCH v6 03/15] include/scsi/scsicam.h: forward-declare struct block_device Date: Tue, 4 Jun 2024 11:08:33 +0200 Message-Id: <20240604090845.2182265-4-max.kellermann@ionos.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240604090845.2182265-1-max.kellermann@ionos.com> References: <20240604090845.2182265-1-max.kellermann@ionos.com> MIME-Version: 1.0 X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: A8EE41C001A X-Rspam-User: X-Stat-Signature: npg1hwfgnj6rtd4t7ajdgpzpbcga3mq8 X-HE-Tag: 1717492150-338654 X-HE-Meta: U2FsdGVkX1+yt2AcoAwkt4hGIewZvlDIXxAzEtV8uoVu6Gmi3c2aABUm7obipe+Ai2msaY+9DB4sQ1L9jn9az9TZcUkJEN01ps1BNQR1l/XV4n9AzQkSey4WngSn8XZqGDBcudyuXnfULDaZfSAYc9Tx8HpqigNVUzQQhm1PBgjeaKbc5yGKP+erKlowgHS+lpsNkjBead8PNjWKRr4BgUVju0Z8JjV55jHMlA0y121X3f9cQ97ggxApiQL7mVaHFRCkhBrYUUXm2Y3oQ0SO/PMqHjtJbAtzcyHzeXNi1NoPMtS9S+HgAJqWhiEml8KAK3rNOmCR+ydQoubcF30I/x7P22Bk36qK7hkvs+Nqw0rir+UZqRsArac3iq20ljDku0I8CgvUz/EwUjaGdI6gEzpZzlWhQxRDdr5Aak/2OiHi0SRGBlAa0bd51px8QxRhnUZZlQHv9hoInmlZxrqYV8viQ91KMldP0WjedIgDDUjHVJws3m0EnvlAcTpEcZoRrF3TkYVD9PPqfjZ8FMdISm/lsO97JYeQa0uWcoft0r1IBdiDg1Vz6M9bvt4lCJ/tD/8MqpgU5YbHpuWKxeJ9X9cvACaSW62blv2aWivG4Ww3/ccNOWaFymkLpPzKNlvbfMUTcWjY2WfGnIxB6VdUPWI+xFiWBbapjT2Y3GRTxrD1UUmuXHGtwPFzV8vkxE0MEPU5GUGpsuiRplkmOIIzkdVdMoZ/YGJib3pKoWb3Q1Lm7aL0gsQPkULoSi9RCWAKb6Utr61gko8WgtJZ5hZLdWGNjCsJZYhHUgrqb+4/FC/L4eV1R9MF7IEtjqPtoKO29aeV6antf7F+IcWRINlxgdcVYS5vwV1XD+ZCUKqoheVe9YXy5tLFf8k8PuiEejQASBsNhO2gPCyAYiN0YE6ho6SpZN/8ae9yzRhYaFomiF/GAmQXWJqAmy+yhkTu/o8ppssHnqsLqOH3iTuCnB3 wmUqmakI /aofTcys4hH/G6RaBkQuq0AWexqPgt/ZSRN4OYoWjT90iuCP/M9UuHn1j7fUNWfALaVLQYLujCtmQVUBQHyaSwQSfhlQw4std5qhIZpGgheLmoTF5b+otYHrbpVv8jnWz4ux0yGQY3eu3guqm42pHS7sAsZj3lhZ8rrxGgzRLbPTSGIQaf+1hp0tYddTAYv9BPuAJuj37q9+YSWEyHCplrr+itk1XQ1t/Wh239InFknqdzJ1hlEeEh21dawOY5FtCuywChbffjLbA8cXLddAxuWZH3HK8v4Btdpo5uVp4Ei8O4jthlXXhAjE21sUVu7nEMQIHzRbeXqNzaNI55Tcx6fOdxRnUztpVhOZ+TLFqzyYGGRwD+V8/KIL9HnzyjDoTWdodHamufkQiiLk19Kf5PQ3tenKqZfUmBVqev9MceRCM4Bg= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000043, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: After eliminating includes of linux/mm.h, the following build failure occurred: In file included from drivers/scsi/fdomain.c:87: ./include/scsi/scsicam.h:16:31: error: 'struct block_device' declared inside parameter list will not be visible outside of this definition or declaration [-Werror] 16 | int scsicam_bios_param(struct block_device *bdev, sector_t capacity, int *ip); | ^~~~~~~~~~~~ ./include/scsi/scsicam.h:17:27: error: 'struct block_device' declared inside parameter list will not be visible outside of this definition or declaration [-Werror] 17 | bool scsi_partsize(struct block_device *bdev, sector_t capacity, int geom[3]); | ^~~~~~~~~~~~ ./include/scsi/scsicam.h:18:40: error: 'struct block_device' declared inside parameter list will not be visible outside of this definition or declaration [-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_ptable' from incompatible pointer type [-Werror=incompatible-pointer-types] 475 | unsigned char *p = 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 @@ #include // for sector_t +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); From patchwork Tue Jun 4 09:08:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Max Kellermann X-Patchwork-Id: 13684916 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id C98B4C25B7E for ; Tue, 4 Jun 2024 09:09:20 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 5D6EE6B0096; Tue, 4 Jun 2024 05:09:15 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 5860C6B0098; Tue, 4 Jun 2024 05:09:15 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 38D3F6B0099; Tue, 4 Jun 2024 05:09:15 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 167D76B0096 for ; Tue, 4 Jun 2024 05:09:15 -0400 (EDT) Received: from smtpin22.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id BC4A3A17EE for ; Tue, 4 Jun 2024 09:09:14 +0000 (UTC) X-FDA: 82192632228.22.F6ED65D Received: from mail-ed1-f47.google.com (mail-ed1-f47.google.com [209.85.208.47]) by imf25.hostedemail.com (Postfix) with ESMTP id C7D4CA0004 for ; Tue, 4 Jun 2024 09:09:12 +0000 (UTC) Authentication-Results: imf25.hostedemail.com; dkim=pass header.d=ionos.com header.s=google header.b=Lx7hPiFM; dmarc=pass (policy=quarantine) header.from=ionos.com; spf=pass (imf25.hostedemail.com: domain of max.kellermann@ionos.com designates 209.85.208.47 as permitted sender) smtp.mailfrom=max.kellermann@ionos.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1717492152; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=Lu9yS7pQCrsoRi7ZUhn1+G2Y6nFzVt+avQdoI72cAe0=; b=A4ruJMPMM543LJWLLiGVvtNTVQ40+Mkb8JoTwLi4cPCSS75VsJohN3Ys2SvZtEWSVAwcJu bS9wcC9hpfKQn7EGciGR/ngnVmMSh8KDFS1QTHhESJRNKd85LvKu4xK0sX2YbOXNEtG0OQ SxGbU7S8rTQeLsP2oaFTtFHyEVxJC0s= ARC-Authentication-Results: i=1; imf25.hostedemail.com; dkim=pass header.d=ionos.com header.s=google header.b=Lx7hPiFM; dmarc=pass (policy=quarantine) header.from=ionos.com; spf=pass (imf25.hostedemail.com: domain of max.kellermann@ionos.com designates 209.85.208.47 as permitted sender) smtp.mailfrom=max.kellermann@ionos.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1717492152; a=rsa-sha256; cv=none; b=jawfUFJAYuge1ziXxz7Uv7Q1ft0vzL7HquJHlAU3sSBiHdsEBKtOf0Ltr3+wkC16djukBx nCe1ydpVE2wTSLUQihnFzm3vxH6O1wdz2W7CAf0NDpg+JNSV4/czRMLxb5qWFQXygAVlpl laTzOhxx74DerIefx1QbkTau4kzY4OE= Received: by mail-ed1-f47.google.com with SMTP id 4fb4d7f45d1cf-57a677d3d79so2925456a12.1 for ; Tue, 04 Jun 2024 02:09:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ionos.com; s=google; t=1717492151; x=1718096951; darn=kvack.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Lu9yS7pQCrsoRi7ZUhn1+G2Y6nFzVt+avQdoI72cAe0=; b=Lx7hPiFM9tb38XvIYkCazCxaEQpYlG2Or0g91whloVH6F65qfQ6WWq3tlwJl4Zf3Gg aH2odfZLX6izUtd4nojCF9PTOoEvKooyhXz5KePbQ4JXhq+txIuotbo2ryuyLn6B0Ts4 4YTHL2V/AZD5PLe1Tlp6WOfhI5GQdhpioX6zDyxQqxFssCj01xs8NO1xuugcXjoq1hMc +8Woz2UkY8ZXsPXhGYtvSe7sDGkO4OxJ6rTZPIHzb5VNrPs4Zb3bMVFs87mwVB+3Vfza 8Mel+lG1Yz/OtPC/hjAqmTa8DxWi0eIeqaMI2vPzcxsZcMg6YlUVfzO2TSn7+uiugLMS LDrQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717492151; x=1718096951; 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=Lu9yS7pQCrsoRi7ZUhn1+G2Y6nFzVt+avQdoI72cAe0=; b=pN0Bu9IShBHU6PLr7DLbIcnzwRZj19X6uMWPlap+SKO9bVrR10hUsl8tmgFMoN0kZX JvGHaUk0oYD4YqM8Xnvqvp6yNWY1XRt4Q9kk5/o5c1cyXDE6X6ZwSmvAeB0eZiJUp6KU iSvVtn2A8xIwa9EH/NSFrb2nF+NdeaoqyLOLeXJG7AJJErKiGrGd3uU5eNQQ6/eyQXfo IzyynjF5+Jsmt1tcerwi1afymr5rhrUAGpQ5HU/O/OP/EaU784X28tFqQY0vscVERN73 8Ik+Xg016Msljo8I5o8/bznRhblpcARnvd3sCPA50cBIHl/A8pyw9FimORU1xRKclUyq tPPw== X-Forwarded-Encrypted: i=1; AJvYcCWNKlY7hxKR4wWXyot6hgd3EEiILSA2vLHTem2StFEh/1IaP6e9jn14GAvSrk6Uai0T3f97VfOCwWNZeFtnGb12MaQ= X-Gm-Message-State: AOJu0Ywxl9x5t23f0dqOFME22ve75A+6sQ9goOKxj7MTtpDYc9wVYlfo 7Dn/eGvZYqERX8V8yQ5J7XYzibVUq7NT9grPncNoVszY2ajFIcyv3MlAaxWNUKlzbXDyJ5v07D7 pYYg= X-Google-Smtp-Source: AGHT+IFXHmTUY2LAO0CrBslhuc7TrTKlPItnXfEjmCqfLbltfo+OCfR+cziyr/TPphDgOmpCJJexuA== X-Received: by 2002:a17:906:471a:b0:a59:dba0:1544 with SMTP id a640c23a62f3a-a69544242b4mr149880166b.31.1717492151196; Tue, 04 Jun 2024 02:09:11 -0700 (PDT) Received: from raven.blarg.de (p200300dc6f4f9200023064fffe740809.dip0.t-ipconnect.de. [2003:dc:6f4f:9200:230:64ff:fe74:809]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a68fa49e66fsm328376766b.129.2024.06.04.02.09.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Jun 2024 02:09:09 -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, david@redhat.com, Max Kellermann Subject: [PATCH v6 04/15] linux/mm.h: move page_kasan_tag() to mm/page_kasan_tag.h Date: Tue, 4 Jun 2024 11:08:34 +0200 Message-Id: <20240604090845.2182265-5-max.kellermann@ionos.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240604090845.2182265-1-max.kellermann@ionos.com> References: <20240604090845.2182265-1-max.kellermann@ionos.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: C7D4CA0004 X-Stat-Signature: tc69kgoufizqwg9zc1hpm6p94aupeurm X-Rspam-User: X-Rspamd-Server: rspam04 X-HE-Tag: 1717492152-724151 X-HE-Meta: U2FsdGVkX1+f/hppSoBOxUJLvi83TATgwXaHPl6ru3oR8YTftYEH6i3G/01AlPIHqixDmnmw83YLukQzRhNJnWUMVW+3LJRDhbUGHQrSmshH+x+mKlNFWIdKzbP8Bk64BFBcSwE3h+rbKeeHwzqLU9/vE+25mnp9/ZZfNWHg99EAoeXhLxWCTIzl81BW2x9eOXoQgQ8W8VvZ7dw0jbAYGLBCDviHghHMGUFpPF9SMFlIpuRn49EeDloIA6X5X8XaZhMDmfy5yu2trGpUHlYIYMri4M+hdGIo25KRe0Bg90EY7dWqAGF7a1LyeiRstwDrDasZjVrJ+hEhlKrgSnf1YR8VeNyXM/YC1ShRDUIMz+UGKKY98XAsO1QGeaoxQD5lSke3+mYiJB3Km6/pC4/F6yKh2apsSbjAjMNKDvQSYcBuyyjTSPpepZK7Nvl6Pqeeud3b1P0kcDRCtcIi+S7wpqAR9PlKzvLyg/8rHol1uqwybXN7DYJCfFp5tPChJvcHsMiRV45Y23JMJFiQ/1xdgFCdiRFsxzBnafIBcR9YIQLTzqV5nwDiu6B2XGTLurJEaQFIzl8laortfWDmoKyCs9ztHRg+vvkSl211rG9ukPqtrlznPhYjTwvZUUkS1OBuUVsyWMHeRWW5IHTdTajCzXm0AVtOC/UCE6flclR/ObrlEn+anw1wglcetoa3XbYzY9kc097Pdw01tehLtxJ8N4l/ctG0+nCFLeClZ4FouYCzGeWxPdoO9QOUOYAgUSvFDahnCMM6E1uK6muafVEHY9adfGHCIzJ+ZSQJfxtKVYpWpSIziqdnBfzhcxoNIzjrr9XkB32hKgx6m2R8GE75Ntabe6U8kCB5v5oSPUPL2+ebmcFupVeK6R7qI6aOL6mWd04YP3GoCYpmP4Y/Ql1cfjXkg+tIXaCUMAtpj1MwJsYyiZHxQbxonyu8rg7J6TsNYQCztjlNJKMm0xDPIYe 4TtX5iSc 2/Osrh0rbbFG2Imirs8fDewrzkzzc1nD1A7OSNhjjnj4abz+j5g4Nb73SQxXZ8BIbYrrYpOX5xLA/9RKuJ2v3C3M84xOPrlrC8leqQoTndK2Ui51hJZpwcm7LaXlZSg9m39r94KhXRvRchSDA4X8enUFIRV/UhQ7VrhdWT7kITqapNT68h6lrOdQiP8KlYnFq0lcl+/97zonGu+zS12Xl9uXsptpcF8TPfNGuugOeN0BT9WQsSR1A6xcn9f6bds1lAn3EICA0vFiTZcm3u/dH+R9yXTgFzileUjhUPhMjEONP8ngW5Hi3HCaClysKmR3EjuWhjT7/8Kji9jhdeqLp86ero/UBXs/WxXtposiiDPb0xwUy2yjhZpIcGiYtDdyklKOAJLpJ7ru1jVwbrnxntN1TQg7hCdSl9Nzr5kCsuM2/3tE= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: Prepare to reduce dependencies on linux/mm.h. page_kasan_tag() is used by the page_to_virt() macro in ARM64 (but asm/memory.h does not include linux/mm.h). Thus, in order to be able to use anything that calls page_to_virt(), linux/mm.h needs to be included. This would prevent us from moving page_address() to a separate header, because it calls lowmem_page_address() which in turn calls page_to_virt(). To prepare for this move, we move page_kasan_tag() out of linux/mm.h into a separate lean header. A side effect of this patch is that the include line is moved inside the "#ifdef CONFIG_KASAN..." block, i.e. it is not included at all if KASAN is disabled. Signed-off-by: Max Kellermann --- MAINTAINERS | 1 + include/linux/mm.h | 56 +------------------------- include/linux/mm/page_kasan_tag.h | 66 +++++++++++++++++++++++++++++++ 3 files changed, 68 insertions(+), 55 deletions(-) create mode 100644 include/linux/mm/page_kasan_tag.h diff --git a/MAINTAINERS b/MAINTAINERS index bb9f8077b37d..a9459947a3b3 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -14475,6 +14475,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 c41c82bcbec2..3ff239992d4c 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -2,6 +2,7 @@ #ifndef _LINUX_MM_H #define _LINUX_MM_H +#include #include #include #include @@ -28,7 +29,6 @@ #include #include #include -#include #include #include @@ -1812,60 +1812,6 @@ static inline void vma_set_access_pid_bit(struct vm_area_struct *vma) } #endif /* CONFIG_NUMA_BALANCING */ -#if defined(CONFIG_KASAN_SW_TAGS) || defined(CONFIG_KASAN_HW_TAGS) - -/* - * KASAN per-page tags are stored xor'ed with 0xff. This allows to avoid - * setting tags for all pages to native kernel tag value 0xff, as the default - * value 0x00 maps to 0xff. - */ - -static inline u8 page_kasan_tag(const struct page *page) -{ - u8 tag = KASAN_TAG_KERNEL; - - if (kasan_enabled()) { - tag = (page->flags >> KASAN_TAG_PGSHIFT) & KASAN_TAG_MASK; - tag ^= 0xff; - } - - return tag; -} - -static inline void page_kasan_tag_set(struct page *page, u8 tag) -{ - unsigned long old_flags, flags; - - if (!kasan_enabled()) - return; - - tag ^= 0xff; - old_flags = READ_ONCE(page->flags); - do { - flags = old_flags; - flags &= ~(KASAN_TAG_MASK << KASAN_TAG_PGSHIFT); - flags |= (tag & KASAN_TAG_MASK) << KASAN_TAG_PGSHIFT; - } while (unlikely(!try_cmpxchg(&page->flags, &old_flags, flags))); -} - -static inline void page_kasan_tag_reset(struct page *page) -{ - if (kasan_enabled()) - page_kasan_tag_set(page, KASAN_TAG_KERNEL); -} - -#else /* CONFIG_KASAN_SW_TAGS || CONFIG_KASAN_HW_TAGS */ - -static inline u8 page_kasan_tag(const struct page *page) -{ - return 0xff; -} - -static inline void page_kasan_tag_set(struct page *page, u8 tag) { } -static inline void page_kasan_tag_reset(struct page *page) { } - -#endif /* CONFIG_KASAN_SW_TAGS || CONFIG_KASAN_HW_TAGS */ - static inline struct zone *page_zone(const struct page *page) { return &NODE_DATA(page_to_nid(page))->node_zones[page_zonenum(page)]; diff --git a/include/linux/mm/page_kasan_tag.h b/include/linux/mm/page_kasan_tag.h new file mode 100644 index 000000000000..1210c62170a3 --- /dev/null +++ b/include/linux/mm/page_kasan_tag.h @@ -0,0 +1,66 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef _LINUX_MM_PAGE_KASAN_TAG_H +#define _LINUX_MM_PAGE_KASAN_TAG_H + +#include + +struct page; + +#if defined(CONFIG_KASAN_SW_TAGS) || defined(CONFIG_KASAN_HW_TAGS) + +#include +#include // for struct page + +/* + * KASAN per-page tags are stored xor'ed with 0xff. This allows to avoid + * setting tags for all pages to native kernel tag value 0xff, as the default + * value 0x00 maps to 0xff. + */ + +static inline u8 page_kasan_tag(const struct page *page) +{ + u8 tag = KASAN_TAG_KERNEL; + + if (kasan_enabled()) { + tag = (page->flags >> KASAN_TAG_PGSHIFT) & KASAN_TAG_MASK; + tag ^= 0xff; + } + + return tag; +} + +static inline void page_kasan_tag_set(struct page *page, u8 tag) +{ + unsigned long old_flags, flags; + + if (!kasan_enabled()) + return; + + tag ^= 0xff; + old_flags = READ_ONCE(page->flags); + do { + flags = old_flags; + flags &= ~(KASAN_TAG_MASK << KASAN_TAG_PGSHIFT); + flags |= (tag & KASAN_TAG_MASK) << KASAN_TAG_PGSHIFT; + } while (unlikely(!try_cmpxchg(&page->flags, &old_flags, flags))); +} + +static inline void page_kasan_tag_reset(struct page *page) +{ + if (kasan_enabled()) + page_kasan_tag_set(page, KASAN_TAG_KERNEL); +} + +#else /* CONFIG_KASAN_SW_TAGS || CONFIG_KASAN_HW_TAGS */ + +static inline u8 page_kasan_tag(const struct page *page) +{ + return 0xff; +} + +static inline void page_kasan_tag_set(struct page *page, u8 tag) { } +static inline void page_kasan_tag_reset(struct page *page) { } + +#endif /* CONFIG_KASAN_SW_TAGS || CONFIG_KASAN_HW_TAGS */ + +#endif /* _LINUX_MM_PAGE_KASAN_TAG_H */ From patchwork Tue Jun 4 09:08:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Max Kellermann X-Patchwork-Id: 13684917 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 40E0CC25B78 for ; Tue, 4 Jun 2024 09:09:24 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E177F6B0099; Tue, 4 Jun 2024 05:09:16 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D9D556B009A; Tue, 4 Jun 2024 05:09:16 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C18306B009C; Tue, 4 Jun 2024 05:09:16 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id A1FF36B0099 for ; Tue, 4 Jun 2024 05:09:16 -0400 (EDT) Received: from smtpin09.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 16AA3C0AA1 for ; Tue, 4 Jun 2024 09:09:16 +0000 (UTC) X-FDA: 82192632312.09.8CF7CC5 Received: from mail-ej1-f42.google.com (mail-ej1-f42.google.com [209.85.218.42]) by imf12.hostedemail.com (Postfix) with ESMTP id 3AFBF40016 for ; Tue, 4 Jun 2024 09:09:14 +0000 (UTC) Authentication-Results: imf12.hostedemail.com; dkim=pass header.d=ionos.com header.s=google header.b=MD+MFvyt; dmarc=pass (policy=quarantine) header.from=ionos.com; spf=pass (imf12.hostedemail.com: domain of max.kellermann@ionos.com designates 209.85.218.42 as permitted sender) smtp.mailfrom=max.kellermann@ionos.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1717492154; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=5ugwYiQRh7gsSZKM5f9fZEfiERzaZSJH9xrcJo+enM8=; b=hyAxIzcUH1yvTb79DBxcQvlQGImRqnIdLyHviggA1iV0sepegHCr/V6S7hQKm4ovyAaLJn 59gXHziMs+Vhn+1bB86eWetm3Nlr2iQaY41lXF78pRsYmucBkcD9hx1Z0oI6bdh7jl24lk jZK4OSu+k7BwnkwxENbu57y7FqYdEj0= ARC-Authentication-Results: i=1; imf12.hostedemail.com; dkim=pass header.d=ionos.com header.s=google header.b=MD+MFvyt; dmarc=pass (policy=quarantine) header.from=ionos.com; spf=pass (imf12.hostedemail.com: domain of max.kellermann@ionos.com designates 209.85.218.42 as permitted sender) smtp.mailfrom=max.kellermann@ionos.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1717492154; a=rsa-sha256; cv=none; b=Pox+LDbb0yfGICCpLRMndaCOhVlv01fhL37cdT0QN3p58sICeiU+OLppAkyvp+lh8iMIVQ Q2zpTR39YHmy7iyUmMiORUzxpCIctW4oDvh/64+nMqrzjTxCL78Z3U+NRPVyTW4S3YBxn+ ZC56THPvw//dYdW1QvR+U0ziMsFTZWo= Received: by mail-ej1-f42.google.com with SMTP id a640c23a62f3a-a68e7538cfaso285630166b.0 for ; Tue, 04 Jun 2024 02:09:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ionos.com; s=google; t=1717492153; x=1718096953; darn=kvack.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=5ugwYiQRh7gsSZKM5f9fZEfiERzaZSJH9xrcJo+enM8=; b=MD+MFvytsnec1UGl/eVx9PbNw+MfufmEllJ8xHUjHZHrAGH6vpoE5SQKkJTXLIJgCT AJXWWvtVS9W9uKXP7pSniZZcizoIuqXPW/EW4b0TdMXpN7uHaRlggiCE2Ubnl8Av7wW9 jGB/m10J9MmnB+JvyDygsdsacpF9mgP8BEhru1kRVw5a49P2a8Wbq7xEne1EdBaUyOzC GN19f5ewxjPc8L4CyQsT4w6FpOUPTcRdV4SM0AvL1VsDAHnzWK8I4dBELkMQgvYCbEPx 5ZRy1NTHVcvRmlnj6Zm6FD0NfamKhnfWuOpY7eMelNCGKGAnQJ7FY8FRksL2Dc5al+2w aVow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717492153; x=1718096953; 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=5ugwYiQRh7gsSZKM5f9fZEfiERzaZSJH9xrcJo+enM8=; b=Bnzy5tdAUBbWvx2S7a8VZ7/6r1GgGRcqLhOG5BUIYR8RoTvZ9gfvU9X4555Q14/S0v io2ZtVH1F3Y55hs7hdOl8E2Rz6W9XY4pfoquvJ6uD8SHllavkrSfSn8EHTBpPvGh82sA ednLsxaJ+lyWhKE9eXJlAdKyD0kpylgKGZCo/G65/1ruzHnrMDstS7A6GMf0B9UvPIeU jRm3uf4oPnpklxf7ai6hPTTGujkC3tbeAFMfhcsz04n3DDRtKxgYCeLvzaz9a/gZ0Dy/ X3bGBjQGgBV5kluxW3JES0QKbtmKBri/yYtJUDtLu+6dcbsWUcalUV1N8OsN2hEdngb+ ZAbg== X-Forwarded-Encrypted: i=1; AJvYcCWyejtriqO3hwTmb/LqFiJlvRE6dvBblIgr+i+/+X5Q/ffoj2sc7V2cQWIhjJ/hBL4sqAMIHkzN1EkWIWY8z/Li48E= X-Gm-Message-State: AOJu0YxFRa2YlFQllHS5iqkv8WCMC0bOKJTeFH7DUL8CPJELYFwWpXZ7 nq02TZlWk4SZbKgFqfWTgD4W1ANqGh0J0CMX0qwV+fkkmopVbbf5q8kbn2G3z1k4BLNtYFS/DQ/ ayz4= X-Google-Smtp-Source: AGHT+IHuYP1ufnXMMmWaJJ03GHA9WgouemhQpCjHhbIXLQh1XyAq6YAVOglv63VcXHv+oaxWEjtZQA== X-Received: by 2002:a17:907:9725:b0:a68:fafc:659 with SMTP id a640c23a62f3a-a68fafc0807mr430280566b.29.1717492152699; Tue, 04 Jun 2024 02:09:12 -0700 (PDT) Received: from raven.blarg.de (p200300dc6f4f9200023064fffe740809.dip0.t-ipconnect.de. [2003:dc:6f4f:9200:230:64ff:fe74:809]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a68fa49e66fsm328376766b.129.2024.06.04.02.09.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Jun 2024 02:09:11 -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, david@redhat.com, Max Kellermann Subject: [PATCH v6 05/15] linux/mm.h: move section functions to mm/page_section.h Date: Tue, 4 Jun 2024 11:08:35 +0200 Message-Id: <20240604090845.2182265-6-max.kellermann@ionos.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240604090845.2182265-1-max.kellermann@ionos.com> References: <20240604090845.2182265-1-max.kellermann@ionos.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: 3AFBF40016 X-Stat-Signature: b7n4gtfihc4jimgwmnzu9apsnbi8unpa X-Rspam-User: X-Rspamd-Server: rspam04 X-HE-Tag: 1717492154-233213 X-HE-Meta: U2FsdGVkX19/MZd1DVsUQ0lk8Qfo1h17gcOp+oI9gxKPjifsoPsVpg/kK2AYtxCTqa/9utrMSW3TiPQo9/p2S5Rv8vPlMm7H0fXUj2exQRiDrSA7oPsGY9V4Pv8jaqci/64NO+3UvAij7Os2B1oUbXnMTOckIz/+MXc0zL8vlzbdrU2yGHzx2sCWxWs9r5qS/YdyZkWuKUhap+lZ/p/NJ4BeLHn8j997Wn1sq0La1fQCW8Z/70z+ZWtuC0gsbQptoijCPS9+zOLhKqtRh3aiZj88tdjKi+WzA7MUsypMHNbx5kwFMhQ4Bw6Oq2gVbV7L13yv0tvKcpu/V5TguQplGtYlwXrlbDlwIM3Lmr5+ApUoC2BpFQ0ob5OitTxkiE7m3fzsY3eZDPyQ/VJ/IB/XOAaLcBO3I3CO/MBCxXV3hLs4OemlMRYF8V0AnA9z6MG/EbjY7/LHI8bNPq1zvCYDaI6ON2u1r9L1QzTjAYmq32arlT07RcA+j9PfHgUB1EWZ7RdVH6T1Tz6sfNCvCHodH1mxbkg/brMLke8fU/bhcqNQhHoK18w9H/p6NbZHN9ewWreA1xsLIXCwbwSFJUtquodvCDb2HE3eJI8xU1l8Cg0CCC1pjGojamqEiXEGjjfB2wyIUQd5E14Qjq0Kk9oH03741dcvn3lgiiK8v3WS1SJSJaGh6iup4IccFvNVeJLiIyqn2Gad8ncM/bVpFLwnQ/470OaO3xC9Bc3qVGQc62jSxFiubmAwJpw2iaiO2zcDPeW/LqddzrWqrG98PWF4O/R7lr6L9gbWyKiruwctlfbdgZKxak2A6Dk9EDDZ3oF8VGrdNMWofUu0iwYMCZqgQyR729xKn5xa/dC7KwddrW5lQDKXsywveJ+jZGB+jqCkerYq5F31JhHActco28n8l0larv1QrDXVmlVIdiTYZIciHRpXbvCSuc4OEKMzM3ElzKJE2scFERDIYwV2DVk /jWuh6b2 PnR5bd8BtSMIPhxA7KvPklv9NTuwFYbeDJUUwGjfe7jqtUWrZuh4L/Yt/fptCGD3UtWTlqajQMAXle87tQW54/tDZUl1w4PTeUJ2ezGUaY5Oj7EsoBx9Q4QvwHEhmQAygZamXGnJrOsokiyB210veX8ix/mnaW+aOxofDkBk/OxstU5KraH3C6c/uUIC+uR1p3ci9faOUx6GX69Ry6ss0psRyS7N/sFidis+xeV1NNrF8TEGPOOQxMdtI5mNIJm3YGsrxBE2F8sSHGfxmy7+VEMmREwYQuiHo6L25r3Al2wGk60ZQoDyaMjmvyOT6HoCBZmDIvqO3AIxphAqUZxmcdUHP8Cx+P+b+UH/x+I5VWByox2AkTMCcH3YTtgg0/V7HF1cGc272zTPLQ8DLg6SIaNS8vrdlYSyrjtxCbGoDFZYbLzU= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: Prepare to reduce dependencies on linux/mm.h. page_to_section() is used by __page_to_pfn() (but asm-generic/memory_model.h does not include linux/mm.h). Thus, in order to be able to use anything that calls page_to_pfn(), linux/mm.h needs to be included. This would prevent us from moving page_address() to a separate header, because it calls lowmem_page_address() which in turn calls page_to_virt() and then page_to_pfn(). To prepare for this move, we move page_to_section() out of linux/mm.h into a separate lean header. Signed-off-by: Max Kellermann --- include/linux/mm.h | 18 +----------------- include/linux/mm/page_section.h | 23 +++++++++++++++++++++++ 2 files changed, 24 insertions(+), 17 deletions(-) create mode 100644 include/linux/mm/page_section.h diff --git a/include/linux/mm.h b/include/linux/mm.h index 3ff239992d4c..c9a3f1c0ae07 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -3,6 +3,7 @@ #define _LINUX_MM_H #include +#include #include #include #include @@ -1631,10 +1632,6 @@ static inline bool is_nommu_shared_mapping(vm_flags_t flags) } #endif -#if defined(CONFIG_SPARSEMEM) && !defined(CONFIG_SPARSEMEM_VMEMMAP) -#define SECTION_IN_PAGE_FLAGS -#endif - /* * The identification function is mainly used by the buddy allocator for * determining if two pages could be buddies. We are not really identifying @@ -1832,19 +1829,6 @@ static inline pg_data_t *folio_pgdat(const struct folio *folio) return page_pgdat(&folio->page); } -#ifdef SECTION_IN_PAGE_FLAGS -static inline void set_page_section(struct page *page, unsigned long section) -{ - page->flags &= ~(SECTIONS_MASK << SECTIONS_PGSHIFT); - page->flags |= (section & SECTIONS_MASK) << SECTIONS_PGSHIFT; -} - -static inline unsigned long page_to_section(const struct page *page) -{ - return (page->flags >> SECTIONS_PGSHIFT) & SECTIONS_MASK; -} -#endif - /** * folio_pfn - Return the Page Frame Number of a folio. * @folio: The folio. diff --git a/include/linux/mm/page_section.h b/include/linux/mm/page_section.h new file mode 100644 index 000000000000..e4558c2691b8 --- /dev/null +++ b/include/linux/mm/page_section.h @@ -0,0 +1,23 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef _LINUX_MM_PAGE_SECTION_H +#define _LINUX_MM_PAGE_SECTION_H + +#include // for struct page +#include // for SECTIONS_* + +#if defined(CONFIG_SPARSEMEM) && !defined(CONFIG_SPARSEMEM_VMEMMAP) +#define SECTION_IN_PAGE_FLAGS + +static inline void set_page_section(struct page *page, unsigned long section) +{ + page->flags &= ~(SECTIONS_MASK << SECTIONS_PGSHIFT); + page->flags |= (section & SECTIONS_MASK) << SECTIONS_PGSHIFT; +} + +static inline unsigned long page_to_section(const struct page *page) +{ + return (page->flags >> SECTIONS_PGSHIFT) & SECTIONS_MASK; +} +#endif + +#endif /* _LINUX_MM_PAGE_SECTION_H */ From patchwork Tue Jun 4 09:08:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Max Kellermann X-Patchwork-Id: 13684918 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4E2E5C25B78 for ; Tue, 4 Jun 2024 09:09:27 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B0A0F6B009A; Tue, 4 Jun 2024 05:09:17 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id A42AD6B009C; Tue, 4 Jun 2024 05:09:17 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8E3AE6B009F; Tue, 4 Jun 2024 05:09:17 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 69F5B6B009A for ; Tue, 4 Jun 2024 05:09:17 -0400 (EDT) Received: from smtpin09.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 359021A0950 for ; Tue, 4 Jun 2024 09:09:17 +0000 (UTC) X-FDA: 82192632354.09.0144857 Received: from mail-ej1-f45.google.com (mail-ej1-f45.google.com [209.85.218.45]) by imf05.hostedemail.com (Postfix) with ESMTP id 496AA100015 for ; Tue, 4 Jun 2024 09:09:15 +0000 (UTC) Authentication-Results: imf05.hostedemail.com; dkim=pass header.d=ionos.com header.s=google header.b=Gsq0yzUh; spf=pass (imf05.hostedemail.com: domain of max.kellermann@ionos.com designates 209.85.218.45 as permitted sender) smtp.mailfrom=max.kellermann@ionos.com; dmarc=pass (policy=quarantine) header.from=ionos.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1717492155; a=rsa-sha256; cv=none; b=G6Ulwac/wyoJ3ZHZo3oaFrCzxirQxzflakIoZ+ysA/t7+dIqSjPq9qekunexpGRl4X9Tyc veEEYprF2jv5hOS4IvPYhBr1sAueDJhi1glpw5989JtweC/CL2PHYRlRI3ATPRq27lN+sw 1hzaHAtVdS+Ou4XF//apxdrroKSxOKg= ARC-Authentication-Results: i=1; imf05.hostedemail.com; dkim=pass header.d=ionos.com header.s=google header.b=Gsq0yzUh; spf=pass (imf05.hostedemail.com: domain of max.kellermann@ionos.com designates 209.85.218.45 as permitted sender) smtp.mailfrom=max.kellermann@ionos.com; dmarc=pass (policy=quarantine) header.from=ionos.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1717492155; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=oVxAKKIuGzczdMzzJCnaqt6bk9QQZalHnDhl7auSlGA=; b=sTpP5mQVpA9DYDF7MHyH6+eTbgF0nahS1Xtiqz806JbYndtS1xWvTf6Ah9pxPUAy235gn5 Cgw4qXt102YHsBJ0nHtZvwDXFu/YE+ebYfSbDaVNP5lnOx2oEvIlXsqtehfwK5VQwl/498 PMdto2wFm4RpzP46nEBY0sDqxVXFv6k= Received: by mail-ej1-f45.google.com with SMTP id a640c23a62f3a-a691bbb7031so218663566b.1 for ; Tue, 04 Jun 2024 02:09:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ionos.com; s=google; t=1717492154; x=1718096954; darn=kvack.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=oVxAKKIuGzczdMzzJCnaqt6bk9QQZalHnDhl7auSlGA=; b=Gsq0yzUheH43yuwbDVk6S7EWVaR0hi7q2EUKAUdwttJFFnhGpmMJHLegHApWjZIheY WFs0yT46rT5zV0tXybM6vc51Dy4Qkl9MA+CwHaGVsH0hacUeEEAGeflnQM8vzogLiFlh ZuFCGxwTRD1yZ7I1l96hzOEk7rtiKU2PQdH629cGj1hTPBqKJEUPyssErWk5ye27oDUT xdxCrOGb5qV6M9AZ0kskLRccHuUMCI0BZxVcJ+indCm+IMbb33GHw+dUt5H5IY0xPWV6 9VwoM5K9P17HpwWTrzQ+OFhqyOdOfWDghWnOQsQ2qWH7Tv9UCMcUVVDqjc+2w3NXkyQe re3A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717492154; x=1718096954; 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=oVxAKKIuGzczdMzzJCnaqt6bk9QQZalHnDhl7auSlGA=; b=UgGb8BJ/ga3yH54w7gz8HLnSsW/EwfrluUogT4w5fc9y5OI9IDv4JTuAKAKXQeZRAv bmUcx4GoCYied2eCzeielIUgSTiqk865jbBgRV0OR9TSXH7XiFpwQG7g/oMw1fLS+qBu sRSw2fy69RaEAwsr7VitW2eUjR+XRPP0c/cax38lGMdG/GP7PVsJ3jxWwAX6cX5tJgPk TUb+Ft445fPLKNXj9Q8d6rQuWIfKOzpuzO5OTxSo53G3rUPvp7+2t8y3GyFGsBQJVvaL jNK2bBkpR5K9UriKOilZl/k6kDxveK8jwE19WfZ6dp30cxwzSFmrNUHHHsztAvYn4NOX u+zA== X-Forwarded-Encrypted: i=1; AJvYcCWjn+Le52pGrVFREpuhB4XA/rT9ZXNuAFjXzSAmhpP06yFpyB/2WxJ6976g4bpqyyUfasyL+GqJEefU06MK4BRWoDc= X-Gm-Message-State: AOJu0Yx6ae/tUBgOaJux+oq2vxBYgLO47jRM+RimEo2HGJJgiViE/N75 hGWfeubUGhh/lC/cYCndXijNbd2tHzwolCKaAiGivJrW/Jsq0vfyuoTq2WwteAo= X-Google-Smtp-Source: AGHT+IGOgen2Jx0g/YQ6+0A61e2VmACILINzoPWZHBtfeJO66xBbBL4F3Gr+Gh7gEwW1i0zrX6OeUg== X-Received: by 2002:a17:906:c94d:b0:a67:aa2b:1028 with SMTP id a640c23a62f3a-a681fc5cbccmr901709666b.8.1717492153798; Tue, 04 Jun 2024 02:09:13 -0700 (PDT) Received: from raven.blarg.de (p200300dc6f4f9200023064fffe740809.dip0.t-ipconnect.de. [2003:dc:6f4f:9200:230:64ff:fe74:809]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a68fa49e66fsm328376766b.129.2024.06.04.02.09.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Jun 2024 02:09:13 -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, david@redhat.com, Max Kellermann Subject: [PATCH v6 06/15] linux/mm.h: move page_address() and others to mm/page_address.h Date: Tue, 4 Jun 2024 11:08:36 +0200 Message-Id: <20240604090845.2182265-7-max.kellermann@ionos.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240604090845.2182265-1-max.kellermann@ionos.com> References: <20240604090845.2182265-1-max.kellermann@ionos.com> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: 496AA100015 X-Stat-Signature: csyi983hmxwafzjdqf7wdo4rp8fky3oc X-HE-Tag: 1717492155-948409 X-HE-Meta: U2FsdGVkX1+RclLaSxo4jYgDOhy0BoAKWNI0Rs3cFGEAugU54c/lOSVRV13FCmZUXkueC//bKklcroKAkRGyptiuas3z2W9MhETF67Rl79snz2k3MLMw1cJWUWKL0x2mUniLdVD1u79cTz2JFJqAqBFdmeQuNX9y5Yx1NJ94JN5gfHJDTwZbgko5CXd9U2fHu6QJj3NV1uvE/Ozzu3E0wZhZEgQ6MbUsVDxMSiCyCpvRAxkN/WddS9NCOMXjY3NK2ZUD9+y4UvotfrciWXQS7A24oK+my26O2RE9HU4FkhiYiqPUKWl7dITxS5WNYmzjYlKmLSWYCqL4Xyn3iOQmhqA0gWOAAWrcjt2Q5k45yio2OxVe+sz0gM5YGrkwOnutozWi98ymCUMENm2jzIDNpy5nMIcA0fesCEqZPVABSMY6OLGUgHMfJz9k3Qm7Mpxw0OUFUCQqrxWDEdqLKW8kB0hW0WgHQMLv8HdIJzfmYgmxR7G+VDqsZpIYb9oRXXpui4TQZDr3DU048T4r79c6urIIn0utnikrsnZ+oYpLHKSHIqGi5OgaN2+JkYY8xR/JXCkkmFRwRZ+5JdMPccmTM1tEEcIn5os8aRXjs2ZrlTRLs5dQf21JcR2V0P/wpCG7Sn3RuUwYrRmy6APKAKFsCJdvJ2l+MFAF0/2iciwKMcLFkdEvEL3UqGysFW9HfvFIUwgj9W4T5SumjYtFtUsO7ZObPmOZVBOE37bhnFL0JfYnbhzLrclhaTdUK+a8IM94NmEUv+zaTrBQN73ruhi3RdBDD/HOZyQ3yAETfXIxfUJODwSbVvsXrZMBm6qpcW7JVTwkr1HPlPcq/RBItS98RTOUch29IrlUL3wPxm2CuKiG3YQdMGsh75fd0nz9ePizPJHRGfut5XWiQmdZ7s7gCeAB88u489V1MOZs11s9SxJ11jfPeaydc0p5h3hGDEOD69xzwrEt2JB0iI5lsES VWT5Gw2/ DmSAo8UxBNovyhuRAUwQoL4x2jwejYXjXxtX255pJ7vxqAIcw0ycVZMI9XiXW9XmVDkV9/SizAa3H/PFYasY7pcVW4bumxll3H9fNqUQMKjk52Ohn/QhWXrzTB63AU/PO9NAMu70y4i4Q+5fsXYGCtJpOFqqtNzh3ZZUHHeQ4/c1lF9QjgsuPGO6gWU86GoPH14xNSbAqQ8dx/oAZFLMrP2EIPhutFnJ6NVT242qpmQQThZmZsXZTL3lz7itKg+K72s/RdbgtsPEBg8/ZH3puDf5LsnSKDs0ZjPx45mSEd/Xajs+Q3/Fg78m9w6nKRhphmbanGb75WUmFj8FXqGBdAH8vLgpLKVlFBaxLqO0bP0Vb4bdtqQdnarA7YKT6P3WCT5XYplLhUCNALRtSn3F9xLiwIvCEoYLeUhcN7grmknMh140= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: Prepare to reduce dependencies on linux/mm.h. page_address() is used by the following popular headers: - linux/bio.h - linux/bvec.h - linux/highmem.h - linux/scatterlist.h - linux/skbuff.h Moving it to a separate lean header will allow us to avoid the dependency on linux/mm.h. Signed-off-by: Max Kellermann --- include/linux/mm.h | 56 +------------------------- include/linux/mm/page_address.h | 71 +++++++++++++++++++++++++++++++++ 2 files changed, 72 insertions(+), 55 deletions(-) create mode 100644 include/linux/mm/page_address.h diff --git a/include/linux/mm.h b/include/linux/mm.h index c9a3f1c0ae07..014db2b39c16 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -2,7 +2,7 @@ #ifndef _LINUX_MM_H #define _LINUX_MM_H -#include +#include #include #include #include @@ -105,10 +105,6 @@ extern int mmap_rnd_compat_bits __read_mostly; #define __pa_symbol(x) __pa(RELOC_HIDE((unsigned long)(x), 0)) #endif -#ifndef page_to_virt -#define page_to_virt(x) __va(PFN_PHYS(page_to_pfn(x))) -#endif - #ifndef lm_alias #define lm_alias(x) __va(__pa_symbol(x)) #endif @@ -212,14 +208,6 @@ int overcommit_kbytes_handler(struct ctl_table *, int, void *, size_t *, int overcommit_policy_handler(struct ctl_table *, int, void *, size_t *, loff_t *); -#if defined(CONFIG_SPARSEMEM) && !defined(CONFIG_SPARSEMEM_VMEMMAP) -#define nth_page(page,n) pfn_to_page(page_to_pfn((page)) + (n)) -#define folio_page_idx(folio, p) (page_to_pfn(p) - folio_pfn(folio)) -#else -#define nth_page(page,n) ((page) + (n)) -#define folio_page_idx(folio, p) ((p) - &(folio)->page) -#endif - /* to align the pointer to the (next) page boundary */ #define PAGE_ALIGN(addr) ALIGN(addr, PAGE_SIZE) @@ -2174,44 +2162,6 @@ static inline int arch_make_folio_accessible(struct folio *folio) */ #include -#if defined(CONFIG_HIGHMEM) && !defined(WANT_PAGE_VIRTUAL) -#define HASHED_PAGE_VIRTUAL -#endif - -#if defined(WANT_PAGE_VIRTUAL) -static inline void *page_address(const struct page *page) -{ - return page->virtual; -} -static inline void set_page_address(struct page *page, void *address) -{ - page->virtual = address; -} -#define page_address_init() do { } while(0) -#endif - -#if defined(HASHED_PAGE_VIRTUAL) -void *page_address(const struct page *page); -void set_page_address(struct page *page, void *virtual); -void page_address_init(void); -#endif - -static __always_inline void *lowmem_page_address(const struct page *page) -{ - return page_to_virt(page); -} - -#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); -} - /* * Return true only if the page has been allocated with * ALLOC_NO_WATERMARKS and the low watermark was not @@ -2261,10 +2211,6 @@ static inline void clear_page_pfmemalloc(struct page *page) */ extern void pagefault_out_of_memory(void); -#define offset_in_page(p) ((unsigned long)(p) & ~PAGE_MASK) -#define offset_in_thp(page, p) ((unsigned long)(p) & (thp_size(page) - 1)) -#define offset_in_folio(folio, p) ((unsigned long)(p) & (folio_size(folio) - 1)) - /* * Parameter block passed down to zap_pte_range in exceptional cases. */ diff --git a/include/linux/mm/page_address.h b/include/linux/mm/page_address.h new file mode 100644 index 000000000000..630fc4e2be95 --- /dev/null +++ b/include/linux/mm/page_address.h @@ -0,0 +1,71 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef _LINUX_MM_PAGE_ADDRESS_H +#define _LINUX_MM_PAGE_ADDRESS_H + +#include // for struct page +#include // needed by the page_to_virt() macro on some architectures (e.g. arm64) +#include // for PAGE_MASK, page_to_virt() + +#if defined(CONFIG_FLATMEM) +#include // for memmap (used by __pfn_to_page()) +#elif defined(CONFIG_SPARSEMEM_VMEMMAP) +#include // for vmemmap (used by __pfn_to_page()) +#elif defined(CONFIG_SPARSEMEM) +#include // for page_to_section() (used by __page_to_pfn()) +#endif + +#ifndef page_to_virt +#define page_to_virt(x) __va(PFN_PHYS(page_to_pfn(x))) +#endif + +#if defined(CONFIG_SPARSEMEM) && !defined(CONFIG_SPARSEMEM_VMEMMAP) +#define nth_page(page,n) pfn_to_page(page_to_pfn((page)) + (n)) +#define folio_page_idx(folio, p) (page_to_pfn(p) - folio_pfn(folio)) +#else +#define nth_page(page,n) ((page) + (n)) +#define folio_page_idx(folio, p) ((p) - &(folio)->page) +#endif + +#if defined(CONFIG_HIGHMEM) && !defined(WANT_PAGE_VIRTUAL) +#define HASHED_PAGE_VIRTUAL +#endif + +#if defined(WANT_PAGE_VIRTUAL) +static inline void *page_address(const struct page *page) +{ + return page->virtual; +} +static inline void set_page_address(struct page *page, void *address) +{ + page->virtual = address; +} +#define page_address_init() do { } while(0) +#endif + +#if defined(HASHED_PAGE_VIRTUAL) +void *page_address(const struct page *page); +void set_page_address(struct page *page, void *virtual); +void page_address_init(void); +#endif + +static __always_inline void *lowmem_page_address(const struct page *page) +{ + return page_to_virt(page); +} + +#if !defined(HASHED_PAGE_VIRTUAL) && !defined(WANT_PAGE_VIRTUAL) +#define page_address(page) lowmem_page_address(page) +#define set_page_address(page, address) do { } while(0) +#define page_address_init() do { } while(0) +#endif + +static inline void *folio_address(const struct folio *folio) +{ + return page_address(&folio->page); +} + +#define offset_in_page(p) ((unsigned long)(p) & ~PAGE_MASK) +#define offset_in_thp(page, p) ((unsigned long)(p) & (thp_size(page) - 1)) +#define offset_in_folio(folio, p) ((unsigned long)(p) & (folio_size(folio) - 1)) + +#endif /* _LINUX_MM_PAGE_ADDRESS_H */ From patchwork Tue Jun 4 09:08:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Max Kellermann X-Patchwork-Id: 13684919 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id C1618C25B78 for ; Tue, 4 Jun 2024 09:09:30 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 22FF26B009F; Tue, 4 Jun 2024 05:09:19 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 1DCEE6B00A1; Tue, 4 Jun 2024 05:09:19 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id EB1076B00A0; Tue, 4 Jun 2024 05:09:18 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id CB27C6B009C for ; Tue, 4 Jun 2024 05:09:18 -0400 (EDT) Received: from smtpin28.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 8B2ABA0429 for ; Tue, 4 Jun 2024 09:09:18 +0000 (UTC) X-FDA: 82192632396.28.E1EC956 Received: from mail-ed1-f48.google.com (mail-ed1-f48.google.com [209.85.208.48]) by imf25.hostedemail.com (Postfix) with ESMTP id 9CF8FA000A for ; Tue, 4 Jun 2024 09:09:16 +0000 (UTC) Authentication-Results: imf25.hostedemail.com; dkim=pass header.d=ionos.com header.s=google header.b=YZKGsk12; spf=pass (imf25.hostedemail.com: domain of max.kellermann@ionos.com designates 209.85.208.48 as permitted sender) smtp.mailfrom=max.kellermann@ionos.com; dmarc=pass (policy=quarantine) header.from=ionos.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1717492156; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=LGA97Ct+cPd+7V/cTW+dx47R1ZSFkzyCh6qF0w1u/vk=; b=XlE7tmh/xkvcRTZAy9bALYFfFTYJFyljK8bdFz+3QW0orm18ExmVAndcma3TM4P1Z+c92/ hqN7UA8uaEK3ENxFqkJCZToI7pNnPlVPfUZxXGZC6Z1lEfeXrk4ejtB8bCZdGyLrlTE6Ok Q4ch80JeYO6oT70teyIqU6a0+o9JM6I= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1717492156; a=rsa-sha256; cv=none; b=DhlVfU2wAXzqUkLrQs5P8yeIU2+TMaWR9Mxlip3uAoc80IWGL01ofw1JyCNBZkdG2QtEIe cQL//2swmsGYdXhFjw/ZNpTL2Xt/nIxNuQmqpx9YrR4xe+rO/rafbjch+TE7TQ81ufTfjd fzjO4l/sXXrYsvjzG5uChWmYNbKus00= ARC-Authentication-Results: i=1; imf25.hostedemail.com; dkim=pass header.d=ionos.com header.s=google header.b=YZKGsk12; spf=pass (imf25.hostedemail.com: domain of max.kellermann@ionos.com designates 209.85.208.48 as permitted sender) smtp.mailfrom=max.kellermann@ionos.com; dmarc=pass (policy=quarantine) header.from=ionos.com Received: by mail-ed1-f48.google.com with SMTP id 4fb4d7f45d1cf-57a1fe6392eso6069684a12.0 for ; Tue, 04 Jun 2024 02:09:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ionos.com; s=google; t=1717492155; x=1718096955; darn=kvack.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=LGA97Ct+cPd+7V/cTW+dx47R1ZSFkzyCh6qF0w1u/vk=; b=YZKGsk12FCd2iweR7moqgXmnQSORo7YPTLo95KCB2SSIvpq2t+FEgFJtkMu83I487O THluunTPmyRvpQWOXDtigzRuI+JbXESY/ijaYIjgsCf8nDSas9BYq6iN4TxKJ+2c+OS9 bobv/cYrDOSPer1Qyat6oNN3ttrE5ASHvfJqO3Iq8/lFICKy71lsmpGnJm8ImH9qeRYe Uf37n4p2NviM7DSZDo9GZBEiHL0JVMW/59oyAecWvTUtcvoJqMn8zXa5vXw5u3FRB1VO 4Y9Jkb++TclTd4vOFFsIpS/aZPyMMQ5mkoG+9ImVVVupSSF51uAeFM+EfzpKVDvHCbsE N+xQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717492155; x=1718096955; 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=LGA97Ct+cPd+7V/cTW+dx47R1ZSFkzyCh6qF0w1u/vk=; b=OqnTlXg/967RuGPsoqqZC0aDZnBUY/nHdVqTO3PHD1XMZFBXTOL+f0JLHGlgTaydWQ Q5FlvualZFYkr45fcgsgMgvUH78BxSBGOgvuNDTbhFSsfUTh+lm51RCDd/Cyr3YLE9CA RHlrbEZuO1pGr7ptz+O74XwS6iXXypXP7B1LcKNzplOB85PvSRyNUY+/AzJZEskTczSb CNl/KHZ0MAcnMHde8gQ8dS4+XsUXHo2BAAJwU9l5WWxEyirDxOPfggOXYAVNQCbYrf9a P0VZccQiuKmQPRtKJUADA7azFbN3jMX6Cozj/vCCBucdxAGHBSBd/BADpI1fWCJR9qcD vYEQ== X-Forwarded-Encrypted: i=1; AJvYcCUYYLoKgWwoR/XYmxHrtpqme8/+4byAdb40nLGILAf9CFMOZlVJPWMF/KeckGosXV/XkFGdIZstqSfOkRIk/ga/q0I= X-Gm-Message-State: AOJu0YxC4antk7IIPqOe3joDwW8dm3xBwM5Q64pfQ6qku2vm6o3QoSCm QLnKMFxvGwOKPKIRC5w+EupU7tqGjDmXO48LX7mzAXnQXs5D13aV1wxB3aFNH36kmYDeqHZz386 HjvY= X-Google-Smtp-Source: AGHT+IEsb+sDgUGZexqUFY3hraRHpEBznY4zG62l35w3uux2zbvBuWOtU9Ps2+jctDU3Yl2qZVDwFQ== X-Received: by 2002:a17:907:516:b0:a59:b88c:2b2a with SMTP id a640c23a62f3a-a6821b71cdemr586561966b.50.1717492155201; Tue, 04 Jun 2024 02:09:15 -0700 (PDT) Received: from raven.blarg.de (p200300dc6f4f9200023064fffe740809.dip0.t-ipconnect.de. [2003:dc:6f4f:9200:230:64ff:fe74:809]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a68fa49e66fsm328376766b.129.2024.06.04.02.09.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Jun 2024 02:09:14 -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, david@redhat.com, Max Kellermann Subject: [PATCH v6 07/15] linux/mm.h: move folio_size(), ... to mm/folio_size.h Date: Tue, 4 Jun 2024 11:08:37 +0200 Message-Id: <20240604090845.2182265-8-max.kellermann@ionos.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240604090845.2182265-1-max.kellermann@ionos.com> References: <20240604090845.2182265-1-max.kellermann@ionos.com> MIME-Version: 1.0 X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: 9CF8FA000A X-Rspam-User: X-Stat-Signature: b6x4x8zwwpieds58usij8f5twbso3a5j X-HE-Tag: 1717492156-37669 X-HE-Meta: U2FsdGVkX1/F/4gPFba8W5LzzN1UaFBvyp0BdHIOsOKgfNnk/ywENg25POgdXr8b80TKV500TfwnUvGvlZT4K92kTk+Yp7carVhkrEeX5/xa4vJYiV4j8B4l35fn3O+LCrfke5TKShlt0rORWJjjPV7A/+KrNidPQP5oMRpkHtSvyujGjB/w3hj2G3gAUlHra6uIbe3yMFWUP6lwzTa6SjaZadlb3vv90wR64mUUWmRSp17eijZEB0iu5PgWWB8G+4ScXvY1DhF+xbN8C3/jQ80nx2TOr8PxAtDePnAaI3oddHrk5HnjXPpmCCo/9ju5tdnSRhuzm5/gRVXsseIBWUIAcWVm4q41MKUFj/27m6+fFXmKCftY6KSH4+CjlTwqU4uWO9O55MThnpjDdNurmn0RZ/HEuJF8R2xbVt7MOZh50v8bsZbnqL63ya+/ucULbNDIg9ECKPSwxhJ/Cnl9K6O8m6YwqqE8VDhoXpRO1+4xQHmd+Qrr2u5LJlNxNZHwZSd9iiRAO7X46x2b0HT49rLO1cW3IrKPh2FnNV8K3jy/quZeSqZsnStb7AODWFyeb0A0HpZvmj7N7NkwZQ5jgg9eCbjesJM5ycOhX6KN+wvzJYxYTcdDUFNquticdN6iouFGxoESVod+6WZhfOj4lTJvq0d+AojXKQXRtkpa/4j0ttxzbrDv7sF9lJDN1foG9rV9MJ5/+bXDDZuW7ZJ6iCZOu7i+0QKy6sHg5gUm/AhWuyfr41VKLbgOAgBajvAsOZYt1Cb55ojhto2J8cEyteBN34Rox76qJFSy0XXiWWMjvKXQvV1QAGEktT7rI3ckVDLGRrn/4n2wHlBnfEVAxTRYbAZHxvTcT4sa5FJVCG84zmSI5FE+R2x5/GaHDPiB8AyG+JeYtyIMOJC77uo8HG22MqDMLtIs1PKH8cmLeZse5g38hZqfNu6khzKVa9aI43JaaYGc9xJVMf9ba7H ZyBFACuT dSz1xM31jtRRozTsEiCnyTuqIHnnbTjcAH4FB5q2P+lGB2rQAsRs1T3TurFIRrR+mw4fMxhvh7kiiBYdpx5i9ZBJ3SSx+HvdJT2Y+51BXqpBGT8UduNbo7LhLT4c05Uts3OZhu4UQwTMW5kNdCnM/6RHTarNQy61SFZZzJ/FHr0Q/HZ4yKVOEwfhHNfnYzWmjwJEPaFBwGDPCi8qI+RgLisi6drO1o3z9mb+r8aEH17pRMc/nCQlul0HL1+NGxypuvv0uB+SHcbIiCaX3GquYNsKMD5l8zEF4HO2Pw1qrZDL14tnkVg5T4vT+W9taJWhLlD0eVSw7kkqZvkMUfq4HKMLeSXbSafoId3PRamn1MNTxqHaVOF3kH+v2vL+ShnXk/MrIe7KZwkMqCqGvV6OergNe6w8I9TUZK7a+HJQleg05nWA= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: Prepare to reduce dependencies on linux/mm.h. folio_size()/page_size() are used by the following popular headers: - linux/highmem.h - linux/iov_iter.h - linux/pagemap.h Moving them to a separate lean header will allow us to avoid the dependency on linux/mm.h. Additionally, it allows us to move folio_next() to a separate header, because it needs folio_nr_pages() which is also moved to folio_size.h. Signed-off-by: Max Kellermann --- include/linux/mm.h | 140 +------------------------------ include/linux/mm/folio_size.h | 150 ++++++++++++++++++++++++++++++++++ 2 files changed, 151 insertions(+), 139 deletions(-) create mode 100644 include/linux/mm/folio_size.h diff --git a/include/linux/mm.h b/include/linux/mm.h index 014db2b39c16..b11bbbdd2754 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -2,6 +2,7 @@ #ifndef _LINUX_MM_H #define _LINUX_MM_H +#include #include #include #include @@ -1069,38 +1070,6 @@ int vma_is_stack_for_current(struct vm_area_struct *vma); struct mmu_gather; struct inode; -/* - * compound_order() can be called without holding a reference, which means - * that niceties like page_folio() don't work. These callers should be - * prepared to handle wild return values. For example, PG_head may be - * set before the order is initialised, or this may be a tail page. - * See compaction.c for some good examples. - */ -static inline unsigned int compound_order(struct page *page) -{ - struct folio *folio = (struct folio *)page; - - if (!test_bit(PG_head, &folio->flags)) - return 0; - return folio->_flags_1 & 0xff; -} - -/** - * folio_order - The allocation order of a folio. - * @folio: The folio. - * - * A folio is composed of 2^order pages. See get_order() for the definition - * of order. - * - * Return: The order of the folio. - */ -static inline unsigned int folio_order(struct folio *folio) -{ - if (!folio_test_large(folio)) - return 0; - return folio->_flags_1 & 0xff; -} - #include /* @@ -1303,39 +1272,6 @@ void folio_copy(struct folio *dst, struct folio *src); unsigned long nr_free_buffer_pages(void); -/* 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 @@ -1973,23 +1909,6 @@ static inline void set_page_links(struct page *page, enum zone_type zone, #endif } -/** - * folio_nr_pages - The number of pages in the folio. - * @folio: The folio. - * - * Return: A positive power of two. - */ -static inline long folio_nr_pages(const 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) @@ -1997,33 +1916,6 @@ static inline long folio_nr_pages(const struct folio *folio) #define MAX_FOLIO_NR_PAGES MAX_ORDER_NR_PAGES #endif -/* - * compound_nr() returns the number of pages in this potentially compound - * page. compound_nr() can be called on a tail page, and is defined to - * return 1 in that case. - */ -static inline unsigned long compound_nr(struct page *page) -{ - struct folio *folio = (struct folio *)page; - - if (!test_bit(PG_head, &folio->flags)) - return 1; -#ifdef CONFIG_64BIT - return folio->_folio_nr_pages; -#else - return 1L << (folio->_flags_1 & 0xff); -#endif -} - -/** - * thp_nr_pages - The number of regular pages in this huge page. - * @page: The head page of a huge page. - */ -static inline int thp_nr_pages(struct page *page) -{ - return folio_nr_pages((struct folio *)page); -} - /** * folio_next - Move to the next physical folio. * @folio: The folio we're currently operating on. @@ -2043,36 +1935,6 @@ static inline struct folio *folio_next(struct folio *folio) return (struct folio *)folio_page(folio, folio_nr_pages(folio)); } -/** - * folio_shift - The size of the memory described by this folio. - * @folio: The folio. - * - * A folio represents a number of bytes which is a power-of-two in size. - * This function tells you which power-of-two the folio is. See also - * folio_size() and folio_order(). - * - * Context: The caller should have a reference on the folio to prevent - * it from being split. It is not necessary for the folio to be locked. - * Return: The base-2 logarithm of the size of this folio. - */ -static inline unsigned int folio_shift(struct folio *folio) -{ - return PAGE_SHIFT + folio_order(folio); -} - -/** - * folio_size - The number of bytes in a folio. - * @folio: The folio. - * - * Context: The caller should have a reference on the folio to prevent - * it from being split. It is not necessary for the folio to be locked. - * Return: The number of bytes in this folio. - */ -static inline size_t folio_size(struct folio *folio) -{ - return PAGE_SIZE << folio_order(folio); -} - /** * folio_likely_mapped_shared - Estimate if the folio is mapped into the page * tables of more than one MM diff --git a/include/linux/mm/folio_size.h b/include/linux/mm/folio_size.h new file mode 100644 index 000000000000..e7cd567cf069 --- /dev/null +++ b/include/linux/mm/folio_size.h @@ -0,0 +1,150 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef _LINUX_MM_FOLIO_SIZE_H +#define _LINUX_MM_FOLIO_SIZE_H + +#include // for test_bit() +#include // for VM_BUG_ON_PGFLAGS() +#include // for struct page +#include // for folio_test_large() +#include // for PAGE_SIZE, PAGE_SHIFT + +/* + * compound_order() can be called without holding a reference, which means + * that niceties like page_folio() don't work. These callers should be + * prepared to handle wild return values. For example, PG_head may be + * set before the order is initialised, or this may be a tail page. + * See compaction.c for some good examples. + */ +static inline unsigned int compound_order(struct page *page) +{ + struct folio *folio = (struct folio *)page; + + if (!test_bit(PG_head, &folio->flags)) + return 0; + return folio->_flags_1 & 0xff; +} + +/** + * folio_order - The allocation order of a folio. + * @folio: The folio. + * + * A folio is composed of 2^order pages. See get_order() for the definition + * of order. + * + * Return: The order of the folio. + */ +static inline unsigned int folio_order(struct folio *folio) +{ + if (!folio_test_large(folio)) + return 0; + return folio->_flags_1 & 0xff; +} + +/* Returns the number of bytes in this potentially compound page. */ +static inline unsigned long page_size(struct page *page) +{ + return PAGE_SIZE << compound_order(page); +} + +/* Returns the number of bits needed for the number of bytes in a page */ +static inline unsigned int page_shift(struct page *page) +{ + return PAGE_SHIFT + compound_order(page); +} + +/** + * thp_order - Order of a transparent huge page. + * @page: Head page of a transparent huge page. + */ +static inline unsigned int thp_order(struct page *page) +{ + VM_BUG_ON_PGFLAGS(PageTail(page), page); + return compound_order(page); +} + +/** + * thp_size - Size of a transparent huge page. + * @page: Head page of a transparent huge page. + * + * Return: Number of bytes in this page. + */ +static inline unsigned long thp_size(struct page *page) +{ + return PAGE_SIZE << thp_order(page); +} + +/** + * folio_nr_pages - The number of pages in the folio. + * @folio: The folio. + * + * Return: A positive power of two. + */ +static inline long folio_nr_pages(const struct folio *folio) +{ + if (!folio_test_large(folio)) + return 1; +#ifdef CONFIG_64BIT + return folio->_folio_nr_pages; +#else + return 1L << (folio->_flags_1 & 0xff); +#endif +} + +/* + * compound_nr() returns the number of pages in this potentially compound + * page. compound_nr() can be called on a tail page, and is defined to + * return 1 in that case. + */ +static inline unsigned long compound_nr(struct page *page) +{ + struct folio *folio = (struct folio *)page; + + if (!test_bit(PG_head, &folio->flags)) + return 1; +#ifdef CONFIG_64BIT + return folio->_folio_nr_pages; +#else + return 1L << (folio->_flags_1 & 0xff); +#endif +} + +/** + * thp_nr_pages - The number of regular pages in this huge page. + * @page: The head page of a huge page. + */ +static inline int thp_nr_pages(struct page *page) +{ + return folio_nr_pages((struct folio *)page); +} + +/** + * folio_shift - The size of the memory described by this folio. + * @folio: The folio. + * + * A folio represents a number of bytes which is a power-of-two in size. + * This function tells you which power-of-two the folio is. See also + * folio_size() and folio_order(). + * + * Context: The caller should have a reference on the folio to prevent + * it from being split. It is not necessary for the folio to be locked. + * Return: The base-2 logarithm of the size of this folio. + */ +static inline unsigned int folio_shift(struct folio *folio) +{ + return PAGE_SHIFT + folio_order(folio); +} + +/** + * folio_size - The number of bytes in a folio. + * @folio: The folio. + * + * Context: The caller should have a reference on the folio to prevent + * it from being split. It is not necessary for the folio to be locked. + * Return: The number of bytes in this folio. + */ +static inline size_t folio_size(struct folio *folio) +{ + return PAGE_SIZE << folio_order(folio); +} + +#endif /* _LINUX_MM_FOLIO_SIZE_H_H */ From patchwork Tue Jun 4 09:08:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Max Kellermann X-Patchwork-Id: 13684920 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6522CC27C50 for ; Tue, 4 Jun 2024 09:09:34 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 4EE266B00A0; Tue, 4 Jun 2024 05:09:20 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 49BEF6B00A1; Tue, 4 Jun 2024 05:09:20 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 314E46B00A2; Tue, 4 Jun 2024 05:09:20 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 10ABC6B00A0 for ; Tue, 4 Jun 2024 05:09:20 -0400 (EDT) Received: from smtpin03.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id C8956A0968 for ; Tue, 4 Jun 2024 09:09:19 +0000 (UTC) X-FDA: 82192632438.03.93FEB0A Received: from mail-ed1-f54.google.com (mail-ed1-f54.google.com [209.85.208.54]) by imf11.hostedemail.com (Postfix) with ESMTP id E6B3F40010 for ; Tue, 4 Jun 2024 09:09:17 +0000 (UTC) Authentication-Results: imf11.hostedemail.com; dkim=pass header.d=ionos.com header.s=google header.b=AX5pF3Xy; spf=pass (imf11.hostedemail.com: domain of max.kellermann@ionos.com designates 209.85.208.54 as permitted sender) smtp.mailfrom=max.kellermann@ionos.com; dmarc=pass (policy=quarantine) header.from=ionos.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1717492158; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=qOL4vXuZ0a4PoiG22TiWEmdORRFE9U+5xK6xKS6y2zU=; b=rUne1t5747jRQh5+vd+91XL47n9VZxQhMrOpwji8cOcfrvPuqSvH+nBIczl2tvhQ2Z/DQ+ bHLzmj4ZbyvXy63d7Yi9xrIyd0LHYaL8hp1IrU8EYmaCB5PkSVLVZQLdCfDNw7wRXUey2w KRC9WTvqQEouAk2jzi6lOoxB6TWsyNI= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1717492158; a=rsa-sha256; cv=none; b=HMReo6J/Ig8Bwr4iMwRhiaMZ1Hq9o2XCS2qRrOcAVXQWE/66tHJRnEHybljfX92q+44gjU T+uMMRij/XtEY1C1LGP5vpGFqQdsoV5na5Ko7+w3d9cVmknBFwSYeKbsmcA1FvmOhMDgAP aQyGdB/OTqlVv5YJp2ps+ohN+kzqx4k= ARC-Authentication-Results: i=1; imf11.hostedemail.com; dkim=pass header.d=ionos.com header.s=google header.b=AX5pF3Xy; spf=pass (imf11.hostedemail.com: domain of max.kellermann@ionos.com designates 209.85.208.54 as permitted sender) smtp.mailfrom=max.kellermann@ionos.com; dmarc=pass (policy=quarantine) header.from=ionos.com Received: by mail-ed1-f54.google.com with SMTP id 4fb4d7f45d1cf-57a50fecbadso3146617a12.3 for ; Tue, 04 Jun 2024 02:09:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ionos.com; s=google; t=1717492156; x=1718096956; darn=kvack.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=qOL4vXuZ0a4PoiG22TiWEmdORRFE9U+5xK6xKS6y2zU=; b=AX5pF3XyK7LKmQX4cgPml7K6YTGE82C9UE2XgK0emH6B7p2qMBd2P4DtMF7eHf6/hD l9KuRRkHxFJXgvjjdYFQZwOWq0X0AGvvlihk32RxvBraeRNvNDa1bnxON0O9Zv2me1lu aDbwaWouflNWlzPky4jr+UMV+1vbQusgNMedOepBiuRHaYedSmSQ1pYU7woP6nSPDk0Y jQyyVx5IfC6EOpUvRmgaRfym1FUlu+e3xQW9PDVhPZCkccB7cPs8OKXVnn0NHRua2jkJ udv3woN+dfHDo2LAAKiu83vG+qgLE/Xwnqq3CLzt/Fr5pBgptzeheULX3+m8KHHI7LKl 2MTw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717492156; x=1718096956; 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=qOL4vXuZ0a4PoiG22TiWEmdORRFE9U+5xK6xKS6y2zU=; b=N1AJ3Y+xWYeLivBG+TxyrQuOMbFJEuGfiMM6kuGa3wNEq4acbUycbjDCRHirAW36cf 6yeN1d+Lnecw+6uRkn6H0qfO14hT4hdmRP2eqwDJIm9U51J+l4ShfUrF2cz6TPJ5vCJB xJbiZ3NPpbSu5JOdjRbgRjakoEbytirjKNRtTeZQr9P5DSdw72XoMmy1XGqFFAhAzQCY 0obxr0n//lc+LPG71AKs20iFo32R+rhrH0b3hf/NEdk8R/Qe76iEGSpvBg1XOAi4qI8h Z7t+NpYlI02sFUaQmdUuXaZPYHC3Efdsuo5zJ5ur4AE0t8IwakY2by50b+AZaiLOZK+5 K14w== X-Forwarded-Encrypted: i=1; AJvYcCUKQUO6XawamWCouKkxJUQAgGEjxX8iEV9unRNt6zfmLoIX3/Ase4EEydDUPgYvKE62pABZ42telxlyj6k8FVxu8QI= X-Gm-Message-State: AOJu0YxQ5mX6MuczcWyaoDUJfvuj9QAkW6/WwNbRyUrhhdK0K9Mk1EMo VcHi1eUTmo6xmmbh5curybyNRsEhlJVTmAlYeCUOTzwLXrGK0mUeTOlN3M65dfs= X-Google-Smtp-Source: AGHT+IHt9F2oYYdhVTvxemPiWIf8QKaB1WXTbOFaVE7w6l+bxeSDT0tJO0j/hkCZ7p0XgmZYIYi9Bw== X-Received: by 2002:a17:906:6bc4:b0:a68:d2c:2a23 with SMTP id a640c23a62f3a-a6822049940mr757127166b.76.1717492156465; Tue, 04 Jun 2024 02:09:16 -0700 (PDT) Received: from raven.blarg.de (p200300dc6f4f9200023064fffe740809.dip0.t-ipconnect.de. [2003:dc:6f4f:9200:230:64ff:fe74:809]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a68fa49e66fsm328376766b.129.2024.06.04.02.09.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Jun 2024 02:09:15 -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, david@redhat.com, Max Kellermann Subject: [PATCH v6 08/15] linux/mm.h: move folio_next() to mm/folio_next.h Date: Tue, 4 Jun 2024 11:08:38 +0200 Message-Id: <20240604090845.2182265-9-max.kellermann@ionos.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240604090845.2182265-1-max.kellermann@ionos.com> References: <20240604090845.2182265-1-max.kellermann@ionos.com> MIME-Version: 1.0 X-Rspam-User: X-Stat-Signature: z5b6f957k494hg8fgd4cuhcjnsz49dr4 X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: E6B3F40010 X-HE-Tag: 1717492157-602857 X-HE-Meta: U2FsdGVkX19mMi1tpM/d7NVAW0MvuMv1UeTku0SU+8I1Btn0ul209KPjUmkMsUPeCvQHz3dSiJgEbLflOTyUE0Wt2se3ewOf/CaiYJzYwumzB2F8gfvRXTjPEJ5O0aOOZQBH3S9NbOadSwy1w37ByueMzu7wst9XOemSfVBPQyyKoRzpPc98ZhSBnCkW7RW4sm07T87D5njTKaahpNKQztO7QWLfDTeC5b03v6MM+Q8FbKbYe+qDdaYbzfwjQa0E7hmRvHlKp6znlOe0cvAUuDUjQsq+ICeRgKxuhJowXo4skRJnWgyIGAuccRuDtExMotoy3mTJZW4UZLSpVzBSNRVHPpqA2+dfAJp8hOPeu1Gtg4+oOt1ZCssoR5Vaywo7WdSvLRi8urbYHPyRyJxOnx1llvFUHhSNTjD+iFMLKwa3ObvjafDyjRthh4jnk+vVnY9bgi3lotSdigBTxfFqMu4KjVnBi8bql4FE8sRa2eMTcIvBIISbfknIlV0BO4Rl3b86bhaOzrvpU/cdDI+Ow44ZiRWkkEhK87A3Eu+CTkSXStC3wBlZlfss47JmHE1yV6C2kvbPUiRfO/evavdHveylk7ZAV3+rNlkZVYz57pRwhQ/9/IcOz0M8hDBu0Xv49bnEWu9nVdnDeK2uyRJwg0dmKSc8i0D00WtLMzQGAys44W2wwcG3CffptqX6Wllnx6vez4Fb3mfVXev6Ujudd8lKtKiCtSxny2VZrVOSp4qop3SDW4jYyfW8PkjyJuHo7QV38yqo9TS7Bv0dr4nv+aONW7cYgbLI3zfIqtyFP8J797F+zviAxJksFATk73Ywrzhpb4eV6g4wm7tmJ7+TfegtYJXV6L8bVSToFmCJlP1/d8VKtWpoDKevn+5KWRsI2Le8UOmDbGFk+Z4i183Is62fNKCazAeEEgS8u6fEjy9nhdbvZg+hgd82x3xQ27oWaJgYqT9fgNBxDIPeg9U 5Kj+9Ohm B1l44o7PuLf8rsiFQXgeOXV+rmm8TTV5lvKlaUngJ3PA38i69Qdh+AZflcRWkQtelrPLP6iaKzCBhmICgzq04+gcnloNkl6bUS8jh3YAIAEXk5A1nEWxZIONAo6fx3YzvljUwFlN8D8BAWk8ZoTNM75Yual1P5vOCsFVsh5TI+PA/jZITtWNA8sKhEGLnaqcWiElAH1XmWSOwV+cHi44uqtHtDQyHmOA+KIGOa8ha7m3hr4QgiiUj8RiNEL9qiuGyViaA5v4BRSbQyulmG4I8IK22VsX7aUT5k1EoPELB7mbF5eZbur+6EG/pszLIptleNIg5bZWS/B4Kh5oSZ8P9KtP9LS3KM7IX/vO6fPr4uG3hENdrHGvwVKji4ZI9+TW0ma231XV+8v5WHttwLcD3wnRENpT81Phe62zOB258MHe9bKtQmf3J8+pxpSrHvoNMHF7nyFCwNpmvO8KxVH5gVkxcpQ== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000017, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: Prepare to reduce dependencies on linux/mm.h. folio_next() is used by linux/bio.h. Moving it to a separate lean header will allow us to avoid the dependency on linux/mm.h. Having a one-function header may seem excessive, but there is hardly another way if we want to distangle linux/mm.h from linux/bio.h. If one day, say, folio_prev() gets added, we can still rename the header to something like folio_iterator.h, but until that happens, this folio_next.h header seems like the best trade-off to reduce dependencies. 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 b11bbbdd2754..7be75960e7e1 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -2,6 +2,7 @@ #ifndef _LINUX_MM_H #define _LINUX_MM_H +#include #include #include #include @@ -1916,25 +1917,6 @@ static inline void set_page_links(struct page *page, enum zone_type zone, #define MAX_FOLIO_NR_PAGES MAX_ORDER_NR_PAGES #endif -/** - * folio_next - Move to the next physical folio. - * @folio: The folio we're currently operating on. - * - * If you have physically contiguous memory which may span more than - * one folio (eg a &struct bio_vec), use this function to move from one - * folio to the next. Do not use it if the memory is only virtually - * contiguous as the folios are almost certainly not adjacent to each - * other. This is the folio equivalent to writing ``page++``. - * - * Context: We assume that the folios are refcounted and/or locked at a - * higher level and do not adjust the reference counts. - * Return: The next struct folio. - */ -static inline struct folio *folio_next(struct folio *folio) -{ - return (struct folio *)folio_page(folio, folio_nr_pages(folio)); -} - /** * folio_likely_mapped_shared - Estimate if the folio is mapped into the page * tables of more than one MM diff --git a/include/linux/mm/folio_next.h b/include/linux/mm/folio_next.h new file mode 100644 index 000000000000..7016e303439c --- /dev/null +++ b/include/linux/mm/folio_next.h @@ -0,0 +1,27 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef _LINUX_MM_FOLIO_NEXT_H +#define _LINUX_MM_FOLIO_NEXT_H + +#include // for folio_nr_pages() +#include // for nth_page(), needed by folio_page() + +/** + * folio_next - Move to the next physical folio. + * @folio: The folio we're currently operating on. + * + * If you have physically contiguous memory which may span more than + * one folio (eg a &struct bio_vec), use this function to move from one + * folio to the next. Do not use it if the memory is only virtually + * contiguous as the folios are almost certainly not adjacent to each + * other. This is the folio equivalent to writing ``page++``. + * + * Context: We assume that the folios are refcounted and/or locked at a + * higher level and do not adjust the reference counts. + * Return: The next struct folio. + */ +static inline struct folio *folio_next(struct folio *folio) +{ + return (struct folio *)folio_page(folio, folio_nr_pages(folio)); +} + +#endif /* _LINUX_MM_FOLIO_NEXT_H */ From patchwork Tue Jun 4 09:08:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Max Kellermann X-Patchwork-Id: 13684921 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id D1C3EC25B78 for ; Tue, 4 Jun 2024 09:09:37 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 9CF2A6B00A1; Tue, 4 Jun 2024 05:09:21 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 97DBF6B00A4; Tue, 4 Jun 2024 05:09:21 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 785656B00A3; Tue, 4 Jun 2024 05:09:21 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 57C606B00A1 for ; Tue, 4 Jun 2024 05:09:21 -0400 (EDT) Received: from smtpin20.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id D707A1A01F3 for ; Tue, 4 Jun 2024 09:09:20 +0000 (UTC) X-FDA: 82192632480.20.955356B Received: from mail-ej1-f51.google.com (mail-ej1-f51.google.com [209.85.218.51]) by imf04.hostedemail.com (Postfix) with ESMTP id 09A8040008 for ; Tue, 4 Jun 2024 09:09:18 +0000 (UTC) Authentication-Results: imf04.hostedemail.com; dkim=pass header.d=ionos.com header.s=google header.b="C5/TR+/k"; spf=pass (imf04.hostedemail.com: domain of max.kellermann@ionos.com designates 209.85.218.51 as permitted sender) smtp.mailfrom=max.kellermann@ionos.com; dmarc=pass (policy=quarantine) header.from=ionos.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1717492159; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=HwBsgjYa0IXOImdBe/4+bRIQcCY8SgWsOwsbDkpj0Qk=; b=30khMOwnR+NQCHA0dMeBMGpXIXkkdxlDwYHeGN+qZBvcGBJn526tSFHGCkQ4QNbkAHfKeZ 8PwP/qFqOKLJ7fpYy2z9ELVZ97OrynH7QzuFj0782yGWp+odExgsyXACgBV1k3RtgdSRAL esxvidvb1zwUC1kn8GrX6/HxwK38NLI= ARC-Authentication-Results: i=1; imf04.hostedemail.com; dkim=pass header.d=ionos.com header.s=google header.b="C5/TR+/k"; spf=pass (imf04.hostedemail.com: domain of max.kellermann@ionos.com designates 209.85.218.51 as permitted sender) smtp.mailfrom=max.kellermann@ionos.com; dmarc=pass (policy=quarantine) header.from=ionos.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1717492159; a=rsa-sha256; cv=none; b=mHqEQgIQjIPX//dtRsXktZ4VJNSoAaezyA50/rox8NjUEE8vRkX3pFBuQ+cZA55qrmTX/3 7fu6NJYxtOjGgYnAEQznQcGJhyvZ/j12wR57rjKoA5zwpu7LOqsflvCtU7mPNjX31BLK3o gywqb6rI+MxVBasSBPWCokNXAvRmNRc= Received: by mail-ej1-f51.google.com with SMTP id a640c23a62f3a-a68c2915d99so74908866b.2 for ; Tue, 04 Jun 2024 02:09:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ionos.com; s=google; t=1717492157; x=1718096957; darn=kvack.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=HwBsgjYa0IXOImdBe/4+bRIQcCY8SgWsOwsbDkpj0Qk=; b=C5/TR+/klTOJFH9n3XOeIBMpQ30ArFoSWtghTQTeQiazyOYky9AD4B9GN/CE1g2Ceg vE6vwEpdhichCOC+dJ4fk/KRxSO7yd5GlYFjna8YeZ1xcUsHpwPnUjY0n4h8tj2ZVOln 0d5B+tN3jvW7JCxF1Dbuj9MYinAySR91/dQ1pho7aXSWXiF2hCW/e7den92041T3+2QQ 3QkVLcR+B80Um4RNb1T3/rIyJKp1fAQS5lRHOz/j8uGibJfJw3HiJ7UEOVDXF5i/8aZT 7FCY7tqyWqHkYYRc2bXjZXPYKMV2hdyPbMhmEYODUMD/m680P8oZLWH7PHm/VUDb/kdA KnPQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717492157; x=1718096957; 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=HwBsgjYa0IXOImdBe/4+bRIQcCY8SgWsOwsbDkpj0Qk=; b=qN8x1POLMi9zMPy+CgTiWqNyE2pnBqzjKZwA6JmGe3iHP0MEz1OCoPc13CCR923Ghj BNrH1QVgLIxJYc4un0ersTuI4fj381UTbaSU4Cy8DxLAaMEaoBNbr1IWOVoANLTyhWPE CsufAdjWk3BFd+Q47aoX/do9SI7sbEgrDqUemecXP69lDMxwJSh9PCX6KFENSOwFX6+M DQqomblPxns2rt1bHbK4ZT2Tb1u2KnHnmYF798h3XWcRMQxj7n6GWF6MjbMYN2AT3314 7AzedihEWygcaSVUYb4lF2nLx3EMlTpt8zbTBtPluF+H/FGBGYkQuGRpORmz0V3kNiks YP9A== X-Forwarded-Encrypted: i=1; AJvYcCU3gstRlDSv5ZQnbdLpAQNK52VxnCQQSPZPZC7jNmrWyCC8flg7nETEFW34wdIhvOSf05fjz9uKzLdEcmVwW72jYzw= X-Gm-Message-State: AOJu0YwN/FlC543zELLTNkCJELTazRLqjlcAOU0RgJfknDPdOjeUTg/Y huL2JBLKDYXDzQOsnJkZOvyEnXy3x+qvxNKrMMvS13ehSyNidkO8Is3fKzm6q88= X-Google-Smtp-Source: AGHT+IHIJT2BE+IHPYnFS/7wmnu2XAw4mULYk5HJdR9W0oN6DhpUIE6zi6XQ1spmCyvvSqUKhBaXJg== X-Received: by 2002:a17:906:4f0d:b0:a68:c6e5:3574 with SMTP id a640c23a62f3a-a68c6e5360bmr467546066b.75.1717492157591; Tue, 04 Jun 2024 02:09:17 -0700 (PDT) Received: from raven.blarg.de (p200300dc6f4f9200023064fffe740809.dip0.t-ipconnect.de. [2003:dc:6f4f:9200:230:64ff:fe74:809]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a68fa49e66fsm328376766b.129.2024.06.04.02.09.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Jun 2024 02:09:17 -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, david@redhat.com, Max Kellermann Subject: [PATCH v6 09/15] linux/mm.h: move devmap-related declarations to mm/devmap_managed.h Date: Tue, 4 Jun 2024 11:08:39 +0200 Message-Id: <20240604090845.2182265-10-max.kellermann@ionos.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240604090845.2182265-1-max.kellermann@ionos.com> References: <20240604090845.2182265-1-max.kellermann@ionos.com> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: 09A8040008 X-Stat-Signature: jt8inpd96h9uuwz56aadzao64zpg91k7 X-HE-Tag: 1717492158-821105 X-HE-Meta: U2FsdGVkX18UN2stmao0yDac3c7cn+5DqYUy7pI+GjTp++PFM62EmA8T28iUNWcBunJgF2muTKwlae8OHF8J+uB6dFvM6hF1z/9sqF4MchDnDoQac47in/X8qPQ65eQTu7o5nyjQJkWUHirAxDOjz5E02OwkQHSGnN9B4ZHSY6ysZ3Am9xS+twoKNFAi0BQ/5N636BzQmbsqh9nu+lpXJFUCV1iFVKM8KvB8lCDGkYVBuVFDfaAUqutprzf04pXkAXabgj1D4XG3XxegVW8zLs03Cneg2w6WrP+IFOtQbhmqcA2OrWzd8yH90xep/zsImzknxYRB4TSnPj4k5tLVeZZB54ulHkLhLmo9CLpeoSci9o/1Xik0/lUQHfqAzA1er/LHWkL282pCRUdTBD1VOjHUUz7YdgqHcIhjeaD/ISjLutsB/nU6tLvTjYcRqDcptXrNyJM753LHBQqpuyJWyLP9QGWCyscdvCYCAY+nyRAFQawbzF4EFuHH9L+Lqkbq9RyE0aWeVh3Yp+cbG/tSA9FsUh650x4fI5p7Fl3lz+c4iQYzcnHwZh7XycoeNRvBGEdoBWJCB+/9RHoL4h2rGlXzTTU97QJaN4bK2bgphfLvpKZ/mUMH85UCRT2e/ZqxPGKgRTSBe8i9zsA4u3wxpu+Np0/0yJ8O2qLJ6cj3s1I4bTPlDy0Zij2+10z1uJ6reaOwsACFxXMGvKGzF8zsI0sFiUyOh9PMIwWzKfKkJ9NukpgbQF1i4rjf2Ui0xBEkJnDqtKgg+DgIWsS4L0pSSz0OB9Zi06UnK8fEy3FfHN0GIDO4DVzA8Tk/VpjqdBg2jvFi7FAPYfkDSMgTsYzsls4bK5D48AUQObZVaXEcAD6Zt928lD+SXUWc7rJl+/y/Mr4nZD2zzrpAtaEiE22j1UmlQjiITQuUjJNuUZzZnC12uGHwUkuad4NAGQaKX9uG6ic8WTQlFkhlr0k5tIo kFOPioh+ G6y5Pxzkq6TKTWpFF5yY4peEz3cT8IVhdvaWePYG7H7Ns2rxczyBEMhwpiz/N/xF2WRuvNW/v+5lxYtmE/rcTQeBSQ2us2STiS20q3n5KRWOwBRGWn/3LnBSLbcu7gy1lP/QDlGCsdXZc3oEtovgmJJJrdvPLS7TVdmP2hdQMdt+NagGtL8A/RRptjDacDo/grDqWpKh3u9hvEWXdkcQhYGIQUPifddlqJqMK//GyC1/DmZVrzRM7CBW+OHdJbq1FW7qyQXBCAikMvyd3LNW42i4c5AOJSoRsGfyO4frpSnO++pVhIMENbuGpd6/h96GGQPBytdbSJnAI/jTMF5X6lZrJVhKl6o3g3sWchRpPQFu2w3Q0CtCLOHeR95wM57/nb3L9jOz859lvETLrAKOzMrJ+nY+tmzmBVpGgcvf7Owf7Ews= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000004, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: Prepare to reduce dependencies on linux/mm.h. put_devmap_managed_page() is called by put_page(). Moving it to a separate header allows us to move put_page() to a separate lean header as well. Signed-off-by: Max Kellermann --- include/linux/mm.h | 20 +------------------ include/linux/mm/devmap_managed.h | 32 +++++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+), 19 deletions(-) create mode 100644 include/linux/mm/devmap_managed.h diff --git a/include/linux/mm.h b/include/linux/mm.h index 7be75960e7e1..6ae6961e83bf 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -2,6 +2,7 @@ #ifndef _LINUX_MM_H #define _LINUX_MM_H +#include #include #include #include @@ -1354,25 +1355,6 @@ vm_fault_t finish_fault(struct vm_fault *vmf); * back into memory. */ -#if defined(CONFIG_ZONE_DEVICE) && defined(CONFIG_FS_DAX) -DECLARE_STATIC_KEY_FALSE(devmap_managed_key); - -bool __put_devmap_managed_folio_refs(struct folio *folio, int refs); -static inline bool put_devmap_managed_folio_refs(struct folio *folio, int refs) -{ - if (!static_branch_unlikely(&devmap_managed_key)) - return false; - if (!folio_is_zone_device(folio)) - return false; - return __put_devmap_managed_folio_refs(folio, refs); -} -#else /* CONFIG_ZONE_DEVICE && CONFIG_FS_DAX */ -static inline bool put_devmap_managed_folio_refs(struct folio *folio, int refs) -{ - return false; -} -#endif /* CONFIG_ZONE_DEVICE && CONFIG_FS_DAX */ - /* 127: arbitrary random number, small enough to assemble well */ #define folio_ref_zero_or_close_to_overflow(folio) \ ((unsigned int) folio_ref_count(folio) + 127u <= 127u) diff --git a/include/linux/mm/devmap_managed.h b/include/linux/mm/devmap_managed.h new file mode 100644 index 000000000000..50357b304d68 --- /dev/null +++ b/include/linux/mm/devmap_managed.h @@ -0,0 +1,32 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef _LINUX_MM_DEVMAP_MANAGED_H +#define _LINUX_MM_DEVMAP_MANAGED_H + +#include // for bool + +struct page; + +#if defined(CONFIG_ZONE_DEVICE) && defined(CONFIG_FS_DAX) + +#include // for DECLARE_STATIC_KEY_FALSE(), static_branch_unlikely() +#include // folio_is_zone_device() + +DECLARE_STATIC_KEY_FALSE(devmap_managed_key); + +bool __put_devmap_managed_folio_refs(struct folio *folio, int refs); +static inline bool put_devmap_managed_folio_refs(struct folio *folio, int refs) +{ + if (!static_branch_unlikely(&devmap_managed_key)) + return false; + if (!folio_is_zone_device(folio)) + return false; + return __put_devmap_managed_folio_refs(folio, refs); +} +#else /* CONFIG_ZONE_DEVICE && CONFIG_FS_DAX */ +static inline bool put_devmap_managed_folio_refs(struct folio *folio, int refs) +{ + return false; +} +#endif /* CONFIG_ZONE_DEVICE && CONFIG_FS_DAX */ + +#endif /* _LINUX_MM_DEVMAP_MANAGED_H */ From patchwork Tue Jun 4 09:08:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Max Kellermann X-Patchwork-Id: 13684922 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id C2947C25B7E for ; Tue, 4 Jun 2024 09:09:40 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 5DB856B00A3; Tue, 4 Jun 2024 05:09:23 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 53B006B00A4; Tue, 4 Jun 2024 05:09:23 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2A1F06B00A5; Tue, 4 Jun 2024 05:09:23 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id E129B6B00A3 for ; Tue, 4 Jun 2024 05:09:22 -0400 (EDT) Received: from smtpin21.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 9FB3F1405E5 for ; Tue, 4 Jun 2024 09:09:22 +0000 (UTC) X-FDA: 82192632564.21.E88411F Received: from mail-ej1-f51.google.com (mail-ej1-f51.google.com [209.85.218.51]) by imf03.hostedemail.com (Postfix) with ESMTP id A625520009 for ; Tue, 4 Jun 2024 09:09:20 +0000 (UTC) Authentication-Results: imf03.hostedemail.com; dkim=pass header.d=ionos.com header.s=google header.b=HnpqF6im; dmarc=pass (policy=quarantine) header.from=ionos.com; spf=pass (imf03.hostedemail.com: domain of max.kellermann@ionos.com designates 209.85.218.51 as permitted sender) smtp.mailfrom=max.kellermann@ionos.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1717492160; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=ib6uKSj7xS/ycwqLjicn1v63gCXQSDvpTlGGC5UinQY=; b=wIt1rj8u0Bqcbf9Kx6cKDbca9kP2yRlrtBH52Q3mWXmrK1hiaNpOuhcq7PX14JskXR/Dnu vJcYg2JsiY3hcTBax3Me3RHBEfALU0nNt4fCfFcSjKSA2OXmKdMTdejSzE6Gbk4d+AP90f lz7tqaYPyma8C1F+whMfFFfWQOiFBaU= ARC-Authentication-Results: i=1; imf03.hostedemail.com; dkim=pass header.d=ionos.com header.s=google header.b=HnpqF6im; dmarc=pass (policy=quarantine) header.from=ionos.com; spf=pass (imf03.hostedemail.com: domain of max.kellermann@ionos.com designates 209.85.218.51 as permitted sender) smtp.mailfrom=max.kellermann@ionos.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1717492160; a=rsa-sha256; cv=none; b=v5FEohxO7QMFXFIzydc1beoC+mUYiz6PlcwZrhpVqH1wExWDa3MwK1VnSdNr+QIqWytSeE 0ls2fMfWOCDASBGB7+MaUnTlM7HGHrvtt8Q4kRPrPW1GugivwGIITMOCJH9Tyxpd26D+4J 2Q3mROKwgJgM8FPCGncb6PdsD+G9xC4= Received: by mail-ej1-f51.google.com with SMTP id a640c23a62f3a-a634e03339dso580366866b.3 for ; Tue, 04 Jun 2024 02:09:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ionos.com; s=google; t=1717492159; x=1718096959; darn=kvack.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=ib6uKSj7xS/ycwqLjicn1v63gCXQSDvpTlGGC5UinQY=; b=HnpqF6imzhG/j/+HoABCg2VApVqMveIMIR2PfH/+xxwnqo9l1iPK+F2Jw8bOy9NloY ViUUq+qlp9Lj9baV4wVqmmKDMKPwHsYGeE/m35gQ6qx9SWFRQXvZrfExjDJaZSTDh4R5 MmH5RO113ENLqVrC988TAigsmZhREK2Jvw+GND4cttjCB9kAApwKyTju1saouFl5ccKZ KfSP/8vsmjkuwkCKxLkc3LWXgVx5qXQE1SN8hCzu4Rn9WAWAegirXwvaE+tI7pJJXdvB Sw0MnMln9SjWSdPySrLPCxEjcFfm23l14U6nNc8f/wEDON9xDF8c06Ob7SaPwDBI5/hJ m2qg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717492159; x=1718096959; 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=ib6uKSj7xS/ycwqLjicn1v63gCXQSDvpTlGGC5UinQY=; b=sVYEYbLvCYRGQBH820aQTEp5b4wcauv0tMEFcJZpJ9jsaAHK4KMOecJ3mB4bxDGeIS WIXmELqlT4orSHDbi+9E4XxhcEY95E1aA27yhMgFPBDoJqVeMIDlgKJZ6z5P8DBLLagY L5si6Vc7uNv1kgv+LgUwQ8MY6W2Mf8DUQGrO88pJQo7KrL0ceFIaZPohzMJn+2D63zH+ 6xvDvJz5lt0Bnk1ySyXb3rqQT1ZUf47cX/DfXupkSlJbyiSaFQVI5wTuZE7uL8snvXxP KPVVdwaAEiY9MLVnw1j7C4sgjReKkFYv15rgUzbYFQZlAbMlpQtILxZwHrBgo6rz5ZgQ 1suw== X-Forwarded-Encrypted: i=1; AJvYcCVgzem6LF/smh68C6YxWHz9OXzv5cocSIMBQPhgwgM+4bDT7Pi754p6DuM0kwlSwOHAbQYuT7ejZnzgM5tAMdkA5GM= X-Gm-Message-State: AOJu0Yy/Y/vbwpNeXJE1JrQ8nvdiXRFeSgxsuz1H9WFHzXkTck5b3CeA tdjDCvzTwHp/uwcUq6JxhdNMv3FBvrx54FJeFAeDr36U3AUtiRB5Uvc7j2ueasM= X-Google-Smtp-Source: AGHT+IErVk8d/9y/kb0Ga83nzzJPAptWAOoI16J5Z6NNnpL0um0Mhe5dQgJ/cpp18A88n2GMuIzlBA== X-Received: by 2002:a17:906:a10b:b0:a5a:34ae:10ea with SMTP id a640c23a62f3a-a682272f34amr756980666b.76.1717492159079; Tue, 04 Jun 2024 02:09:19 -0700 (PDT) Received: from raven.blarg.de (p200300dc6f4f9200023064fffe740809.dip0.t-ipconnect.de. [2003:dc:6f4f:9200:230:64ff:fe74:809]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a68fa49e66fsm328376766b.129.2024.06.04.02.09.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Jun 2024 02:09:18 -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, david@redhat.com, Max Kellermann Subject: [PATCH v6 10/15] linux/mm.h: move usage count functions to mm/folio_usage.h Date: Tue, 4 Jun 2024 11:08:40 +0200 Message-Id: <20240604090845.2182265-11-max.kellermann@ionos.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240604090845.2182265-1-max.kellermann@ionos.com> References: <20240604090845.2182265-1-max.kellermann@ionos.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: A625520009 X-Stat-Signature: ocsy94ckyje6zc4ixaycb5ru88z1uiw7 X-Rspam-User: X-Rspamd-Server: rspam04 X-HE-Tag: 1717492160-137690 X-HE-Meta: U2FsdGVkX1+IC+a7wdnPo3j1BzlfOr/NRgiObwsa577FjIL7sE6Rjv2Jn7zW/nfa5Derjpr807uUEH25SVlVOEHxdaE7iFSMvPKmHFXzS9MrRv7+wnZx7cySTcm5pXGcsqL70dwQAZ3xg5B6WIe4NIhMYcQ9sEaeTPA+XgQRXMLRQ+FWI/DV9WnK9cpbUUwiSux2krOh36Ee/vIGgFesb16DqYGuE5BhuBKCoDYMB0sm9fUncAbcgu65LmVbp+wm6EIfQLNCP/wShqk+6e6qvKcpqW3tevFq5S5mjsVJO1i11zSNWorIph4MOQNmuhOtLgiC32kaNxZKMN2At6U+P2xcHo7sdHjv4iXdLTW8YNmPf8YpTfvzrKz3jBpTjVy3y7y8ne6OhgcEwlPaui1KEw9KNKF5f2wX5ziFXUTzF/SZfxAQ0BIA6gnzdsalQd6mJjZXkefPgrbuErglD+Efo3cF1TOWAq13eBZV9ptqMGsQzXqiLGF0YmoMQc2D/+YI1ttGyKhJrnJ1fCkZ8SPOinOyOWh2noNJOYzKByVYTiz3cJaetyjfCjiBnBzlFyjF58IdOF+KTmtxOF+1aMMclOlipbVXfHDRfWn601g9MliiqRE8ytSyA6IOCQmjwNenhxY4C2wTQaf/lrWhKM+a25hY3uMdi6KacL7MHXE1Ed2FJWjf0ztB6LZRo7StZOfdmn6yFcUrOwioJHVCBlfKhOgJPnEGHy/3E44Tjy0R4Je45jfDykWsBRGVThjROQgQWrWaCUA8xaC/8h5LA8LZxd9CKlaprFRK4pjNzEoE7ZKIvHijE52aqEr9xki+LJpZ9ghvmt8iSDzaqwPr3dtXF1ahODO3jEPNWq7hYzlMCbfF5SuyYF2++TVHpZtlqiXg2Ba/LgRCgX7nnyaB3/k3mCgsGQUsh380hK6QUNymc2J5xAUtW91GbPwq2DmZ6px1BXZ7aGUnyAhnGuwG52c casB4MZG rpPTBYzppLUC+ql5IH9fjfQnEd+v6qL9e66eh3LHvMrktk/M8pmuCxL8NTeNcoIvd78Kjik9T0n3wMtV0jUJV3yD00qh7Ezzcx7m/lG/RNhOpCCEZEmbDWgtsKuATv9ZScjp4FfYyCIWPPm4kHx+YBhMPB0Zz7kVKW8JHg6ogN0XCvZ3hMUs2Z1P8DLwxFbJO86J7ushPvB4neJCnDC8lGcqOlXQRwxzfevGzSGUhVzsb0OLVdMjOrpFwYwvxUXY8DKtp8IHilWfQM/bEQR+XCjSqs8b7QaJbm639JmBahtZoyliKbR5aRen9jbC8PdySLv87QllHMfuwsjenjIYOC4qtSts9DyLa6yJ4Yx4OCrBsv+G73NsRfbaJl0ionYHBGaIC/6b+DkV2xLiS0AVDGgU1zOBE1ihHON6xSLnuDjUYUkY= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: Prepare to reduce dependencies on linux/mm.h. This new header contains wrappers for the low-level functions from page_ref.h. By having those higher-level functions in a separate header, we can avoid their additional dependencies in the page_ref.h. Having these in a separate header will allow eliminating the dependency on linux/mm.h from these headers: - linux/skbuff.h - linux/swap.h Signed-off-by: Max Kellermann --- include/linux/mm.h | 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 6ae6961e83bf..a32d284813f4 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -2,9 +2,9 @@ #ifndef _LINUX_MM_H #define _LINUX_MM_H -#include #include #include +#include #include #include #include @@ -1074,51 +1074,6 @@ struct inode; #include -/* - * Methods to modify the page usage count. - * - * What counts for a page usage: - * - cache mapping (page->mapping) - * - private data (page->private) - * - page mapped in a task's page tables, each mapping - * is counted separately - * - * Also, many kernel routines increase the page count before a critical - * routine so they can be sure the page doesn't go away from under them. - */ - -/* - * Drop a ref, return true if the refcount fell to zero (the page has no users) - */ -static inline int put_page_testzero(struct page *page) -{ - VM_BUG_ON_PAGE(page_ref_count(page) == 0, page); - return page_ref_dec_and_test(page); -} - -static inline int folio_put_testzero(struct folio *folio) -{ - return put_page_testzero(&folio->page); -} - -/* - * Try to grab a ref unless the page has a refcount of zero, return false if - * that is the case. - * This can be called when MMU is off so it must not access - * any of the virtual mappings. - */ -static inline bool get_page_unless_zero(struct page *page) -{ - return page_ref_add_unless(page, 1, 0); -} - -static inline struct folio *folio_get_nontail_page(struct page *page) -{ - if (unlikely(!get_page_unless_zero(page))) - return NULL; - return (struct folio *)page; -} - extern int page_is_ram(unsigned long pfn); enum { @@ -1265,8 +1220,6 @@ static inline struct folio *virt_to_folio(const void *x) return page_folio(page); } -void __folio_put(struct folio *folio); - void put_pages_list(struct list_head *pages); void split_page(struct page *page, unsigned int order); @@ -1355,129 +1308,6 @@ vm_fault_t finish_fault(struct vm_fault *vmf); * back into memory. */ -/* 127: arbitrary random number, small enough to assemble well */ -#define folio_ref_zero_or_close_to_overflow(folio) \ - ((unsigned int) folio_ref_count(folio) + 127u <= 127u) - -/** - * folio_get - Increment the reference count on a folio. - * @folio: The folio. - * - * Context: May be called in any context, as long as you know that - * you have a refcount on the folio. If you do not already have one, - * folio_try_get() may be the right interface for you to use. - */ -static inline void folio_get(struct folio *folio) -{ - VM_BUG_ON_FOLIO(folio_ref_zero_or_close_to_overflow(folio), folio); - folio_ref_inc(folio); -} - -static inline void get_page(struct page *page) -{ - folio_get(page_folio(page)); -} - -static inline __must_check bool try_get_page(struct page *page) -{ - page = compound_head(page); - if (WARN_ON_ONCE(page_ref_count(page) <= 0)) - return false; - page_ref_inc(page); - return true; -} - -/** - * folio_put - Decrement the reference count on a folio. - * @folio: The folio. - * - * If the folio's reference count reaches zero, the memory will be - * released back to the page allocator and may be used by another - * allocation immediately. Do not access the memory or the struct folio - * after calling folio_put() unless you can be sure that it wasn't the - * last reference. - * - * Context: May be called in process or interrupt context, but not in NMI - * context. May be called while holding a spinlock. - */ -static inline void folio_put(struct folio *folio) -{ - if (folio_put_testzero(folio)) - __folio_put(folio); -} - -/** - * folio_put_refs - Reduce the reference count on a folio. - * @folio: The folio. - * @refs: The amount to subtract from the folio's reference count. - * - * If the folio's reference count reaches zero, the memory will be - * released back to the page allocator and may be used by another - * allocation immediately. Do not access the memory or the struct folio - * after calling folio_put_refs() unless you can be sure that these weren't - * the last references. - * - * Context: May be called in process or interrupt context, but not in NMI - * context. May be called while holding a spinlock. - */ -static inline void folio_put_refs(struct folio *folio, int refs) -{ - if (folio_ref_sub_and_test(folio, refs)) - __folio_put(folio); -} - -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 = page_folio(page); - - /* - * For some devmap managed pages we need to catch refcount transition - * from 2 to 1: - */ - if (put_devmap_managed_folio_refs(folio, 1)) - return; - folio_put(folio); -} - /* * GUP_PIN_COUNTING_BIAS, and the associated functions that use it, overload * the page's refcount so that two separate items are tracked: the original page diff --git a/include/linux/mm/folio_usage.h b/include/linux/mm/folio_usage.h new file mode 100644 index 000000000000..1cf11ca1f5ab --- /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 users) + */ +static inline int put_page_testzero(struct page *page) +{ + VM_BUG_ON_PAGE(page_ref_count(page) == 0, page); + return page_ref_dec_and_test(page); +} + +static inline int folio_put_testzero(struct folio *folio) +{ + return put_page_testzero(&folio->page); +} + +/* + * Try to grab a ref unless the page has a refcount of zero, return false if + * that is the case. + * This can be called when MMU is off so it must not access + * any of the virtual mappings. + */ +static inline bool get_page_unless_zero(struct page *page) +{ + return page_ref_add_unless(page, 1, 0); +} + +static inline struct folio *folio_get_nontail_page(struct page *page) +{ + if (unlikely(!get_page_unless_zero(page))) + return NULL; + return (struct folio *)page; +} + +void __folio_put(struct folio *folio); + +/* 127: arbitrary random number, small enough to assemble well */ +#define folio_ref_zero_or_close_to_overflow(folio) \ + ((unsigned int) folio_ref_count(folio) + 127u <= 127u) + +/** + * folio_get - Increment the reference count on a folio. + * @folio: The folio. + * + * Context: May be called in any context, as long as you know that + * you have a refcount on the folio. If you do not already have one, + * folio_try_get() may be the right interface for you to use. + */ +static inline void folio_get(struct folio *folio) +{ + VM_BUG_ON_FOLIO(folio_ref_zero_or_close_to_overflow(folio), folio); + folio_ref_inc(folio); +} + +static inline void get_page(struct page *page) +{ + folio_get(page_folio(page)); +} + +static inline __must_check bool try_get_page(struct page *page) +{ + page = compound_head(page); + if (WARN_ON_ONCE(page_ref_count(page) <= 0)) + return false; + page_ref_inc(page); + return true; +} + +/** + * folio_put - Decrement the reference count on a folio. + * @folio: The folio. + * + * If the folio's reference count reaches zero, the memory will be + * released back to the page allocator and may be used by another + * allocation immediately. Do not access the memory or the struct folio + * after calling folio_put() unless you can be sure that it wasn't the + * last reference. + * + * Context: May be called in process or interrupt context, but not in NMI + * context. May be called while holding a spinlock. + */ +static inline void folio_put(struct folio *folio) +{ + if (folio_put_testzero(folio)) + __folio_put(folio); +} + +/** + * folio_put_refs - Reduce the reference count on a folio. + * @folio: The folio. + * @refs: The amount to subtract from the folio's reference count. + * + * If the folio's reference count reaches zero, the memory will be + * released back to the page allocator and may be used by another + * allocation immediately. Do not access the memory or the struct folio + * after calling folio_put_refs() unless you can be sure that these weren't + * the last references. + * + * Context: May be called in process or interrupt context, but not in NMI + * context. May be called while holding a spinlock. + */ +static inline void folio_put_refs(struct folio *folio, int refs) +{ + if (folio_ref_sub_and_test(folio, refs)) + __folio_put(folio); +} + +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 = page_folio(page); + + /* + * For some devmap managed pages we need to catch refcount transition + * from 2 to 1: + */ + if (put_devmap_managed_folio_refs(folio, 1)) + return; + folio_put(folio); +} + +#endif /* _LINUX_MM_FOLIO_USAGE_H */ From patchwork Tue Jun 4 09:08:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Max Kellermann X-Patchwork-Id: 13684923 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 11DB9C25B78 for ; Tue, 4 Jun 2024 09:09:44 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 4C5F56B00A4; Tue, 4 Jun 2024 05:09:24 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 475B06B00A5; Tue, 4 Jun 2024 05:09:24 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 27B296B00A6; Tue, 4 Jun 2024 05:09:24 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 057296B00A4 for ; Tue, 4 Jun 2024 05:09:23 -0400 (EDT) Received: from smtpin09.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id B48041604CF for ; Tue, 4 Jun 2024 09:09:23 +0000 (UTC) X-FDA: 82192632606.09.C332B66 Received: from mail-lj1-f180.google.com (mail-lj1-f180.google.com [209.85.208.180]) by imf27.hostedemail.com (Postfix) with ESMTP id BECAA4001A for ; Tue, 4 Jun 2024 09:09:21 +0000 (UTC) Authentication-Results: imf27.hostedemail.com; dkim=pass header.d=ionos.com header.s=google header.b=MpJX7NU2; spf=pass (imf27.hostedemail.com: domain of max.kellermann@ionos.com designates 209.85.208.180 as permitted sender) smtp.mailfrom=max.kellermann@ionos.com; dmarc=pass (policy=quarantine) header.from=ionos.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1717492161; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=7a14+jXYXTjmg6E3qRGIvRJfYcGA2t0M1Ozzz17Ypyc=; b=7xkUk1YeMBqyuJSmYuWfY04ye0CvHQGOfWIn+TJH4ijuPjoBnntfuO0iT1+LOt/L1jpi3H s8CLRxuI/8hHhLMseUI7MBKaAv0nOqQNAgTXQzpM8iED6wVA+0CuzZgqHvO1lmeL2DvNZN 0jIiKe/rIeucGaqvTfBOUGjFvNm0wv0= ARC-Authentication-Results: i=1; imf27.hostedemail.com; dkim=pass header.d=ionos.com header.s=google header.b=MpJX7NU2; spf=pass (imf27.hostedemail.com: domain of max.kellermann@ionos.com designates 209.85.208.180 as permitted sender) smtp.mailfrom=max.kellermann@ionos.com; dmarc=pass (policy=quarantine) header.from=ionos.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1717492161; a=rsa-sha256; cv=none; b=TXBOpt4Dy2GtqyI0KR2ExoSSe/ScGTw4W/E9qO6D+QBSjW+LerSlndDKCY4MvHS661qgIA N1P1PUfC5KX2lLTo55nKA/VeZSWLHtkwrzF8vzDoRd2xTzdNCf+DKqpgjnt2Yy0Gg61JXG lpP5MgUSheyfNmNdWi9qbhM3YA/HWSg= Received: by mail-lj1-f180.google.com with SMTP id 38308e7fff4ca-2eaae2a6dc1so35251841fa.0 for ; Tue, 04 Jun 2024 02:09:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ionos.com; s=google; t=1717492160; x=1718096960; darn=kvack.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=7a14+jXYXTjmg6E3qRGIvRJfYcGA2t0M1Ozzz17Ypyc=; b=MpJX7NU2wldDrF1MzX33Y/bkwQiJZcUbpGCKZuHW2S+cDvQB19gzE+E8SBroSn9l0O PK8eYIvcqGCbQvPclmHv3uuo8fgr8AuqyXsslg67dLo4EJDM+48qLWwRva+0X4kxmNqC p5cJObmN2mUhmMalFLlfwy8Q3HwiD7cqXw37xoQQGtxFJtDRsa7X0+6PUOjAUD0/99Qe t4sK8/RcfuqbrwW8nMBnCcSPahs2A8LXBurm3WPFvyklKvxCn4jWVuQ2zovSXMVWh8Y7 UZ1PdJuJWOsJO1MLcDHDsnb3T0cw1OH3MXLOBMMKl1Yblp9omf8X3riMRIPzYj3Nj7J+ JJGQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717492160; x=1718096960; 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=7a14+jXYXTjmg6E3qRGIvRJfYcGA2t0M1Ozzz17Ypyc=; b=FdEAE8PTghqJ2beBHEtaxyWrBHUCrNfeQFd/X3HqQly60opynX3VokQ+EJ8IoXaToG zNGyokt6PKVw9Z4QxQnpT87xRSHEoTmcEWMJyZjb2InMrB8GTMAdHElCwV/dLfiDHUq2 YLqvkFk/Y/viGqVHPJ9YxdiuKqM0wIyNYam9FHcD18nP8G+8cijfOZeiTEgCUTh2ERNb vhght2dTwpOHkeB4sjBngEsF9f6av2eBnO1voMxJaOJ2RbE8s5SHR7WCrxgboXhGcbFK O9UNqtG3vG3ArHkLgum00Mn35YojybQcmk274BUvsWlSyU/COClSoFSXauiVAt9ceNLu jFqA== X-Forwarded-Encrypted: i=1; AJvYcCW8t1aeERS5rp4tlCfqw8a7SKNW902bPRjOpOW3YP39P6SyhQKXcStvAsiFrHFKPbLeTnn9+QGIHsM5EZD+1uKpmw8= X-Gm-Message-State: AOJu0Ywl/ONW0IsJsXDFBXMt1FUiVPcOX5Y+ek/xNUkJwFn6fTkZfhD5 oRYArsPkh8n6Lgtm0UEIRUc3mSnw+R6h6izwoGyDUf7FPyBAGzaKPxUcR7JXzys= X-Google-Smtp-Source: AGHT+IHsJf4f3OBFK5S9RQgJe4xLIo0Z7mZgH0CJQAgenYk9ZH6OP2KgkT94QdNs7YGr5ClMSzJPQA== X-Received: by 2002:a2e:9d88:0:b0:2e1:9c57:195a with SMTP id 38308e7fff4ca-2ea951de27fmr93794341fa.32.1717492160177; Tue, 04 Jun 2024 02:09:20 -0700 (PDT) Received: from raven.blarg.de (p200300dc6f4f9200023064fffe740809.dip0.t-ipconnect.de. [2003:dc:6f4f:9200:230:64ff:fe74:809]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a68fa49e66fsm328376766b.129.2024.06.04.02.09.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Jun 2024 02:09:19 -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, david@redhat.com, Max Kellermann Subject: [PATCH v6 11/15] linux/mm.h: move page_zone_id() and more to mm/folio_zone.h Date: Tue, 4 Jun 2024 11:08:41 +0200 Message-Id: <20240604090845.2182265-12-max.kellermann@ionos.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240604090845.2182265-1-max.kellermann@ionos.com> References: <20240604090845.2182265-1-max.kellermann@ionos.com> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: BECAA4001A X-Stat-Signature: rnqd6icsbcygyngcmdrncbdkpukkpqqa X-HE-Tag: 1717492161-786626 X-HE-Meta: U2FsdGVkX191yibPURFgRzrs9tVpzG1HY7QP8EqWNEX22A61Zs7sD0l01fSgLaOijFWmVSdbcGFBsZpWdZka/+wF9fHGcq54ymphOkLvRDN1CrwYoApgJ5WR0HWFOM7ruSY0Z2DxoNrwBXkIW3WvpBzwMDWoJRu3AmNAXFTOpmH316ARYYbyazgSHC2ojJ/ZyJ4PPVoAUx2AzxpqoTPSRdIcYRXG1wDx8v7oTxGh1Ce4j1bKlDz4MEOYodH4fWhUmZPreJ2bWBFGk8WXaVcCmwDkFaoze62UyQFtQkL8g+0vrCs3lf+uoBB4mHTPAOvF1W/tkRt11qLX8cYvw3QQjDENQEIpcqVlfVGrnZilTOoG+YamR8BYGrunF4TK3OQgrLSytoqYWJhz2xLVnHhul11Lp814gYPstfFdAiFaP5uSH1Sy2r/sBM/0EQegHMSdN51YDZRUIMkJismdzea1Da7IdD48D04Q7MuOOR3OoCza/k0m2fRM0GJzdtbz5x8nUOIREhFi0Dk7q/hXJhk8ix3x20xszy/H7gHXRwm806paEyF+IrTAofwCWJTUeLe1bnU/BC9TAyykt2fJ1ZrNMJCelu+4WhcnkJF4h820mgDDKfkcrvVzfITTxQzhGaYbKMNX46vlkmKUEFPJEb460upTeQy3cAwS0++6i6x3HIka2437wDP46/JITSJzZKH9sRaE9Pn7VHdb0HlVDDuYfabSVh6008W9OKOkLtMpAp1f4taRP7Gub6UDeDtIA4KRtNaBMkd6frSxia555Cs0ac7QstmCiMYreHf622IitHhmt2oCzP5AlEz9oN0uR7d6mm7yYGVTqjAt93EpJB/VHeegPDAG6gpjoyhdxSU1sb5kBJESlnbnXQoHLmS8/484viyZSxxR/eLgxKetzehlvBat5fST+HjLxoV5lp0DvTYVlhaHv1o63UMG1nVmVtnTSAcICW4/4IVWDOppE24 jwT2XYde S8BsHZsI6vcQwuO4EisvaOcMqLRz4wkvs3Ldt9dBC+E4owdV2/Ldf/W+Az5XTB5wWMANIu8/Z9LOxtkdNF4G1TTY5YfQHFgO4GvDL32P1trmaEDI+IBS7ZugKFbWaekqYt7iEfA5rRsJxUoAWiZbLydICCzCj6HvxcPypocjBzVNqSTx9zSnYE9Ww83SYby5VAtQ1odjwrs1Nhw9lAFdJyBQs6jYaUpRBb6QhZazR32/yIu5vESK7fOpCkdLXruCX15r3b95y8B5JSrwKnXQ8xf/Vc0TuwKH+oC0UW2m+VVmHbFsFi821bvcFIEYxZZlBYajcUhtfcOmiE3nkpQyzD7yu2fQjNNJ9m9u6wFB7r4faZ/dGJtmfgYBp2V9Y8A95AWbuYFBLa6pd+zpnudADo0713wl+Y/9ZTAF5p2sCdXPnojw= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000002, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: This is needed to eliminate linux/skbuff.h's dependency on linux/mm.h. Signed-off-by: Max Kellermann --- include/linux/mm.h | 48 +----------------------------- include/linux/mm/folio_zone.h | 56 +++++++++++++++++++++++++++++++++++ 2 files changed, 57 insertions(+), 47 deletions(-) create mode 100644 include/linux/mm/folio_zone.h diff --git a/include/linux/mm.h b/include/linux/mm.h index a32d284813f4..c026e58e3725 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -5,6 +5,7 @@ #include #include #include +#include #include #include #include @@ -1369,33 +1370,6 @@ static inline bool is_nommu_shared_mapping(vm_flags_t flags) } #endif -/* - * The identification function is mainly used by the buddy allocator for - * determining if two pages could be buddies. We are not really identifying - * the zone since we could be using the section number id if we do not have - * node id available in page flags. - * We only guarantee that it will return the same value for two combinable - * pages in a zone. - */ -static inline int page_zone_id(struct page *page) -{ - return (page->flags >> ZONEID_PGSHIFT) & ZONEID_MASK; -} - -#ifdef NODE_NOT_IN_PAGE_FLAGS -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 @@ -1546,26 +1520,6 @@ static inline void vma_set_access_pid_bit(struct vm_area_struct *vma) } #endif /* CONFIG_NUMA_BALANCING */ -static inline struct zone *page_zone(const struct page *page) -{ - return &NODE_DATA(page_to_nid(page))->node_zones[page_zonenum(page)]; -} - -static inline pg_data_t *page_pgdat(const struct page *page) -{ - return NODE_DATA(page_to_nid(page)); -} - -static inline struct zone *folio_zone(const struct folio *folio) -{ - return page_zone(&folio->page); -} - -static inline pg_data_t *folio_pgdat(const struct folio *folio) -{ - return page_pgdat(&folio->page); -} - /** * folio_pfn - Return the Page Frame Number of a folio. * @folio: The folio. diff --git a/include/linux/mm/folio_zone.h b/include/linux/mm/folio_zone.h new file mode 100644 index 000000000000..3f3e4284b911 --- /dev/null +++ b/include/linux/mm/folio_zone.h @@ -0,0 +1,56 @@ +/* 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); +} + +static inline struct zone *page_zone(const struct page *page) +{ + return &NODE_DATA(page_to_nid(page))->node_zones[page_zonenum(page)]; +} + +static inline pg_data_t *page_pgdat(const struct page *page) +{ + return NODE_DATA(page_to_nid(page)); +} + +static inline struct zone *folio_zone(const struct folio *folio) +{ + return page_zone(&folio->page); +} + +static inline pg_data_t *folio_pgdat(const struct folio *folio) +{ + return page_pgdat(&folio->page); +} + +#endif /* _LINUX_MM_FOLIO_ZONE_H */ From patchwork Tue Jun 4 09:08:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Max Kellermann X-Patchwork-Id: 13684925 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id BD4DAC25B78 for ; Tue, 4 Jun 2024 09:09:49 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 368606B00A5; Tue, 4 Jun 2024 05:09:26 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 3176D6B00A8; Tue, 4 Jun 2024 05:09:26 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id F27446B00A5; Tue, 4 Jun 2024 05:09:25 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id C73146B00A7 for ; Tue, 4 Jun 2024 05:09:25 -0400 (EDT) Received: from smtpin03.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 870FE1407C8 for ; Tue, 4 Jun 2024 09:09:25 +0000 (UTC) X-FDA: 82192632690.03.EB8DA47 Received: from mail-ed1-f41.google.com (mail-ed1-f41.google.com [209.85.208.41]) by imf21.hostedemail.com (Postfix) with ESMTP id AEFA51C001E for ; Tue, 4 Jun 2024 09:09:22 +0000 (UTC) Authentication-Results: imf21.hostedemail.com; dkim=pass header.d=ionos.com header.s=google header.b=Pv61nEPa; spf=pass (imf21.hostedemail.com: domain of max.kellermann@ionos.com designates 209.85.208.41 as permitted sender) smtp.mailfrom=max.kellermann@ionos.com; dmarc=pass (policy=quarantine) header.from=ionos.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1717492162; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=66hU7JCzDxZkm1iV/ENOXsQE3QPWNxsFJw0nhpOp8E8=; b=PhjrhZyqPzru/RufcCBIXSSLSuMyvAX8DmFNM8iAu+3oAPkjUXeQao3TRsheZkYAP2M/Cm ybfjeEl4/tE+R+rmLW1kVoQdiv8JAJ3bySG2gdx3I25glc2z0omAFyc+iBJ+u9KtyAMnso 5fB+oTn3n2wPwsUVQzqeubqg7cAzvIA= ARC-Authentication-Results: i=1; imf21.hostedemail.com; dkim=pass header.d=ionos.com header.s=google header.b=Pv61nEPa; spf=pass (imf21.hostedemail.com: domain of max.kellermann@ionos.com designates 209.85.208.41 as permitted sender) smtp.mailfrom=max.kellermann@ionos.com; dmarc=pass (policy=quarantine) header.from=ionos.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1717492162; a=rsa-sha256; cv=none; b=gE6Ib/262zmU70nJla8ZasS4gi12kL30uu4d+JUb893MAjSqrT1XET2qsVQ80VoqyZ2hke 2R8qlYum8MCG+r5kQVsUpukkE9bfbYFD5oGzFZridDD1wKTywtMPaSr2NhwUBk7IW0QMDA KWU+jZ/KFomfqh/Ly/X/+RH5mUY1Tac= Received: by mail-ed1-f41.google.com with SMTP id 4fb4d7f45d1cf-57a1fe6392eso6069896a12.0 for ; Tue, 04 Jun 2024 02:09:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ionos.com; s=google; t=1717492161; x=1718096961; darn=kvack.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=66hU7JCzDxZkm1iV/ENOXsQE3QPWNxsFJw0nhpOp8E8=; b=Pv61nEPa7kifAFK9jxv0Fpl8MLXito5dbm4OzoN3x59n3eu2mV6m+DAvI9uoNc1hAz JK1sb/bjZpnlJx7UQ6PjQ0b18iHG/WCvh1PRY84r+M4rrx8598i60y0VEtJy00GHMPow 9L3eOdv7qg0gour7gaAoSvO+e1rf7VPOFbeo//fZ8vVybuxvsyXmRT/uhJMy3fYh0xaP WCpsXzc+ApMMZJgr8c7Qgw7yWSdHngZtvAsJ1Z/Ehcl2wrX/GOCDqeCsRA6qzWFqq7r9 CQoeCOS9wtHsL7Kj7Y6kNwVCUgdmk0XfN+ONjYwoyw09KkGeWURUVYVTOtKLzoIobVjI fp4A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717492161; x=1718096961; 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=66hU7JCzDxZkm1iV/ENOXsQE3QPWNxsFJw0nhpOp8E8=; b=rfDsKElVz/YnpcFN4jNqGCTu3wI89Mi2W8qQEd6HCAnkRDfyVFOvMaE5Z8a51PA4X2 moXSwnPx7iwTLWHaGvEtkN90+Y8pxKIsa1EEd3lrLbhIBXgeeUtuMV9MNF5edfXFBqHC p1C2X5jBncAE/QNzLGiZr7iyleJee0HVIoUYozzeQ2XHA591szPCck0kEdXDFqI3o4RF xofmv6cGkGb5KAIKouh2qZ/vFR5fjW47nSJ+HPZo6hpD6vNPerYEF5GLy4Ezv8gcMjc7 TaUw+60ER0eak3J9r/DahaginaIGwqa7pL2mjdnWlNDcfo/iuJ+jfuLY/ghCcYWPQHiu 5Lkg== X-Forwarded-Encrypted: i=1; AJvYcCWYmwCvGY9Q0XfUJsQ7o4SXIoPLERJNg1uL0O1ZKSbtebpvMVL6Jm30CjfTGsAQN4qCIrs3nhoDelVGK0g+1216Ezo= X-Gm-Message-State: AOJu0YwicrykUfstVe+HM0mHuZjd1vIiJeECcX7+Rt/oYjB0GqbL3LYz j9SX6QpmQJVElRVq9z4lsiwrX3Mjns3KQiwuOjKlOiUJqtRKQ7Hp7XDFTEHsmE8= X-Google-Smtp-Source: AGHT+IFjlRq5i4sRiIz9ii8DICuiWwLZihtIRXZ77Dt4nvy+Gy+GZJvOZGsJ7ckHFkBdl+70Wt0aaw== X-Received: by 2002:a17:906:f585:b0:a68:f0ce:9f2e with SMTP id a640c23a62f3a-a68f0cea079mr465457066b.44.1717492161256; Tue, 04 Jun 2024 02:09:21 -0700 (PDT) Received: from raven.blarg.de (p200300dc6f4f9200023064fffe740809.dip0.t-ipconnect.de. [2003:dc:6f4f:9200:230:64ff:fe74:809]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a68fa49e66fsm328376766b.129.2024.06.04.02.09.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Jun 2024 02:09:20 -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, david@redhat.com, Max Kellermann Subject: [PATCH v6 12/15] linux/mm.h: move pfmemalloc-related functions to pfmemalloc.h Date: Tue, 4 Jun 2024 11:08:42 +0200 Message-Id: <20240604090845.2182265-13-max.kellermann@ionos.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240604090845.2182265-1-max.kellermann@ionos.com> References: <20240604090845.2182265-1-max.kellermann@ionos.com> MIME-Version: 1.0 X-Stat-Signature: 4t5hueizj1fcmq7seimnbb4rgr3sk6pp X-Rspamd-Queue-Id: AEFA51C001E X-Rspam-User: X-Rspamd-Server: rspam10 X-HE-Tag: 1717492162-864119 X-HE-Meta: U2FsdGVkX1/TpmEPMGLosBwmdoM83M1R2NiuxXBdrYKZLEAhtz1UHnRx6+r/bAfejd816wq0eql93LbF8R2qMYc5CrrxJBy+5j1nKVhj/RhvP4qAwq9ehcD/pw/4A8RpyV5rPm2gAmJkzr3YOXIk/MiQd7AON6Hovm4l1nmHgJlez4+XzPtbhN6QaPjjW4xWDd2w3kO+kqNQ4+7Ajm/guFsVVz69rzaGPIGQNV6AZPLa//kPp5Xh+kMs/KrXxbkNSig1ilRhskQgFW8sHy3sxPip+llYzbj+j2hsJPHABzf7uhYI78Oup3UGSWL1KIi2rGf1xcsQycMWCtiw85O9HevKzl7T8aE2+tLrPKkHSVXVZfTn3vb+ayB1crDL0IyQLz668AylnGZ7DrSQjjRbs1Io72Uk3s9tkjbkXROYGLd1dzR2eVAKV04vOkGVNHYB6WeDeGSdSZ459uSDjZQ66pVvjgl8wWIHd4D3nGVNv3zGhmZE3RuvzZN+mzu/PPFKsMdsLgOX7f+ACvfup5DDthb0/SQu+nuz3YdlfmLsQf6fnNtNkZcWyFnjXEbiDUfsJiWRQEfPaw7Qzq8wiIBEYkUAHDaji7Qecv379mekrNzZtXhk69Y0I0zDBaB76SiJSiV3LxVPfROO9LhrNV1ba7PZGHTFEpDLuC0UiKRFA0qnZZdcab/e9wUnfzF1ZuwgJzMi/MLKod1y9LlX3t92s5/MtpCsQPvDlYjDyonf5wr/QCc1k4AeIhPEunvQToAee0Q6Ynp6IvmW6U8rPMGqa6SmCxbNvWBIQRQp+B+E4vDbsam7iunGNBdQEur28LfrRi+byVizNvZ7GSzcMA5jKrr56r+3ZRLmyzc+KfzVM63WgWmMuwNDsjToawXmXWKcY3sOdprNQ4gvrwsPWC+aq1UvW8tps/eNqelx+ouooMuurJyJAOqn7ONcqXaRzb89o+PISdPRURvIr6/eQ2Z iUY3MtOS 9H9TWbxTaUClYZWftHPpj/DTxF+R5yAlmVAp8wN2sdqgedMeirBF18rF9Zlke1fUsD1TT0lDGGpzpNfHdlJQEy79gMgVcSgNGaSPHbJCy0KGE32Dn1IcozL5C3s1pqjfNeF8DRXvnRVph2yNKjOCCPMz78eHUoMc/EHziJtD3t2KI5RZdbMilmqFCTQqCiLbhVppohzeAM15WhiZfoa0NzmP1uM6HBT56sWmrc8nvVvj0xqaw7+U2A1LOX44YMQ1+3m8TVK3nw7Eg5ZkssKkSAtMRelTc6UL5nMGC4a1Cp7+in7rGN6jofAJse6mge5t2sjxxHI8VR/NIgjww6IeqOMh1ePb0PnqjLKguO0+RpuvAo1wrs2Y3tLTVyuBcFfGt4O1wdReylUnXwjmjqCTDr6KP1iCNPmWP0pa5 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000328, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: This is needed to eliminate linux/skbuff.h's dependency on linux/mm.h. Signed-off-by: Max Kellermann --- include/linux/mm.h | 45 +----------------------------- include/linux/mm/pfmemalloc.h | 52 +++++++++++++++++++++++++++++++++++ 2 files changed, 53 insertions(+), 44 deletions(-) create mode 100644 include/linux/mm/pfmemalloc.h diff --git a/include/linux/mm.h b/include/linux/mm.h index c026e58e3725..e178bda2525d 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -8,6 +8,7 @@ #include #include #include +#include #include #include #include @@ -1772,50 +1773,6 @@ static inline int arch_make_folio_accessible(struct folio *folio) */ #include -/* - * Return true only if the page has been allocated with - * ALLOC_NO_WATERMARKS and the low watermark was not - * met implying that the system is under some pressure. - */ -static inline bool page_is_pfmemalloc(const struct page *page) -{ - /* - * lru.next has bit 1 set if the page is allocated from the - * pfmemalloc reserves. Callers may simply overwrite it if - * they do not need to preserve that information. - */ - return (uintptr_t)page->lru.next & BIT(1); -} - -/* - * Return true only if the folio has been allocated with - * ALLOC_NO_WATERMARKS and the low watermark was not - * met implying that the system is under some pressure. - */ -static inline bool folio_is_pfmemalloc(const struct folio *folio) -{ - /* - * lru.next has bit 1 set if the page is allocated from the - * pfmemalloc reserves. Callers may simply overwrite it if - * they do not need to preserve that information. - */ - return (uintptr_t)folio->lru.next & BIT(1); -} - -/* - * Only to be called by the page allocator on a freshly allocated - * page. - */ -static inline void set_page_pfmemalloc(struct page *page) -{ - page->lru.next = (void *)BIT(1); -} - -static inline void clear_page_pfmemalloc(struct page *page) -{ - page->lru.next = NULL; -} - /* * Can be called by the pagefault handler when it gets a VM_FAULT_OOM. */ diff --git a/include/linux/mm/pfmemalloc.h b/include/linux/mm/pfmemalloc.h new file mode 100644 index 000000000000..345b215a3566 --- /dev/null +++ b/include/linux/mm/pfmemalloc.h @@ -0,0 +1,52 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef _LINUX_MM_PFMEMALLOC_H +#define _LINUX_MM_PFMEMALLOC_H + +#include // for BIT() +#include // for struct page + +/* + * Return true only if the page has been allocated with + * ALLOC_NO_WATERMARKS and the low watermark was not + * met implying that the system is under some pressure. + */ +static inline bool page_is_pfmemalloc(const struct page *page) +{ + /* + * lru.next has bit 1 set if the page is allocated from the + * pfmemalloc reserves. Callers may simply overwrite it if + * they do not need to preserve that information. + */ + return (uintptr_t)page->lru.next & BIT(1); +} + +/* + * Return true only if the folio has been allocated with + * ALLOC_NO_WATERMARKS and the low watermark was not + * met implying that the system is under some pressure. + */ +static inline bool folio_is_pfmemalloc(const struct folio *folio) +{ + /* + * lru.next has bit 1 set if the page is allocated from the + * pfmemalloc reserves. Callers may simply overwrite it if + * they do not need to preserve that information. + */ + return (uintptr_t)folio->lru.next & BIT(1); +} + +/* + * Only to be called by the page allocator on a freshly allocated + * page. + */ +static inline void set_page_pfmemalloc(struct page *page) +{ + page->lru.next = (void *)BIT(1); +} + +static inline void clear_page_pfmemalloc(struct page *page) +{ + page->lru.next = NULL; +} + +#endif /* _LINUX_MM_PFMEMALLOC_H */ From patchwork Tue Jun 4 09:08:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Max Kellermann X-Patchwork-Id: 13684924 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 26293C25B78 for ; Tue, 4 Jun 2024 09:09:47 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id F2E656B00AA; Tue, 4 Jun 2024 05:09:25 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id E62646B00A9; Tue, 4 Jun 2024 05:09:25 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id CC2CC6B00A8; Tue, 4 Jun 2024 05:09:25 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id A434F6B00A5 for ; Tue, 4 Jun 2024 05:09:25 -0400 (EDT) Received: from smtpin13.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 6AE3DA0DF3 for ; Tue, 4 Jun 2024 09:09:25 +0000 (UTC) X-FDA: 82192632690.13.D5D87FA Received: from mail-ej1-f53.google.com (mail-ej1-f53.google.com [209.85.218.53]) by imf13.hostedemail.com (Postfix) with ESMTP id 8EADB20003 for ; Tue, 4 Jun 2024 09:09:23 +0000 (UTC) Authentication-Results: imf13.hostedemail.com; dkim=pass header.d=ionos.com header.s=google header.b=R5SIU5Y1; spf=pass (imf13.hostedemail.com: domain of max.kellermann@ionos.com designates 209.85.218.53 as permitted sender) smtp.mailfrom=max.kellermann@ionos.com; dmarc=pass (policy=quarantine) header.from=ionos.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1717492163; a=rsa-sha256; cv=none; b=6U6gxrIct3QoLKuutSIl7GCBpAvzy6W2TyZyAACUrDd7uYilAtDOD0fSh2o8kNVPWcmnK5 iDMaiu0ohWMwPWVoGRoKmflOS71iLYEYKWN6djp1IZlJ5BlibzvMmFRxs37N1FKji5F74I U+n5UgrAUj1dQBzoL0FY4J5i8uvuT28= ARC-Authentication-Results: i=1; imf13.hostedemail.com; dkim=pass header.d=ionos.com header.s=google header.b=R5SIU5Y1; spf=pass (imf13.hostedemail.com: domain of max.kellermann@ionos.com designates 209.85.218.53 as permitted sender) smtp.mailfrom=max.kellermann@ionos.com; dmarc=pass (policy=quarantine) header.from=ionos.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1717492163; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=1o8h4WW2rkKyKPUI+a/gz6b5mzKTaMa0Q8zXDVfDCoM=; b=FHfmEYJRF3tij0TyBh2yMn2K3HfyWr0sByUejQPyN9HSm+XXW725k5r7L3KwXfWlQ88SoH OPtD/X1/+9eYCVSxZO1XaMHfule7gM9fRsI+NKs8EAJKOtDLE2jO8O20m3GhU7d6T5BrPg vx2VsihzzD7X34INe85WdPbPCNDz9l4= Received: by mail-ej1-f53.google.com with SMTP id a640c23a62f3a-a68ee841138so257792766b.1 for ; Tue, 04 Jun 2024 02:09:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ionos.com; s=google; t=1717492162; x=1718096962; darn=kvack.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=1o8h4WW2rkKyKPUI+a/gz6b5mzKTaMa0Q8zXDVfDCoM=; b=R5SIU5Y1LMT5NcpQL4ZDLh9kT6Iwcha2/EhZ+oTJRX18flJZYMQhgv7MVYZMqkHvLn 11Nxlo6J0A8erhuDOj+oAHEdd9zwrCpY8G4p7azFjxJCAPWcl+J5KZQyjtH/Zvml7N9J I7Sf5sXYVFXoA9CioVOBgCYmJkWHbdFh/a5vnAzbFFKKNNZic5oGCRanAxbUdRnt45e9 t9LRSLEZ1jClE69y9F8+1ll640okyQXxGVlvm0yDsMqIPhELh49TACHJJcqnnYaYPJUe 62xt9npSmOQPY+toJHEKQBFcZLAE1FzemSzOXkxs6uE7GzA3iCk368saZbGVRi+efCQc rNGQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717492162; x=1718096962; 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=1o8h4WW2rkKyKPUI+a/gz6b5mzKTaMa0Q8zXDVfDCoM=; b=uAIPd3pSQOen9tS6l9m/VLsVV4HvDmNll0cAofIYsMxvB9nW+3gsLhnxWZH0OXne9c uojNp3KNCnvnvrfUu3/10q+X4T0dP+wwAj3sTn2c8r+SJCpBwllsuA/X26gimDPiSDDZ TNI/IvRELT75yfYJknaTsVQwSQHXhnQ6lW5nBtensLAHbVw6aTjUelw87M9saT+pAvg8 hNI9FAiJnuLYRTE7jAF9LJMdTx4tK3umJXRGy38u7+stwu3BMYQ1O3YtjX36IQllTgNP oJw3tzWojss/Cp0zGPqkRqLIz8iAWTv3yFx5Ws360O9dxtPVA5ZebAZFgbj45yH9J9He Jgmg== X-Forwarded-Encrypted: i=1; AJvYcCWfHQQ+yieb2leGp3heSxBSprhj4rbO+crjcIOpq6uA/4ZRU9SnvE154BCoqBF0kZDvBk0ODXYIsMDw6dWwH1wOyIs= X-Gm-Message-State: AOJu0YyOF6miS0c9+HVoUiQS3nWsJkjI6xckQkKohhW3gW/UpJn0UHSt T0rWbtlT3FWfbUMVu2POK0g6D7/t0MgqnQ150Zc1xIe73DJE/w/rodIjKJkkTj0= X-Google-Smtp-Source: AGHT+IHcBCOnI/AP+4Gs+A9GVqIIvYfhFKwdpV9/+hIkLKh+cjnNIZ7LwpLVGv8+f7nFEA7iDEBeHg== X-Received: by 2002:a17:906:40d8:b0:a68:379d:d623 with SMTP id a640c23a62f3a-a68379dd799mr735700466b.36.1717492162204; Tue, 04 Jun 2024 02:09:22 -0700 (PDT) Received: from raven.blarg.de (p200300dc6f4f9200023064fffe740809.dip0.t-ipconnect.de. [2003:dc:6f4f:9200:230:64ff:fe74:809]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a68fa49e66fsm328376766b.129.2024.06.04.02.09.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Jun 2024 02:09:21 -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, david@redhat.com, Max Kellermann Subject: [PATCH v6 13/15] linux/mm.h: move is_vmalloc_addr() to mm/vmalloc_addr.h Date: Tue, 4 Jun 2024 11:08:43 +0200 Message-Id: <20240604090845.2182265-14-max.kellermann@ionos.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240604090845.2182265-1-max.kellermann@ionos.com> References: <20240604090845.2182265-1-max.kellermann@ionos.com> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: 8EADB20003 X-Stat-Signature: bpmwg5qpd8u14o31yum48iwcoabcdjp9 X-HE-Tag: 1717492163-292347 X-HE-Meta: U2FsdGVkX1+lrcLQg2+BJGTukRFbcu6RtO3WtaGBqoUI+Uc1dv4aOX6tPzHSLkzJhr0kY8g2L311mYTBRgou9Wlxi24SQdo1O/uDxU638pdmmaaAXzJ3sgQsZ9HDUfcSgy5WkaGdEKaSPEDu2I8vqTn/fLssyZyYZH3IZpuinuE+lUspINezrTtH0bgKobRxYEldGaoCElxO6Y5+9BQJLX5ZQu2VRLZxMaAZmESI6VHeg+R6lABHAv0TsTM8BoNQucUj6fa3tzPiZ4qriP7AWuolJBQmvFjtLBZWDmG2Y7W9Jx3SxZBu6uolhoYwPgagQth9PVmcuWM2e89kl9YF7XL4OsyeGZ1E8z49JtstzEbkfjyN0DuLYvpZrnQbl5iKYB0cPjbJYojHpYmszMLQdseP7LHQUYUErbG9SqW/xE4Dp+NBC2ABL5LqprgU/7SgOiTHDYLOa7h6CkP+DCPXY8NRxm6b+nk3Jf0V9zCHluwgw9n6pcp6r6O0MNUmxsT7UsuU3ysoteEzBA9jXrMFkAX27j+UwsCQCbxwqslYo06H1867pfuDl5+TWtZPkzHK2hsFIwCeAWujBwng6VqWqhXk9ZYeFcvX5jfAqHYCaq+bR0lf/awUVA5LaYO7QHGNo0j7i0a5Mct5xmAn6W1wyuA7JWR0/cWZFrptPLOXgcZYcLJBHa8sCMDalKm9yLMNK22CSaBMI8zi0dfTLouu1/QrqvAhNM1z2iI3setQoxZGlIU2se5BUkw2lUdAR7r8iDrISHPiaTq37LrrJjfFYFZ2KY/Sl9nkba/xdZm/goJjZmxZU0k8WauijLpq/sG1cQhRvPEZVEye6us/gkRk7FXUeOCo0zIgXItZazxfro5UgG/6/DmQQ/fG3LoRF4ls8UXPZsddOQUiTeCujo45SWLgzGKd5b1Gda7NbuvnbbXe8SL0ljWFE95b/80G0WcQXUfn9QxIGQMbIZyaBJZ S1r+ldLD r621APRddQdsFDTJaRzRm/qq3mpnjHOKoN/ocGx8kTsFGn8xnC6rTb5RsLqJ19a/bvpuKhfNBjmsAMuoJdlw+Tb3S0NONMGguK6tCtSrHlGIPd9dt0uzKHUCdGVkX6E1ABfJRpmNt4pZJPsZplfmlCEkBSOfUKgG5Y1JywJvSaFbPV3D3TyaP0qP2F0ypdgjpz3hld2FsCUnW3jvR8n0LHt3twYPKAdvo3Z9VvA1Wtoi2A0HyZJygms8kkH+injhhb+x5B5ugzS0A+mHzD7PmvStG9KB3tYaYyDkiC8qYlmkSssm5xphgHZzAPipTQkO3zxoaA/18N7v/lU8lKKNk4JQ4E/s8QeGs1mMzs5CMw+LLW/XAs5I2BwS1j7B4iyHDuhkfgwGSmnZSYYOZxkFw43opVe+sPevLo3NzbR5UYBzssMGH4a3G7oh59+cGXaOfmlGRHIZsUIY5AHowynV3AsWEeQ== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: This is needed to eliminate linux/dma-mapping.h's dependency on linux/mm.h. Signed-off-by: Max Kellermann --- include/linux/mm.h | 25 +------------------------ include/linux/mm/vmalloc_addr.h | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+), 24 deletions(-) create mode 100644 include/linux/mm/vmalloc_addr.h diff --git a/include/linux/mm.h b/include/linux/mm.h index e178bda2525d..6c9089adbb4e 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -9,6 +9,7 @@ #include #include #include +#include #include #include #include @@ -1087,30 +1088,6 @@ enum { int region_intersects(resource_size_t offset, size_t size, unsigned long flags, unsigned long desc); -/* Support for virtually mapped pages */ -struct page *vmalloc_to_page(const void *addr); -unsigned long vmalloc_to_pfn(const void *addr); - -/* - * Determine if an address is within the vmalloc range - * - * On nommu, vmalloc/vfree wrap through kmalloc/kfree directly, so there - * is no special casing required. - */ -#ifdef CONFIG_MMU -extern bool is_vmalloc_addr(const void *x); -extern int is_vmalloc_or_module_addr(const void *x); -#else -static inline bool is_vmalloc_addr(const void *x) -{ - return false; -} -static inline int is_vmalloc_or_module_addr(const void *x) -{ - return 0; -} -#endif - /* * How many times the entire folio is mapped as a single unit (eg by a * PMD or PUD entry). This is probably not what you want, except for diff --git a/include/linux/mm/vmalloc_addr.h b/include/linux/mm/vmalloc_addr.h new file mode 100644 index 000000000000..86ad2dc94960 --- /dev/null +++ b/include/linux/mm/vmalloc_addr.h @@ -0,0 +1,33 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef _LINUX_MM_VMALLOC_ADDR_H +#define _LINUX_MM_VMALLOC_ADDR_H + +#include // for bool + +struct page; + +/* Support for virtually mapped pages */ +struct page *vmalloc_to_page(const void *addr); +unsigned long vmalloc_to_pfn(const void *addr); + +/* + * Determine if an address is within the vmalloc range + * + * On nommu, vmalloc/vfree wrap through kmalloc/kfree directly, so there + * is no special casing required. + */ +#ifdef CONFIG_MMU +extern bool is_vmalloc_addr(const void *x); +extern int is_vmalloc_or_module_addr(const void *x); +#else +static inline bool is_vmalloc_addr(const void *x) +{ + return false; +} +static inline int is_vmalloc_or_module_addr(const void *x) +{ + return 0; +} +#endif + +#endif /* _LINUX_MM_VMALLOC_ADDR_H */ From patchwork Tue Jun 4 09:08:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Max Kellermann X-Patchwork-Id: 13684926 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6D5AEC25B7E for ; Tue, 4 Jun 2024 09:09:52 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 192E26B00A7; Tue, 4 Jun 2024 05:09:28 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 11A896B00A8; Tue, 4 Jun 2024 05:09:28 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id EAF346B00A9; Tue, 4 Jun 2024 05:09:27 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id CB2146B00A7 for ; Tue, 4 Jun 2024 05:09:27 -0400 (EDT) Received: from smtpin27.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 94E7B1401A7 for ; Tue, 4 Jun 2024 09:09:27 +0000 (UTC) X-FDA: 82192632774.27.22AB408 Received: from mail-ed1-f45.google.com (mail-ed1-f45.google.com [209.85.208.45]) by imf11.hostedemail.com (Postfix) with ESMTP id A69A44000B for ; Tue, 4 Jun 2024 09:09:25 +0000 (UTC) Authentication-Results: imf11.hostedemail.com; dkim=pass header.d=ionos.com header.s=google header.b="HzrRq/ro"; spf=pass (imf11.hostedemail.com: domain of max.kellermann@ionos.com designates 209.85.208.45 as permitted sender) smtp.mailfrom=max.kellermann@ionos.com; dmarc=pass (policy=quarantine) header.from=ionos.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1717492165; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=n3U0KL7w5U75JMn9WGwTfgeaFpYbfkGLETLiHeR3bJI=; b=RgTsP6e6zDFy6Bo+O0A39P58pHFpQRch7jWMpI7xABH6yuLp6QOn9q0LWXPWowoRVQHkJj 3BMRm1TwY/7W0qer1G7ZZiGDefo8TXYvihci9JsNuX4rV+vny+A/wjVis5x9Z6MhZd3pht hH9SebqDhD/jewunvUiVXb2kC2MmPg0= ARC-Authentication-Results: i=1; imf11.hostedemail.com; dkim=pass header.d=ionos.com header.s=google header.b="HzrRq/ro"; spf=pass (imf11.hostedemail.com: domain of max.kellermann@ionos.com designates 209.85.208.45 as permitted sender) smtp.mailfrom=max.kellermann@ionos.com; dmarc=pass (policy=quarantine) header.from=ionos.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1717492165; a=rsa-sha256; cv=none; b=5hc0eSGPu29VSPrHqP8yefOETp79hSvzz/oBYMJN2SRWVDNeDELoPKOzG0ur2gXtb6VM86 CdZtBoHCXrCk64htuRPJl+tDDsp+YButgbMU2CDaR97WSloJsRAczUTekQ+Pp5Rh/Mrk6x CNneoXBuF8nNoS3Lf3zbcxCyKE4qlvE= Received: by mail-ed1-f45.google.com with SMTP id 4fb4d7f45d1cf-57a1fe639a5so895691a12.1 for ; Tue, 04 Jun 2024 02:09:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ionos.com; s=google; t=1717492164; x=1718096964; darn=kvack.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=n3U0KL7w5U75JMn9WGwTfgeaFpYbfkGLETLiHeR3bJI=; b=HzrRq/rold4V1UXGmF8ZJd3TgxxAg15cl+Dk+3jIJ1a5u/0yWMTsG7bGSuEWUwCTUJ m2PhuuaQ7Ce/FtxlkeFc5N+F7Cbfu1Er3cQ33Bi3KDQsmHamPY68Jcot4AMiplcY6u+3 +YZEWKapjPjNX5MMwN7KeZBJZRFp7C7caUhB+BjL5pn7qJvkjIvo25xxFZ/A0zODXWKc NzQz0+ghcDcN1FvNORvG0T8K3WLJGstHluKfETZ5X4mhEx3+wbIX4d4TrTDcQtMxIx3P wOI3SV/DPZP5vSPoQkPUFYStWu3nkx70RTp6mSJYZdKFG74ITA2jQ7oPxcq+d+7B4Gl8 nucQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717492164; x=1718096964; 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=n3U0KL7w5U75JMn9WGwTfgeaFpYbfkGLETLiHeR3bJI=; b=nMZrg3X+ZmpcHLtHKiDeJi/UTbgmaGc9fcuTl6+Km1ovPRAqUNKFVnfk0xdhsrfHoC pQFPewhhPEtFb3bZsSl5zbYzcAyUYgo+RqZfpuofqOHtIIZVr2xSSQVsb1GbMgMLNzyF Ilm4tS1CpBcWMC+sa18iweJYR7FV3sGPiZ2J1inzI57Z6bOjZl7SeSQAiseQSTABhveI xuxNLpHoDoY7HUFm/rsdymFTcTUxi29EmXJlb+pE6KYr3SfYk73dBjEdGiOqEsH17IdY +A3swhkJG/9ttNkCT/qV+5t9lViT1L+K6u2QKvBMMjr2aysJxwZESroUIu/Z1v2jY/lK k1EA== X-Forwarded-Encrypted: i=1; AJvYcCWto88UZnAffcXjJKkoB7Erh4hnfUNdjC54oZ3t3uPW8mviizDhoOZRoODZPeNQhzh5rozaR+hVeawef4BMLQv+oFU= X-Gm-Message-State: AOJu0Yy0cNaInvpaZNTtlAogT/JnzpbqBl5wBFhvBdYcSKb++z0OsVNC FzphJzSTHlvlHdYAvshnC0XNJh+IuqJt2ZxMdrrDSAjHvVx9QisksNuYPEnA6u8hPnUySDw3XT2 iveU= X-Google-Smtp-Source: AGHT+IEufjYupL5V5fjGHiqCyxBU1VmyGKHrnjXAzODktOVBv2dBJp+P8PCQHm8Bv1pzw0q+GjsDJg== X-Received: by 2002:a17:906:c4ca:b0:a68:3bf0:79eb with SMTP id a640c23a62f3a-a683c10d453mr547303066b.47.1717492164227; Tue, 04 Jun 2024 02:09:24 -0700 (PDT) Received: from raven.blarg.de (p200300dc6f4f9200023064fffe740809.dip0.t-ipconnect.de. [2003:dc:6f4f:9200:230:64ff:fe74:809]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a68fa49e66fsm328376766b.129.2024.06.04.02.09.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Jun 2024 02:09:22 -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, david@redhat.com, Max Kellermann Subject: [PATCH v6 14/15] linux/mm.h: move high_memory to mm/high_memory.h Date: Tue, 4 Jun 2024 11:08:44 +0200 Message-Id: <20240604090845.2182265-15-max.kellermann@ionos.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240604090845.2182265-1-max.kellermann@ionos.com> References: <20240604090845.2182265-1-max.kellermann@ionos.com> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: A69A44000B X-Stat-Signature: 18rhpg4r4jwyi544g7eah6igbxj67r4i X-HE-Tag: 1717492165-318320 X-HE-Meta: U2FsdGVkX1/9YJWEyYES5pf4/ttMbSxogVb78Wzpv8CG4Kk5ig3Y1DPofgOG3g29Fyitboo47PneMDGxHx8aqHO6a9b/Fl2HL5ntFVhNJcipIc+P1C6sqi/CE4vY/PAEyP+ZG7u2bMloIhjx0QeWwuWFZU6WZgwb5EY9qeBi8bKczRdqnAu0Cs8sf9A8lbFN2m1qAoYRRoliwBBPT9x4VztloUfBMI9Us3OjQEWH7FJOShLNZvFmy2uOodhRwOfUrVFURaoa4SEbIbXbx46JxfbN+Felx7YzyaMQHKMtjswPwwRa+K2vZPkGdey1NYhi4W8wMe17Vok/MtY7EZKlGLtDM+BvWRbhWPa88J7EM9O3vBtoMduHYvgVHl90oWQ7Je7dPqzagI6uk4jzCmqhPj1AImzVGrR0r9GqGeKANe4b6f5JblsKW89VIROeref7RYF/I8v4rOK/659fl1sECoKBd+2yoC984Vzn3kT6v1EAtezIHgGMUlyzdezzL7Oa63kUCHPQeq/RLYj40JpRoNbkQSxVmCpTUqC1W5m/EJeZ+31Zu26jIwgjZbO9sQ/9a2dAd5DDFvHIhPir1JdvUOM0Lqhfg662ExJDPTEksdJNYAoF4jG2X4n60AZPbFVoc87ayaApPF2rLm5A4NrrTKbyQ9Yx6DuYAgfTSvY8o8cX55ahNNVJwvVImP8rX+pPadvOTw/UyVvW3cc/ZpHLdxYbIV2MKScA9WpEQ4jPlWjEgxdWwT+5KLit7dfO9RRJow6/qVuyNDNqWODQH7goYbHsv3M6/4XSkwZPeLbpZN+MQjGjpDKnq3Z3kaYNn/SZgsd1u1eFclqWH5eOsTzYbxzQ/rRr8683rKMXR+qL8nCzc1aHSC9ogBU7Udxb26qk3KzyMbLsbtk1HVZKpkmcUZJxp0Xv7H4M0Pbq0zUhsSD0Z8JX1zPYk/bYA/trrWf40k9aIp4Pb6DL5qNx3/2 kvgBxsYh fg70D8Rg8P7fQ/vixuBInTWtSxA6VrvmRL3H0PVvSiBP9YQtlNgQQWrbECX1XmGjHAR1w/jMtzPMnjAi+1mwojbi2NrU7OveonYlne5cloEYm5UuynX8+IIawAvvRcFCZiSnixTTdeuIsOa3Xjirsv1n1Cuw3Jerv6/MT7z+vKydv2SUfAhUIPRPUxcYrso58zXP2kKRH3CtK3akWCxwXnU08FSY4yDkcOQ3BDFRMVjMnTgLdgH2+uYfzg8TMuXEMshzbuAimuz3fSl37NInDtiRvcSfXeXV+eE4OfAu1GCNHjZgApHv4ru6WQt0DH/wZuA3ZhtxFdxjymKAQAxiiy2rSgWHAQcSt2No6zjcxxRd+9I4aNnX7e6Qh9lLcC/Uy4YqjtFsjuWNt160oIy6E9z1fu4PLJOSTs9WGML5kXGPeDQM= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: This variable is used by lots of arch/*/include/asm/ headers, but these do not (and should not) include the huge linux/mm.h header. Let's move this "extern" variable to a separate header and include this one in arch/. Signed-off-by: Max Kellermann --- arch/arm/include/asm/memory.h | 4 ++++ arch/arm/include/asm/pgtable.h | 2 ++ arch/csky/include/asm/page.h | 1 + arch/hexagon/include/asm/mem-layout.h | 4 ++++ arch/m68k/include/asm/page_mm.h | 1 + arch/m68k/include/asm/pgtable_mm.h | 1 + arch/parisc/include/asm/floppy.h | 1 + arch/powerpc/include/asm/book3s/32/pgtable.h | 4 ++++ arch/powerpc/include/asm/nohash/32/pgtable.h | 1 + arch/powerpc/include/asm/page.h | 1 + arch/x86/include/asm/floppy.h | 1 + arch/x86/include/asm/pgtable_32_areas.h | 4 ++++ drivers/mtd/nand/onenand/onenand_samsung.c | 1 + include/linux/mm.h | 2 +- include/linux/mm/high_memory.h | 7 +++++++ 15 files changed, 34 insertions(+), 1 deletion(-) create mode 100644 include/linux/mm/high_memory.h diff --git a/arch/arm/include/asm/memory.h b/arch/arm/include/asm/memory.h index ef2aa79ece5a..a67afb213e2e 100644 --- a/arch/arm/include/asm/memory.h +++ b/arch/arm/include/asm/memory.h @@ -387,6 +387,10 @@ static inline unsigned long __virt_to_idmap(unsigned long x) */ #define ARCH_PFN_OFFSET PHYS_PFN_OFFSET +#ifndef __ASSEMBLY__ +#include +#endif + #define virt_to_page(kaddr) pfn_to_page(virt_to_pfn(kaddr)) #define virt_addr_valid(kaddr) (((unsigned long)(kaddr) >= PAGE_OFFSET && (unsigned long)(kaddr) < (unsigned long)high_memory) \ && pfn_valid(virt_to_pfn(kaddr))) diff --git a/arch/arm/include/asm/pgtable.h b/arch/arm/include/asm/pgtable.h index be91e376df79..eb80f6a65619 100644 --- a/arch/arm/include/asm/pgtable.h +++ b/arch/arm/include/asm/pgtable.h @@ -11,6 +11,8 @@ #include #ifndef __ASSEMBLY__ +#include + /* * ZERO_PAGE is a global shared page that is always zero: used * for zero-mapped memory areas etc.. diff --git a/arch/csky/include/asm/page.h b/arch/csky/include/asm/page.h index 0ca6c408c07f..17ccc91c3cd6 100644 --- a/arch/csky/include/asm/page.h +++ b/arch/csky/include/asm/page.h @@ -32,6 +32,7 @@ #ifndef __ASSEMBLY__ +#include #include #define virt_addr_valid(kaddr) ((void *)(kaddr) >= (void *)PAGE_OFFSET && \ diff --git a/arch/hexagon/include/asm/mem-layout.h b/arch/hexagon/include/asm/mem-layout.h index e2f99413fe56..a09116c50043 100644 --- a/arch/hexagon/include/asm/mem-layout.h +++ b/arch/hexagon/include/asm/mem-layout.h @@ -10,6 +10,10 @@ #include +#ifndef __ASSEMBLY__ +#include +#endif + /* * Have to do this for ginormous numbers, else they get printed as * negative numbers, which the linker no likey when you try to diff --git a/arch/m68k/include/asm/page_mm.h b/arch/m68k/include/asm/page_mm.h index e0ae4d5fc985..f958655d1931 100644 --- a/arch/m68k/include/asm/page_mm.h +++ b/arch/m68k/include/asm/page_mm.h @@ -5,6 +5,7 @@ #ifndef __ASSEMBLY__ #include +#include #include /* diff --git a/arch/m68k/include/asm/pgtable_mm.h b/arch/m68k/include/asm/pgtable_mm.h index dbdf1c2b2f66..ec593656bdc5 100644 --- a/arch/m68k/include/asm/pgtable_mm.h +++ b/arch/m68k/include/asm/pgtable_mm.h @@ -13,6 +13,7 @@ #ifndef __ASSEMBLY__ #include +#include #include #include diff --git a/arch/parisc/include/asm/floppy.h b/arch/parisc/include/asm/floppy.h index b318a7df52f6..98ed37c5dc59 100644 --- a/arch/parisc/include/asm/floppy.h +++ b/arch/parisc/include/asm/floppy.h @@ -8,6 +8,7 @@ #ifndef __ASM_PARISC_FLOPPY_H #define __ASM_PARISC_FLOPPY_H +#include #include diff --git a/arch/powerpc/include/asm/book3s/32/pgtable.h b/arch/powerpc/include/asm/book3s/32/pgtable.h index 52971ee30717..03e0a32e1c2c 100644 --- a/arch/powerpc/include/asm/book3s/32/pgtable.h +++ b/arch/powerpc/include/asm/book3s/32/pgtable.h @@ -4,6 +4,10 @@ #include +#ifndef __ASSEMBLY__ +#include +#endif + /* * The "classic" 32-bit implementation of the PowerPC MMU uses a hash * table containing PTEs, together with a set of 16 segment registers, diff --git a/arch/powerpc/include/asm/nohash/32/pgtable.h b/arch/powerpc/include/asm/nohash/32/pgtable.h index 9164a9e41b02..8a9f5b546e4a 100644 --- a/arch/powerpc/include/asm/nohash/32/pgtable.h +++ b/arch/powerpc/include/asm/nohash/32/pgtable.h @@ -5,6 +5,7 @@ #include #ifndef __ASSEMBLY__ +#include #include #include #include /* For sub-arch specific PPC_PIN_SIZE */ diff --git a/arch/powerpc/include/asm/page.h b/arch/powerpc/include/asm/page.h index e411e5a70ea3..9ae87fc2c648 100644 --- a/arch/powerpc/include/asm/page.h +++ b/arch/powerpc/include/asm/page.h @@ -7,6 +7,7 @@ */ #ifndef __ASSEMBLY__ +#include #include #include #include diff --git a/arch/x86/include/asm/floppy.h b/arch/x86/include/asm/floppy.h index 6ec3fc969ad5..7756e984f146 100644 --- a/arch/x86/include/asm/floppy.h +++ b/arch/x86/include/asm/floppy.h @@ -10,6 +10,7 @@ #ifndef _ASM_X86_FLOPPY_H #define _ASM_X86_FLOPPY_H +#include #include /* diff --git a/arch/x86/include/asm/pgtable_32_areas.h b/arch/x86/include/asm/pgtable_32_areas.h index b6355416a15a..b339137b4f4e 100644 --- a/arch/x86/include/asm/pgtable_32_areas.h +++ b/arch/x86/include/asm/pgtable_32_areas.h @@ -3,6 +3,10 @@ #include +#ifndef __ASSEMBLY__ +#include +#endif + /* * Just any arbitrary offset to the start of the vmalloc VM area: the * current 8MB value just means that there will be a 8MB "hole" after the diff --git a/drivers/mtd/nand/onenand/onenand_samsung.c b/drivers/mtd/nand/onenand/onenand_samsung.c index fd6890a03d55..7c3cc270386d 100644 --- a/drivers/mtd/nand/onenand/onenand_samsung.c +++ b/drivers/mtd/nand/onenand/onenand_samsung.c @@ -15,6 +15,7 @@ #include #include #include +#include #include #include #include diff --git a/include/linux/mm.h b/include/linux/mm.h index 6c9089adbb4e..83613e9297b5 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -6,6 +6,7 @@ #include #include #include +#include #include #include #include @@ -83,7 +84,6 @@ static inline void totalram_pages_add(long count) atomic_long_add(count, &_totalram_pages); } -extern void * high_memory; extern int page_cluster; extern const int page_cluster_max; diff --git a/include/linux/mm/high_memory.h b/include/linux/mm/high_memory.h new file mode 100644 index 000000000000..e504aafd0d48 --- /dev/null +++ b/include/linux/mm/high_memory.h @@ -0,0 +1,7 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef _LINUX_MM_HIGH_MEMORY_H +#define _LINUX_MM_HIGH_MEMORY_H + +extern void * high_memory; + +#endif /* _LINUX_MM_HIGH_MEMORY_H */ From patchwork Tue Jun 4 09:08:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Max Kellermann X-Patchwork-Id: 13684927 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 77EF2C25B78 for ; Tue, 4 Jun 2024 09:09:55 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 5D72B6B00A9; Tue, 4 Jun 2024 05:09:29 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 587526B00AB; Tue, 4 Jun 2024 05:09:29 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 38DC36B00AC; Tue, 4 Jun 2024 05:09:29 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 17AA96B00A9 for ; Tue, 4 Jun 2024 05:09:29 -0400 (EDT) Received: from smtpin14.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 8550FA1BA3 for ; Tue, 4 Jun 2024 09:09:28 +0000 (UTC) X-FDA: 82192632816.14.C5A651C Received: from mail-ej1-f46.google.com (mail-ej1-f46.google.com [209.85.218.46]) by imf27.hostedemail.com (Postfix) with ESMTP id A8CCA40023 for ; Tue, 4 Jun 2024 09:09:26 +0000 (UTC) Authentication-Results: imf27.hostedemail.com; dkim=pass header.d=ionos.com header.s=google header.b=IaIPyMpZ; spf=pass (imf27.hostedemail.com: domain of max.kellermann@ionos.com designates 209.85.218.46 as permitted sender) smtp.mailfrom=max.kellermann@ionos.com; dmarc=pass (policy=quarantine) header.from=ionos.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1717492166; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=i89wEAwGLV+FFt8LVEfujtav/wRlt8aIRY/CjDWyxYI=; b=Er4Ox6ydaETjKgwpy2cro3I02XTwH6NrRuSZJcWCmwDAkx8jfD/tdjAiXwDi7xnScaKL0O d2SepjtNv/iINg/OcMvc5/HesVRA1JNs0AIdv/z12BS6L2y6ZxhYo63zPPvFzFWCBDiPhh BGLhKC3iRBnXrN+r0sTAvlLJxgdqupQ= ARC-Authentication-Results: i=1; imf27.hostedemail.com; dkim=pass header.d=ionos.com header.s=google header.b=IaIPyMpZ; spf=pass (imf27.hostedemail.com: domain of max.kellermann@ionos.com designates 209.85.218.46 as permitted sender) smtp.mailfrom=max.kellermann@ionos.com; dmarc=pass (policy=quarantine) header.from=ionos.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1717492166; a=rsa-sha256; cv=none; b=INZTbhUEKwgu+bgFiVOBtiAHSHo19HRCVRkQgkyc77lG/ERmvq9OG2o4AXldLGXusb1BbD dIXr0M/P4kiMenR62LXGfJvfKk6jTP3xe4vh3vM6KOxGBSur1ggubD1TetFA6leNi6nUnZ lQKMH3SnC/FyRAG+lA/Hq6EPyCljfY0= Received: by mail-ej1-f46.google.com with SMTP id a640c23a62f3a-a68b41ef3f6so80055466b.1 for ; Tue, 04 Jun 2024 02:09:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ionos.com; s=google; t=1717492165; x=1718096965; darn=kvack.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=i89wEAwGLV+FFt8LVEfujtav/wRlt8aIRY/CjDWyxYI=; b=IaIPyMpZx1o4bAsFgOht/xsAMgkK0YlVEEUhdDtw23/4jQsPOtjqVrCn5u/8fhJsC9 S4UvgLt5ZOPGNAdvMZ9QCiF8xgaKOmVxH7dItAQw5x47/t7i3leVkgduNykcSZyTr2WV wvHTaDqDAfHYrfQTe7GgDTmDx3VvNpvqGOvIy7C24kmQIvk/yQS8CQMS87UdyFzYsEA+ 9HubNpbAaNF/4wrv2ui5bDi3s8w8f79gyqMYLgBlFwNwjCGGK1uXKefOQRdOMYGGUAOD rPDuYBEOBjyXPaMLhlzJUFRS/P5vwXslFB/xBKNijVebokrro0t2YFx1fL8CEvt9fwM4 PIAw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717492165; x=1718096965; 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=i89wEAwGLV+FFt8LVEfujtav/wRlt8aIRY/CjDWyxYI=; b=vQM+68L+zLw/SqZmNPTzNkfHHCk8gy5+xLnAmmGbQhqFTyXGmoNnldc0iWu85GAvXv w3scwMKbl2zIg1fgeuqEYLM5ipOCMYNm5xOaxlJshpxpArZrgt143yiMTi29NGN7Ywkh Zi5/apnZkoq2TGLpSmPt1opu0jQxFIvMSjeM4YM0U58cecbgttWRZsmARPkzWiJZHIBq pQ66jJ/BLzjkRf1JxETVT3eGRL/CT0t6iKyIOXLwztmwrFovq+wCI63wTephBgWR34vG TvMgwU+5de/FgXOmlq/9FYP1jETYTgdEUef65Yu4Yyzb/3tumIpJkMOSFkt8LgpxnZN0 t+xg== X-Forwarded-Encrypted: i=1; AJvYcCUXsEANCs99TLVqzAzseBJVWFt1w789PKV6FjnjeDxSowxF7FFG7qJmVX3jJbQD5Hu5U6aJdhFaDAPoua5Z6SmK1AA= X-Gm-Message-State: AOJu0YzgDcY8PO3pXmG5fqSIiy3PdUUzUoJg14m40DrxqDmJrXp1/sna 2HbkYLtRUmb9Wt26DlOdmaLzKafj3i28r47BhL3iRtL5nfgRHIHMvO4x8kLzDq4= X-Google-Smtp-Source: AGHT+IEEQrB10Ia4g3WkoPKh5/jpdFJJpYBOp5KDOiMCUB9VjtT3LFxj+J1ilVV1yreFVtWqt8rEuw== X-Received: by 2002:a17:907:970e:b0:a69:228:8a6e with SMTP id a640c23a62f3a-a690228939dmr414530066b.44.1717492165278; Tue, 04 Jun 2024 02:09:25 -0700 (PDT) Received: from raven.blarg.de (p200300dc6f4f9200023064fffe740809.dip0.t-ipconnect.de. [2003:dc:6f4f:9200:230:64ff:fe74:809]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a68fa49e66fsm328376766b.129.2024.06.04.02.09.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Jun 2024 02:09:24 -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, david@redhat.com, Max Kellermann Subject: [PATCH v6 15/15] include: reduce dependencies on linux/mm.h Date: Tue, 4 Jun 2024 11:08:45 +0200 Message-Id: <20240604090845.2182265-16-max.kellermann@ionos.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240604090845.2182265-1-max.kellermann@ionos.com> References: <20240604090845.2182265-1-max.kellermann@ionos.com> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: A8CCA40023 X-Stat-Signature: dbigd3rbj4aab3kbofbrke1r9uh874ra X-HE-Tag: 1717492166-45108 X-HE-Meta: U2FsdGVkX195xB85SGBQAou4xVuLN/4fEdKHFS8xmtNshK8/XUnSvaiz/J8wi6GVwqse0LXpVkfISEda5gMGEH/V+KzkqJvnlanysJGsw/0Gh0tJRIlbgqRSIdBGTTGxI3lIpCo4+ybKBOQYLu9X/hjcl/CrrOz78UIbqlpuKiYLGAHzZqS1mDeBOgzn9q0+/ta88cAF0Xx6lJJl8lsiUigHMtAPBr8zQNiBVgDqc3d+WGumPQvhQDJgfJ5XfVuovaq7IAxsygzdG9yrJUUs4fjxufRiqFihI2cTm6FXZyqfwVPJ5Pbro+g0ACW8+fTddcGJvRnYRXLrljbaFI6mHZpYnFGdeFyRR/x2FYEgqp4of8QoQbfEg9ZrxUxMfh79kCxG02+qk98Uyp+BdiuEQKTkshDEp5F3s6Wge3iAFFsOTJJ41JeaKmKAg163ToNHwzRJlzw1I4MR8jxEa8qXm2U30uHrZgM+YRsRv5FaW5iHCOutFrwqwQRDn3q/pFEn0MfUJREVjnOwj8RJ4kqCIPfys6YGndrE0CTe/YIj0yVVmDrtYqhrNQkVodxwo4l77YCCrD/Gi7h0qecijNbK4UeSNjfBFdsm3qGZ7ddkIFUMGG6JBI0Cjv1n6TBwg9/V60QiknUMsd2hVsu2SAfKbt6JGlDCDRNuZliiXaDqbMMR4mU7COrHf+PblEyJkKiTwhau5jyR+ByGZJdKa8zmMeoPo1ftTxy4McF/ndC0JVhNIO1g4L2BZqXEy+CTG5iiA+OxMxBFnvPFqrpa4iXA47L3z1GW4H19B8hJkug+HBcPz13PEF/uOIDXdYk9mV6rIIfTcSE5ruMfj8QlgoOf3ccRrSilrXoOs6n39aceWkUbVL8djKg5C/SbQIAZPCWfnFr2TwK6n8cZxiQn6rJ5dXe0vOR7nmViBM3QqwDTJfLhUNvdZsAFgtpDS/D6fMe70DbnvkC3IK6ucKwVWH+ FYU5DxpJ LCi+GZTr9wbR1HPAHJw2Gr6MGOSsM2mi8PneE+xjp5rcm+d+GWsylbxrxXWVCrPTExR5/lM8/admStuRPREYxpY3ixu8SCVieRy88PUYQbbRMVhM/Nsfu11GpNy+vbJ86A9ewjsHjY62slNJX05rU9WZ/gtksLJFKPCxDoqFDoKLtKO/UWXeTXknNRMZ6ZGlHVBOdkbUBxATJsyMP6lM8dbNPHINK7ThLpsLgDSCGT8qJqwUHlMSgQPdy5/uGra2Gu0FUcP/gI9pa98xd8Q6j8XC+lz4YUfkJ1OOjBajFwJLb0Cw1njWvVy/NB19gO0Yz8cvXqu/b+YGt9iHnCpT8qFmtA8Pwo3xZGGortnnYiMMFqIwXKRQwS5hB6UZNG85ypM3q X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: Replace with the smaller pieces that were just splitted out. This affects a few headers that are included by many, e.g. bio.h and highmem.h, which now no longer depend on the fat header. For this, several missing includes need to be added because they are no longer indirectly included, e.g. . Signed-off-by: Max Kellermann --- include/linux/bio.h | 2 ++ include/linux/bpfptr.h | 1 - include/linux/dma-mapping.h | 1 + include/linux/highmem-internal.h | 2 ++ include/linux/highmem.h | 4 +++- include/linux/net.h | 2 +- include/linux/oom.h | 2 +- include/linux/pagemap.h | 2 +- include/linux/scatterlist.h | 2 +- include/linux/skbuff.h | 4 ++++ include/linux/vmstat.h | 3 ++- lib/scatterlist.c | 1 + 12 files changed, 19 insertions(+), 7 deletions(-) diff --git a/include/linux/bio.h b/include/linux/bio.h index d5379548d684..ddb0c831557b 100644 --- a/include/linux/bio.h +++ b/include/linux/bio.h @@ -5,7 +5,9 @@ #ifndef __LINUX_BIO_H #define __LINUX_BIO_H +#include // for struct kiocb, IOCB_NOWAIT #include +#include /* struct bio, bio_vec and BIO_* flags are defined in blk_types.h */ #include #include diff --git a/include/linux/bpfptr.h b/include/linux/bpfptr.h index 1af241525a17..19967a0e510c 100644 --- a/include/linux/bpfptr.h +++ b/include/linux/bpfptr.h @@ -3,7 +3,6 @@ #ifndef _LINUX_BPFPTR_H #define _LINUX_BPFPTR_H -#include #include typedef sockptr_t bpfptr_t; diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h index f693aafe221f..5a66ade2ddf8 100644 --- a/include/linux/dma-mapping.h +++ b/include/linux/dma-mapping.h @@ -11,6 +11,7 @@ #include #include #include +#include /** * List of possible attributes associated with a DMA mapping. The semantics diff --git a/include/linux/highmem-internal.h b/include/linux/highmem-internal.h index a3028e400a9c..a479e6b7c54c 100644 --- a/include/linux/highmem-internal.h +++ b/include/linux/highmem-internal.h @@ -2,6 +2,8 @@ #ifndef _LINUX_HIGHMEM_INTERNAL_H #define _LINUX_HIGHMEM_INTERNAL_H +#include + /* * Outside of CONFIG_HIGHMEM to support X86 32bit iomap_atomic() cruft. */ diff --git a/include/linux/highmem.h b/include/linux/highmem.h index 00341b56d291..10a165a913ad 100644 --- a/include/linux/highmem.h +++ b/include/linux/highmem.h @@ -7,7 +7,9 @@ #include #include #include -#include +#include // for page_size() +#include // for folio_put() +#include #include #include diff --git a/include/linux/net.h b/include/linux/net.h index 688320b79fcc..481fd7e831af 100644 --- a/include/linux/net.h +++ b/include/linux/net.h @@ -21,7 +21,7 @@ #include #include #include -#include +#include // for page_count() #include #include diff --git a/include/linux/oom.h b/include/linux/oom.h index 7d0c9c48a0c5..518426e092d0 100644 --- a/include/linux/oom.h +++ b/include/linux/oom.h @@ -8,7 +8,7 @@ #include #include #include /* MMF_* */ -#include /* VM_FAULT* */ +#include /* VM_FAULT* */ struct zonelist; struct notifier_block; diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h index 8f09ed4a4451..43e233c998d2 100644 --- a/include/linux/pagemap.h +++ b/include/linux/pagemap.h @@ -5,7 +5,7 @@ /* * Copyright 1995 Linus Torvalds */ -#include +#include #include #include #include diff --git a/include/linux/scatterlist.h b/include/linux/scatterlist.h index 0516e64dc03e..9221bba82b23 100644 --- a/include/linux/scatterlist.h +++ b/include/linux/scatterlist.h @@ -5,7 +5,7 @@ #include #include #include -#include +#include #include #ifdef CONFIG_UML diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index fe7d8dbef77e..09d020d5a6f4 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/include/linux/vmstat.h b/include/linux/vmstat.h index 67c2505d3b78..b9ad7fa932e0 100644 --- a/include/linux/vmstat.h +++ b/include/linux/vmstat.h @@ -4,7 +4,8 @@ #include #include -#include // for folio_zone(), folio_nr_pages() +#include // for folio_nr_pages() +#include // for folio_zone() #include #include #include diff --git a/lib/scatterlist.c b/lib/scatterlist.c index 7bc2220fea80..775bad99fcd9 100644 --- a/lib/scatterlist.c +++ b/lib/scatterlist.c @@ -9,6 +9,7 @@ #include #include #include +#include #include #include