From patchwork Tue Mar 5 08:59:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Max Kellermann X-Patchwork-Id: 13581854 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 C940EC54798 for ; Tue, 5 Mar 2024 08:59:39 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 409F46B007D; Tue, 5 Mar 2024 03:59:39 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 3BB666B0083; Tue, 5 Mar 2024 03:59:39 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1BE7D6B0088; Tue, 5 Mar 2024 03:59:39 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 07BAA6B007D for ; Tue, 5 Mar 2024 03:59:39 -0500 (EST) Received: from smtpin12.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id B15A540D83 for ; Tue, 5 Mar 2024 08:59:38 +0000 (UTC) X-FDA: 81862387236.12.134D4E1 Received: from mail-ed1-f45.google.com (mail-ed1-f45.google.com [209.85.208.45]) by imf30.hostedemail.com (Postfix) with ESMTP id A759F80019 for ; Tue, 5 Mar 2024 08:59:36 +0000 (UTC) Authentication-Results: imf30.hostedemail.com; dkim=pass header.d=ionos.com header.s=google header.b=aJ9rRYD2; spf=pass (imf30.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=1709629176; 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=/qIFUyqNzJGU/sV3s/MTC8AnDdvnQ4WfWOVpbwwJc84=; b=8hVdBXO59IrkAzgkVHFpgH+DIx7AELJZUA8EvD1Vg1apbzle7iylZfvo7gHWqXj0mJYU6P Nu4njND4JymLPDiLS49DGbozl14Xn1kp8/gAJ9+frLDzgwSdZyl81SO8RU7UicnSYxqjMl tYvFfNWqFaAexcSxYvqJBQcOFnGZN/E= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1709629176; a=rsa-sha256; cv=none; b=GhqebQurcgE26ppLrdhF8iDiFh9Z6MkMFaUNniOkTkvEwGl0nS3vzRmIxyRyf7V8q2Aykw 1kMCLXTfROER918bY29dtg1wKfa6/CRcinjvhVF39Q1xUcoqk4edpmT6PQSQfzpyy9AggB oy+pcSnnQn/L/kwBskvQlFhC1kWTmlg= ARC-Authentication-Results: i=1; imf30.hostedemail.com; dkim=pass header.d=ionos.com header.s=google header.b=aJ9rRYD2; spf=pass (imf30.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 Received: by mail-ed1-f45.google.com with SMTP id 4fb4d7f45d1cf-56698eb5e1dso7057469a12.2 for ; Tue, 05 Mar 2024 00:59:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ionos.com; s=google; t=1709629175; x=1710233975; 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=/qIFUyqNzJGU/sV3s/MTC8AnDdvnQ4WfWOVpbwwJc84=; b=aJ9rRYD2X2Lnk8v2Y61gAA/zhpo0rcJ+CUQvk47I6iAeyZmJCGgT9j8R7APRufrUMR bXAxV5rFjmEwqWjdkObOclZcR3F6IwT97NPDRPKmn4xaaMHbx6yLN3DlP3hC3oR9/zul SFqfqQ43Y1k14Al0UxxirTCi4o3o9tUxxBscNHVoKPErpcuitTmwdVXoZW44sHBZsm2H i+fQD5URkIqGucLhrrLyijpdj5f5YIBkTUW+KhVX7sz2z9ZhrdQ20HvQXV+dr1ft/VgX 6Zpjh4Ep9N/eKWovEK/XCvKDxsC1r0M57XV8EALP7VHBWcZlSixFMPZt/KyEcR1nT+AI rDOA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709629175; x=1710233975; 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=/qIFUyqNzJGU/sV3s/MTC8AnDdvnQ4WfWOVpbwwJc84=; b=AdrmT/biebvBoRsAgKxnFbU82UNu9XUa0KGSWbOKn8QA7GJ+nWUkdtb7AtszkOCkH1 4FfdQx0atqP/L3K7ZcIInqM+SOQq0kFJ4vXgq8qjviLx1hcp68WfmAGAodaVURHILzkA HpsyNwAftOkFH9hqzvpPRJTd6s1YSmLGHC/2k2dUA8LY9Q5ycAzKJ6eLJ0u87RQVF/P3 nfud11UBnqLckUvun6VTKHCW65qoL1/6YL4yvnF5sBWGlLbTZEllQuuCax+bswY2SOuW adVc/AKDFWVc0tOhDe+xKnnkDrKOE4RQEaUhm6kI/a6U4lRCYuJfsBcIzwFPKH+Bjxet WWXg== X-Forwarded-Encrypted: i=1; AJvYcCW2lkPxwoyiaRmWTgdlFCry4kNhO7EoWKyuDnL4j2gyMprwq4P+/Eli0kAP9gfcYKmg+Pl1mOUBcUfggnhV0jLC8HM= X-Gm-Message-State: AOJu0Yzi1a92eHW2I0xj5AVLLr2tQjrH0SBIGwCJay4ZZe+RGPhhTnUa nc7sl5w3JjMxjfv/FGYKQFmVV90vdIK7QqUHOIK6Li2zViNzMWP3cAtBNyQdFnx8choEp0wXzT+ x X-Google-Smtp-Source: AGHT+IEPQyBh8s6BMZHnBwuNzm4qtytqWKQC66qXTpgFJkJLHir+hbbuiT2exhYdVnu0LiN9RvteGQ== X-Received: by 2002:a17:906:fc01:b0:a43:f267:789f with SMTP id ov1-20020a170906fc0100b00a43f267789fmr7581742ejb.41.1709629175181; Tue, 05 Mar 2024 00:59:35 -0800 (PST) Received: from raven.blarg.de (p200300dc6f010900023064fffe740809.dip0.t-ipconnect.de. [2003:dc:6f01:900:230:64ff:fe74:809]) by smtp.gmail.com with ESMTPSA id gs4-20020a170906f18400b00a449d12cdc5sm4453005ejb.119.2024.03.05.00.59.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Mar 2024 00:59:34 -0800 (PST) From: Max Kellermann To: akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: willy@infradead.org, sfr@canb.auug.org.au, Max Kellermann Subject: [PATCH v3 01/14] drivers: add missing includes on linux/mm.h (and others) Date: Tue, 5 Mar 2024 09:59:06 +0100 Message-Id: <20240305085919.1601395-2-max.kellermann@ionos.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240305085919.1601395-1-max.kellermann@ionos.com> References: <20240305085919.1601395-1-max.kellermann@ionos.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: A759F80019 X-Rspam-User: X-Stat-Signature: 47t767gmdajoe16pydpsj7m3kuzzcqoz X-Rspamd-Server: rspam03 X-HE-Tag: 1709629176-477219 X-HE-Meta: U2FsdGVkX1+bGPZRO4YJkV6MQ3M6Uc6zA/yRpJoXH5OSVJX+GtZN6G3jt4bZI9l6+bEz0NIz0GEEmH0mmsdO+uVazu97F7oyMwEZcBb658k4p3dJnp4Jhh5kMNVSqZ7y4I03zFvLjuZmvBD0gTFnYdOKQF831CiJ0aYyRZsxbd7sbNeeJIN0+PxOlfDRBYU+BWGUM62bcfIVLIvqMlGSZ5p8gEj7JO/DAb6Ex3NAggiSNSaUHOZuwvqvH559WXzLvyib4wU6XY5A8TtXS1GaYe3Dhs1qM8eJlH61XsGMb1mCGdZnUyWdZi28SJnrusNmXRStHK5iqXTITPs/GXg/EfQ2ZMRL/krhfwRk4UJzFmT3tTIQdiLmFYNQcQrMYiZt21jhrYgLEZBA8w7AdiG6Abm80QC+3mLnxRrDDqTyySiHz97M8Wjvj3M7eZ1o/yXdKoag/pjur0pRxC/b7zvU0q4tVKSrdm05ouNf0JNDVg+WVSnpgvYbhroD8NxC5khFno7yBGDuxViYlYYUNdNgNFk0K+gYbp2oeRh8VpmAH0LF3tCTXD9MJJQ46FncFFTNRRVWmomxhY4KQKBjGNOXq/pkykffGiNDpoJJ4E46LWoH8H6NEGt07GeLXEoxSfVCEp8dq49bu7tL9XI6XMEA9AdqQenUgBL2LAE4+WwCm3BVds06vACD/km+uXwmhk0qSiEIWiHq9eNj4gxEm/fU/KGzHDJiMAewGGiURYNXp/CKobrHtPa+8N0ZhkBZyBjybvK6A608S6peEGQ0tWtp9U12XrJ0BSf1HdeYaAwzx2nmbspEeMr4OpzAW9FzeWT7ocTDPEiAp0K8NTK9/r1rhFwovMB8nkG035UAUD18SQmT4Ga2dkFgRs/h+zwQ1dg3dVpkeFhdQt2CpuwCTzU8i4WeQ8jKod3ylCqGSSFbdrbp4dXWa6LfOlSURR5hcMxj6CgYYBplVT7V5jPTdS2 pyLSs1v1 t4UgkAeOUIJPGgjx7i9SKlIZhAek5+4qTOWPVJVlbJioFDjGctBtnk/5VO+CM32yuqbyAgbZiHYV8oZpEPI//CO/dtELfRGhB05r2H6Ga3PLxPg+AnwB8MZw1ZJnTNUB1D7dvBHFkQPn3S7otIQKt5op10DU3zfUf9GkOWsYlGniAgzMqFlh0CwSdoBckIL7fV2A0RIC8BEkU+TxlTUhQnnu4SLKFvmpDVpRrhge2HFM1CHgB+g/AKK3r3Azu9s1umz4nso1XJfBKASbFyeC6rekh4aywMJE4ZjKS6bgXHkv40wCPHBa/WFBndg1ipahPiDiWj1HhznGF/bVN7ZYBAyTYujZ10SfiT1wIlNoMRV+ZDfdh5LM0+wAIHw== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: After developing the other patches in this series, I had lots of build failures because "#include " was missing. This patch fixes those build failures by adding the missing "#include" lines. To allow bisects, it is ordered before the others. Signed-off-by: Max Kellermann --- arch/arm/mm/iomap.c | 3 +++ drivers/comedi/comedi_buf.c | 1 + drivers/crypto/intel/qat/qat_common/adf_gen4_pm_debugfs.c | 1 + drivers/dma/dma-axi-dmac.c | 1 + drivers/dma/sh/rcar-dmac.c | 1 + drivers/firmware/qcom/qcom_scm-legacy.c | 1 + drivers/firmware/qcom/qcom_scm-smc.c | 1 + drivers/firmware/raspberrypi.c | 1 + drivers/iio/buffer/industrialio-buffer-dma.c | 1 + drivers/iommu/iommufd/ioas.c | 2 ++ drivers/iommu/iommufd/selftest.c | 1 + drivers/media/platform/mediatek/vpu/mtk_vpu.c | 1 + drivers/media/platform/ti/omap/omap_voutlib.c | 1 + drivers/misc/bcm-vk/bcm_vk_dev.c | 1 + drivers/misc/fastrpc.c | 1 + drivers/misc/genwqe/card_dev.c | 1 + drivers/misc/uacce/uacce.c | 1 + drivers/mtd/spi-nor/core.h | 2 ++ drivers/pci/p2pdma.c | 1 + drivers/pci/pci.c | 1 + drivers/remoteproc/remoteproc_core.c | 1 + drivers/soc/qcom/rmtfs_mem.c | 1 + drivers/spi/spi-aspeed-smc.c | 1 + drivers/spi/spi-bcm2835.c | 2 ++ drivers/spi/spi-intel.c | 1 + drivers/virtio/virtio_ring.c | 1 + include/linux/huge_mm.h | 2 ++ include/linux/iommu.h | 1 + include/linux/nvme-keyring.h | 2 ++ include/linux/scatterlist.h | 6 ++++++ kernel/dma/ops_helpers.c | 1 + kernel/dma/remap.c | 1 + mm/dmapool.c | 1 + 33 files changed, 45 insertions(+) diff --git a/arch/arm/mm/iomap.c b/arch/arm/mm/iomap.c index 415d0a454237..9873d8156908 100644 --- a/arch/arm/mm/iomap.c +++ b/arch/arm/mm/iomap.c @@ -29,6 +29,9 @@ EXPORT_SYMBOL(ioport_unmap); #endif #ifdef CONFIG_PCI + +#include // for VMALLOC_* + unsigned long pcibios_min_io = 0x1000; EXPORT_SYMBOL(pcibios_min_io); diff --git a/drivers/comedi/comedi_buf.c b/drivers/comedi/comedi_buf.c index 393966c09740..23b07ebc97ca 100644 --- a/drivers/comedi/comedi_buf.c +++ b/drivers/comedi/comedi_buf.c @@ -10,6 +10,7 @@ #include #include #include +#include // for PAGE_KERNEL* #include "comedi_internal.h" #ifdef PAGE_KERNEL_NOCACHE diff --git a/drivers/crypto/intel/qat/qat_common/adf_gen4_pm_debugfs.c b/drivers/crypto/intel/qat/qat_common/adf_gen4_pm_debugfs.c index ee0b5079de3e..c9b2787baac7 100644 --- a/drivers/crypto/intel/qat/qat_common/adf_gen4_pm_debugfs.c +++ b/drivers/crypto/intel/qat/qat_common/adf_gen4_pm_debugfs.c @@ -1,6 +1,7 @@ // SPDX-License-Identifier: GPL-2.0-only /* Copyright(c) 2023 Intel Corporation */ #include +#include // for simple_read_from_buffer() #include #include #include diff --git a/drivers/dma/dma-axi-dmac.c b/drivers/dma/dma-axi-dmac.c index 4e339c04fc1e..0c98bf0e4b5d 100644 --- a/drivers/dma/dma-axi-dmac.c +++ b/drivers/dma/dma-axi-dmac.c @@ -15,6 +15,7 @@ #include #include #include +#include // for PAGE_ALIGN() #include #include #include diff --git a/drivers/dma/sh/rcar-dmac.c b/drivers/dma/sh/rcar-dmac.c index 40482cb73d79..784da367665c 100644 --- a/drivers/dma/sh/rcar-dmac.c +++ b/drivers/dma/sh/rcar-dmac.c @@ -12,6 +12,7 @@ #include #include #include +#include // for PAGE_ALIGN() #include #include #include diff --git a/drivers/firmware/qcom/qcom_scm-legacy.c b/drivers/firmware/qcom/qcom_scm-legacy.c index 029e6d117cb8..01e082c7163c 100644 --- a/drivers/firmware/qcom/qcom_scm-legacy.c +++ b/drivers/firmware/qcom/qcom_scm-legacy.c @@ -5,6 +5,7 @@ #include #include +#include // for PAGE_ALIGN() #include #include #include diff --git a/drivers/firmware/qcom/qcom_scm-smc.c b/drivers/firmware/qcom/qcom_scm-smc.c index 16cf88acfa8e..a5c74d8996fe 100644 --- a/drivers/firmware/qcom/qcom_scm-smc.c +++ b/drivers/firmware/qcom/qcom_scm-smc.c @@ -5,6 +5,7 @@ #include #include #include +#include // for PAGE_ALIGN() #include #include #include diff --git a/drivers/firmware/raspberrypi.c b/drivers/firmware/raspberrypi.c index 322aada20f74..beef5c4afef2 100644 --- a/drivers/firmware/raspberrypi.c +++ b/drivers/firmware/raspberrypi.c @@ -9,6 +9,7 @@ #include #include #include +#include // for PAGE_ALIGN() #include #include #include diff --git a/drivers/iio/buffer/industrialio-buffer-dma.c b/drivers/iio/buffer/industrialio-buffer-dma.c index 5610ba67925e..b3ce8c4b101a 100644 --- a/drivers/iio/buffer/industrialio-buffer-dma.c +++ b/drivers/iio/buffer/industrialio-buffer-dma.c @@ -6,6 +6,7 @@ #include #include +#include // for PAGE_ALIGN() #include #include #include diff --git a/drivers/iommu/iommufd/ioas.c b/drivers/iommu/iommufd/ioas.c index 742248276548..40c4942406cd 100644 --- a/drivers/iommu/iommufd/ioas.c +++ b/drivers/iommu/iommufd/ioas.c @@ -5,6 +5,8 @@ #include #include #include +#include +#include #include #include "io_pagetable.h" diff --git a/drivers/iommu/iommufd/selftest.c b/drivers/iommu/iommufd/selftest.c index 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 7243604a82a5..885b873982e4 100644 --- a/drivers/media/platform/mediatek/vpu/mtk_vpu.c +++ b/drivers/media/platform/mediatek/vpu/mtk_vpu.c @@ -8,6 +8,7 @@ #include #include #include +#include // for totalram_pages() #include #include #include diff --git a/drivers/media/platform/ti/omap/omap_voutlib.c b/drivers/media/platform/ti/omap/omap_voutlib.c index 0ac46458e41c..3b653b49cc48 100644 --- a/drivers/media/platform/ti/omap/omap_voutlib.c +++ b/drivers/media/platform/ti/omap/omap_voutlib.c @@ -18,6 +18,7 @@ * */ +#include // for PAGE_ALIGN() #include #include #include diff --git a/drivers/misc/bcm-vk/bcm_vk_dev.c b/drivers/misc/bcm-vk/bcm_vk_dev.c index d4a96137728d..c5a39a8189bf 100644 --- a/drivers/misc/bcm-vk/bcm_vk_dev.c +++ b/drivers/misc/bcm-vk/bcm_vk_dev.c @@ -11,6 +11,7 @@ #include #include #include +#include // for io_remap_pfn_range() #include #include #include diff --git a/drivers/misc/fastrpc.c b/drivers/misc/fastrpc.c index dbd26c3b245b..35701e9ec28e 100644 --- a/drivers/misc/fastrpc.c +++ b/drivers/misc/fastrpc.c @@ -10,6 +10,7 @@ #include #include #include +#include // for find_vma() #include #include #include diff --git a/drivers/misc/genwqe/card_dev.c b/drivers/misc/genwqe/card_dev.c index 4441aca2280a..ce3acb938ca6 100644 --- a/drivers/misc/genwqe/card_dev.c +++ b/drivers/misc/genwqe/card_dev.c @@ -17,6 +17,7 @@ #include #include +#include // for struct vm_operations_struct #include #include #include diff --git a/drivers/misc/uacce/uacce.c b/drivers/misc/uacce/uacce.c index bdc2e6fda782..af815b8a718e 100644 --- a/drivers/misc/uacce/uacce.c +++ b/drivers/misc/uacce/uacce.c @@ -2,6 +2,7 @@ #include #include #include +#include // for struct vm_operations_struct #include #include #include diff --git a/drivers/mtd/spi-nor/core.h b/drivers/mtd/spi-nor/core.h index 442786685515..c113ed8e8751 100644 --- a/drivers/mtd/spi-nor/core.h +++ b/drivers/mtd/spi-nor/core.h @@ -9,6 +9,8 @@ #include "sfdp.h" +#include // for SZ_* + #define SPI_NOR_MAX_ID_LEN 6 /* * 256 bytes is a sane default for most older flashes. Newer flashes will diff --git a/drivers/pci/p2pdma.c b/drivers/pci/p2pdma.c index 4f47a13cb500..ef37ea6c09fc 100644 --- a/drivers/pci/p2pdma.c +++ b/drivers/pci/p2pdma.c @@ -16,6 +16,7 @@ #include #include #include +#include // for VM_MAYSHARE #include #include #include diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index cfc5b84dc9c9..e2afd992caa7 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c @@ -25,6 +25,7 @@ #include #include #include +#include // for pgprot_device() #include #include #include diff --git a/drivers/remoteproc/remoteproc_core.c b/drivers/remoteproc/remoteproc_core.c index f276956f2c5c..938220fe29f5 100644 --- a/drivers/remoteproc/remoteproc_core.c +++ b/drivers/remoteproc/remoteproc_core.c @@ -18,6 +18,7 @@ #include #include +#include // for PAGE_ALIGN() #include #include #include diff --git a/drivers/soc/qcom/rmtfs_mem.c b/drivers/soc/qcom/rmtfs_mem.c index df850d073102..15c2f6e5eaff 100644 --- a/drivers/soc/qcom/rmtfs_mem.c +++ b/drivers/soc/qcom/rmtfs_mem.c @@ -6,6 +6,7 @@ #include #include #include +#include // for remap_pfn_range() #include #include #include diff --git a/drivers/spi/spi-aspeed-smc.c b/drivers/spi/spi-aspeed-smc.c index bbd417c55e7f..e45f64761e5e 100644 --- a/drivers/spi/spi-aspeed-smc.c +++ b/drivers/spi/spi-aspeed-smc.c @@ -11,6 +11,7 @@ #include #include #include +#include // for SZ_* #include #include diff --git a/drivers/spi/spi-bcm2835.c b/drivers/spi/spi-bcm2835.c index e1b9b1235787..d8ed5575a9c6 100644 --- a/drivers/spi/spi-bcm2835.c +++ b/drivers/spi/spi-bcm2835.c @@ -33,6 +33,8 @@ #include #include +#include // for ZERO_PAGE() + /* SPI register offsets */ #define BCM2835_SPI_CS 0x00 #define BCM2835_SPI_FIFO 0x04 diff --git a/drivers/spi/spi-intel.c b/drivers/spi/spi-intel.c index 3e5dcf2b3c8a..cf8e4f1c4d93 100644 --- a/drivers/spi/spi-intel.c +++ b/drivers/spi/spi-intel.c @@ -8,6 +8,7 @@ #include #include +#include // for SZ_* #include #include diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c index 6f7e5010a673..48f694d1bc46 100644 --- a/drivers/virtio/virtio_ring.c +++ b/drivers/virtio/virtio_ring.c @@ -12,6 +12,7 @@ #include #include #include +#include // for PAGE_ALIGN() #include #include diff --git a/include/linux/huge_mm.h b/include/linux/huge_mm.h index de0c89105076..55b94db3bd5c 100644 --- a/include/linux/huge_mm.h +++ b/include/linux/huge_mm.h @@ -7,6 +7,8 @@ #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 af6c367ed673..030820a5639e 100644 --- a/include/linux/iommu.h +++ b/include/linux/iommu.h @@ -14,6 +14,7 @@ #include #include #include +#include // for copy_struct_from_user() #define IOMMU_READ (1 << 0) #define IOMMU_WRITE (1 << 1) diff --git a/include/linux/nvme-keyring.h b/include/linux/nvme-keyring.h index e10333d78dbb..9e033850b967 100644 --- a/include/linux/nvme-keyring.h +++ b/include/linux/nvme-keyring.h @@ -6,6 +6,8 @@ #ifndef _NVME_KEYRING_H #define _NVME_KEYRING_H +#include + #if IS_ENABLED(CONFIG_NVME_KEYRING) key_serial_t nvme_tls_psk_default(struct key *keyring, diff --git a/include/linux/scatterlist.h b/include/linux/scatterlist.h index 77df3d7b18a6..0516e64dc03e 100644 --- a/include/linux/scatterlist.h +++ b/include/linux/scatterlist.h @@ -8,6 +8,12 @@ #include #include +#ifdef CONFIG_UML +#include // for virt_to_page(), page_to_phys() +#else +#include // for virt_to_page(), page_to_phys() +#endif + struct scatterlist { unsigned long page_link; unsigned int offset; diff --git a/kernel/dma/ops_helpers.c b/kernel/dma/ops_helpers.c index af4a6ef48ce0..641363b13bb9 100644 --- a/kernel/dma/ops_helpers.c +++ b/kernel/dma/ops_helpers.c @@ -4,6 +4,7 @@ * the allocated memory contains normal pages in the direct kernel mapping. */ #include +#include // for PAGE_ALIGN() static struct page *dma_common_vaddr_to_page(void *cpu_addr) { diff --git a/kernel/dma/remap.c b/kernel/dma/remap.c index 27596f3b4aef..87b3c874d370 100644 --- a/kernel/dma/remap.c +++ b/kernel/dma/remap.c @@ -3,6 +3,7 @@ * Copyright (c) 2014 The Linux Foundation */ #include +#include // for vmap(), PAGE_ALIGN() #include #include diff --git a/mm/dmapool.c b/mm/dmapool.c index f0bfc6c490f4..b8e23fdc81d7 100644 --- a/mm/dmapool.c +++ b/mm/dmapool.c @@ -25,6 +25,7 @@ #include #include #include +#include // for want_init_on_alloc() #include #include #include From patchwork Tue Mar 5 08:59:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Max Kellermann X-Patchwork-Id: 13581855 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 F0787C54E41 for ; Tue, 5 Mar 2024 08:59:41 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 3E32D6B0089; Tue, 5 Mar 2024 03:59:40 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 393856B008A; Tue, 5 Mar 2024 03:59:40 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2354F6B008C; Tue, 5 Mar 2024 03:59:40 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 0D5F36B0089 for ; Tue, 5 Mar 2024 03:59:40 -0500 (EST) Received: from smtpin01.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id CDCD9C0C5F for ; Tue, 5 Mar 2024 08:59:39 +0000 (UTC) X-FDA: 81862387278.01.C74815F Received: from mail-ej1-f47.google.com (mail-ej1-f47.google.com [209.85.218.47]) by imf24.hostedemail.com (Postfix) with ESMTP id E0F3E180012 for ; Tue, 5 Mar 2024 08:59:37 +0000 (UTC) Authentication-Results: imf24.hostedemail.com; dkim=pass header.d=ionos.com header.s=google header.b=BNp51xEd; dmarc=pass (policy=quarantine) header.from=ionos.com; spf=pass (imf24.hostedemail.com: domain of max.kellermann@ionos.com designates 209.85.218.47 as permitted sender) smtp.mailfrom=max.kellermann@ionos.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1709629178; a=rsa-sha256; cv=none; b=VdG1sSLWdkfiGed+543a8NUkb1YxTDo2LD/V3BodOF59SGB61BlxpB4/KLlWxQXzdgXyj2 AA3sh4Rxz2nnYC+vR4FyASvOw8gvRc09dSIoVck44MM7tJBkUQMvsVm+qEKcw6n6A40/3E XmH/61zOviGCWpeHAkCmA/yimhMAW18= ARC-Authentication-Results: i=1; imf24.hostedemail.com; dkim=pass header.d=ionos.com header.s=google header.b=BNp51xEd; dmarc=pass (policy=quarantine) header.from=ionos.com; spf=pass (imf24.hostedemail.com: domain of max.kellermann@ionos.com designates 209.85.218.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=1709629178; 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=TTiX1Q7VCgK5UaGaYDOF/cVTpy5C4wDpe/+P1eOyoN7/FeYMX2jpKqAG+MnsoTm5jZxDGG Tl1Ney3nvpzYhmcq3ATrfN64fS3583Egg7pkE285RMrprWfBglxQsvaiyf9iDkxT9LHuaG XKdE/Qv/zGWmUsieUuN+LCfnRqOHu9U= Received: by mail-ej1-f47.google.com with SMTP id a640c23a62f3a-a4467d570cdso544984766b.3 for ; Tue, 05 Mar 2024 00:59:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ionos.com; s=google; t=1709629176; x=1710233976; 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=BNp51xEdK/nrXCOhe3ibfKHk7RQJU/75TEtnVgf+aZz8NsetInEm1vkjB3nFE8QiuA dQ2E/Q0jthVllrHlwhgRotMBp5dKM16LM9j/AgOtrd6C9DSihkMw/oFuGSczP+blSE0u XIi2VdzJe5JtA4nWYL+gZEBedKOJ4EvJZc+2xGRFCT3uK1+b9cg8U6lwz4cdVl3IEOtz DGK+8ADJJ8XgZf14HRHr0L959bu4SyeOHljiU/K+KEq1sEHPw/XSdbwYAimRxb71jz2b a0yWu/nlhxIArQJH384gIoPs4MpEml2UWsyq2IqKlTU9IHa5LGVo879pSt1GN/W367Tg OcgA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709629176; x=1710233976; 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=bhhFO9LvTaUwAzT8xAVXa63mGZxGSc9dq4IA/a+3jRvEkWnO8l3IjE12hCTMIT0E2q tBMhclcP1xla5TeEJTmrjbw15M0qUg3ZIjaPz3ONhH49uqUbH5MaLVEN+Iz7784H3iFi zeriejqY8BWDoa+bQ/acebquPSlM6fw6Ck/ERoOzUrqJ6NP5YaJpSAh6DOmnFBYcDYIc 6z6287uocvcHaokfMM8P8wX7WK1hM4+ljIf+4c+i6DSxl4OoeMfnr5+McNR0cxPfRLZa 7fUACAhKzUptaHI2jfLwhYl6Jvyc/R9Q1gbEXbCPcd+O80UmcKgRMo338U+XnVoxkMjc kFbw== X-Forwarded-Encrypted: i=1; AJvYcCU8QD0f7XBD0WaTc4VJrEBpSJg4LftPPClUagUgL+aSz+4FMKXXZn1aawYN31UO6kilEADEzmZUdKITv18fWRuYOag= X-Gm-Message-State: AOJu0Yxc1mwgLvFzImscaIcZg9ZD2pQSB8ytNp7Lk4ST//8g6JmMIkh3 +ufR7xkgjkZRkw6vtSm0RhjAlJu2oV4XaOU/NyApVaGKHOVnUkfdIWLBV8ORYN0= X-Google-Smtp-Source: AGHT+IFECPH+najh1MX5zMcxH632u551jNgiqYN/FKRfvXxmD0N9/VMCEcGbJDINMY/jajNmROur7w== X-Received: by 2002:a17:906:7809:b0:a3f:29c:c8fa with SMTP id u9-20020a170906780900b00a3f029cc8famr7642550ejm.66.1709629176544; Tue, 05 Mar 2024 00:59:36 -0800 (PST) Received: from raven.blarg.de (p200300dc6f010900023064fffe740809.dip0.t-ipconnect.de. [2003:dc:6f01:900:230:64ff:fe74:809]) by smtp.gmail.com with ESMTPSA id gs4-20020a170906f18400b00a449d12cdc5sm4453005ejb.119.2024.03.05.00.59.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Mar 2024 00:59:35 -0800 (PST) From: Max Kellermann To: akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: willy@infradead.org, sfr@canb.auug.org.au, Max Kellermann Subject: [PATCH v3 02/14] include/drm/drm_gem.h: add poll_table_struct forward declaration Date: Tue, 5 Mar 2024 09:59:07 +0100 Message-Id: <20240305085919.1601395-3-max.kellermann@ionos.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240305085919.1601395-1-max.kellermann@ionos.com> References: <20240305085919.1601395-1-max.kellermann@ionos.com> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: E0F3E180012 X-Stat-Signature: 8wcx5pyczje8zii9skoonjsb8qzhfdhq X-HE-Tag: 1709629177-641758 X-HE-Meta: U2FsdGVkX18VXqJIGDqe/y1jPd5TmsHhWt59mBciWSnT7dH+4nBxltjDpqWCxMHA6LuBxOykgQK0FKq6S5tSYdODAF8Dn435PulqNSnceAfwifPB20t1+GVJtILhsc4zSqeR2rgZ9Lxh2t3FYI/ucpWzrhNoqfeeFF2ZJDT8RxuktC4Qtwe6KAMtB7ydNG/GGCVVlzx5++8ZMNlnubzFRQAMD6LGs8phEVz1bkQcgNipAT4wEGjh6fg3l70KrWx8ai3eZrIV7mB8WMdsry5i2P6q08wnl3gmUAzR2WEM+UDv/xBQOsH6g99IS+uNwJ/TFgF34YNegF4K5HY52g5b2l5HdPW58fLOAn7381ewWz2e/Y8l8EJghmRdi3jtH9L4/eUxgSMe3XtX8GMc1OiZ7a42AMBpDYky+UTFPLxtwUQnLTBb4KQvsU1RwD2T/26EhB3OrFNFHDJ0CLceDXyZcswFYg/DIsrF3B1Lk+zEYF5FLh6tBc42/YE8pC8EmGRonKJndPAnd+1PIf6LPFwfEQD5KkEpv/sZBs1lUO96s1kzV0WBJB4kKOQ6TnUpDsnANzGw5NDrxSuUJaI/uHsGI/CwONBg8ShU/ugvOUIgGFd5VIuR6DGrcTGZlMOUtJPFYQaq2e8GwY98JZguK4wXhPxBiX41hAba/OcvvUaYIGCCi66G62zwDB9TFacQlupxje7za3mU+LRy0pdoG9djkurrF72qQDofsCudTkFjF4Tc9YTWGoLAnApTInd4ms+dEXyU2BLRu5uOtKAV8K5m3UXQh+0wuZ3usURR4Hzzyc0VWXnLmSqLwm76WMrSKi35rh31QRzgorPA4xVAv40zphniN25wpupCYRpd1OGhPum6Zm3FCfqsEO7XpTw1/fiEYaKpuPkBrvshNWvtCvaTPOh1P/0gaiY7oCXZr1OWyjZAjhBltNXm1lAahplGKuhC5CpqxQugEjMpIJo+crY cOw0eXVc Mxt9Sbp4OlAYkHlL3aWAObqthlkDEl7xbqeFdVnQN+a7xlPWBSSQwwljoMyrhOiny1+mEDriGvdzkx2stRDQsjwpSBFGtkNvX/HtowLqkopo/pN5XeNwyl3+hTq1IYukF1Lcr13gwlsA5LoQ4T0vnTGex2o6GJ+1xUrtkh4VY+f7Hh0M6cxCsO+yOlgm4QQIZBGC3IYYHuxJVeZc6GoNG5VmFhBCzSoH+m7NGiI785zctNbcrXIQqZK3xiPacvjw90nnOENsUKIH+MqauL/czEJF3ffgHGRRy99oUddJEN0flxlqgztj5J5eAdVey7owXtDM3ETrByS/mDSvvntOx6bE+U0+6S2ZzZzb5AYIl74qvfSoAjDRtXDOdxvwzi8esgd+wZq2e/muRpPZkQ5SW2VSzpO9CgOz/nWmWW8iPCPejbqJrqmz/c9A2tYZnB/Ha3zxWP/U6I9Rh2JA= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000001, 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 Mar 5 08:59:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Max Kellermann X-Patchwork-Id: 13581856 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 DD587C54E41 for ; Tue, 5 Mar 2024 08:59:44 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 45A056B008A; Tue, 5 Mar 2024 03:59:41 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 3BBAE6B008C; Tue, 5 Mar 2024 03:59:41 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1E7E76B0093; Tue, 5 Mar 2024 03:59:41 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 09FE96B008A for ; Tue, 5 Mar 2024 03:59:41 -0500 (EST) Received: from smtpin26.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id CA1D9C0DB4 for ; Tue, 5 Mar 2024 08:59:40 +0000 (UTC) X-FDA: 81862387320.26.6B42E0C Received: from mail-ej1-f45.google.com (mail-ej1-f45.google.com [209.85.218.45]) by imf01.hostedemail.com (Postfix) with ESMTP id 138784000F for ; Tue, 5 Mar 2024 08:59:38 +0000 (UTC) Authentication-Results: imf01.hostedemail.com; dkim=pass header.d=ionos.com header.s=google header.b=bCqXWWi1; dmarc=pass (policy=quarantine) header.from=ionos.com; spf=pass (imf01.hostedemail.com: domain of max.kellermann@ionos.com designates 209.85.218.45 as permitted sender) smtp.mailfrom=max.kellermann@ionos.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1709629179; 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=yHNy+forpiTP10uEWDszfRKNVIJTNDDzicOChwXOTNY=; b=zHW+ASAV1eHgbHes8vVW2lb/rRztV7PKap6b3QfMCOBRF/Lot6bD6GZ+jhh7kveyNZOoLX QP0YPJ/RSLvdtjL6Oxu/q09QyNXiY53BLL2e4zMqfV1eo0NE9B4nrWv9EXPF0wxm6uqvPm KCKkzO+eDeShrk9aDLsbVZ/yjm1Mato= ARC-Authentication-Results: i=1; imf01.hostedemail.com; dkim=pass header.d=ionos.com header.s=google header.b=bCqXWWi1; dmarc=pass (policy=quarantine) header.from=ionos.com; spf=pass (imf01.hostedemail.com: domain of max.kellermann@ionos.com designates 209.85.218.45 as permitted sender) smtp.mailfrom=max.kellermann@ionos.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1709629179; a=rsa-sha256; cv=none; b=a9bELQaDKuP9+9moWTqtrXMf4LFC4JAtZU2YFVPOZgQzn4r+K8kUszlewfB6ExNc2b3rkx 2iP8JTRR+Qhojy2NDAaSAn3oLNy/e5N8hvuaauaBfvXqua2GYlsRnJU88ce9+ZYknOZ2bZ NlmfL+LzCrPPN8k/k/p+4hUx1ELR3hc= Received: by mail-ej1-f45.google.com with SMTP id a640c23a62f3a-a452877ddcaso257852566b.3 for ; Tue, 05 Mar 2024 00:59:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ionos.com; s=google; t=1709629177; x=1710233977; 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=yHNy+forpiTP10uEWDszfRKNVIJTNDDzicOChwXOTNY=; b=bCqXWWi1dktZaiJVyelZXah1mfC+Tgf5/wZrUjI3lPf26b9JTw3K+Jx0wckRUDFbyq Ck9C0Px9yN9qpbGZZcnF4jRe5BFj5ImtvhAvaaqcM8a7JSPFM659iOwfBSIUzEMsW9Pl Ql4n51/TX/hCVIF3VPy8blRZs6LX+PCuLecfHL1T17jBmmgnupUTYzvsqjm3t6s2b5d2 /2wll3qAB7gTqN7tBWK2QxSTaHWuGm+K3dk9Zz6KsSAc2Ea9W2vuMWXKBhE39cg6RLtr gG043YcGE1l9rCHeILOdOxiekijmeAfBoCYEiB1wuUNwgRev4gi4WD507Nj1OJNnFduR SVJA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709629177; x=1710233977; 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=yHNy+forpiTP10uEWDszfRKNVIJTNDDzicOChwXOTNY=; b=g6xW8tN/MtfcY4s97858j9V8pnY/c+ImuwyKqT72MDdqdApORa3ztvLr0DwITFcdiZ vxeqi+wYGZlAvoeFLgv7Ssf8dqYcnVqI6u8um+XJWaEwRNNZSBjddyCOfSLIiMUnaENq gq4y59+E4H8mSoxVbwnHhy6CR/tifqmxlJjV6QRQ1naXTZiJNNUfC30PskhuzG7OXZ/K m2qTVbYklZq1Kx0U7ImiCtcYyz+iVmVrcdX0Gr5M7Ruh/7aP6lhvnoRBKxTkPc/0I2Yl 3OeVO2m++xJmODt7MFgqKeiRTiWZxfP1Pwd/8f339bbcAKoGUUYHVpUOpCwJQYqhhRAs lrvg== X-Forwarded-Encrypted: i=1; AJvYcCWOanDw4IRjWltGWw/5yqVG4an2bDJLb2cIHP32rME+jSCiWV+S/GbviBJp/VJAq6cREEz5d7zWgljjvEoBARSmZZw= X-Gm-Message-State: AOJu0Yxgkf7Z0zHaQ4+Mr7TGZSqTjI6WgEKFO1LISWnMA0CKN5cRuLIH PoFKjxXaIxVyEz9ilcJ9xh+4sgvvi5ruD476LkNFn3tSvlMMmPGK0CFsJh9b2Mw= X-Google-Smtp-Source: AGHT+IFyEMaXcRKYaPhF1ktAQM4+jtLzlghr9ZNeqLIJk/JzZPpWzQgHVLLePNuDZ+0vJD35Sgn1CA== X-Received: by 2002:a17:906:d8c9:b0:a45:a7e1:62c3 with SMTP id re9-20020a170906d8c900b00a45a7e162c3mr665645ejb.70.1709629177775; Tue, 05 Mar 2024 00:59:37 -0800 (PST) Received: from raven.blarg.de (p200300dc6f010900023064fffe740809.dip0.t-ipconnect.de. [2003:dc:6f01:900:230:64ff:fe74:809]) by smtp.gmail.com with ESMTPSA id gs4-20020a170906f18400b00a449d12cdc5sm4453005ejb.119.2024.03.05.00.59.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Mar 2024 00:59:36 -0800 (PST) From: Max Kellermann To: akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: willy@infradead.org, sfr@canb.auug.org.au, Max Kellermann Subject: [PATCH v3 03/14] linux/mm.h: move page_kasan_tag() to mm/page_kasan_tag.h Date: Tue, 5 Mar 2024 09:59:08 +0100 Message-Id: <20240305085919.1601395-4-max.kellermann@ionos.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240305085919.1601395-1-max.kellermann@ionos.com> References: <20240305085919.1601395-1-max.kellermann@ionos.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: 138784000F X-Rspam-User: X-Rspamd-Server: rspam05 X-Stat-Signature: 7nkwx5zbeuyws73izba3c15apx4y45if X-HE-Tag: 1709629178-672799 X-HE-Meta: U2FsdGVkX187xLXKNvBQKUBlCNGCDN1wvC0ZZwYWzUfenaDVg7jeV0tw6HlogoWGYOJsV6KDlMq4Z5Bm7HogczahEZaKM0oEDS6BnG4GsICKJ7rFB+/HoEqdVA4sYjMN5gEsGuUn9EQyTNbWAj3Fawyr/z1hw8DVp4L+bjQ4KfFt3K8vu8PRFLsnkqVwReDzQ6SaWk4BcA2IyFVXTJ3TOeNXN3coHrVWGGJ014xrvMDUjNlnmcBX/90c/S55HP0VBxpyaS21LqKtkf1mE3MBYnJh7WoFTYKKKoQ91r1sS+55MZo/UBobHobYUqCc4DBGYbbaFZoXt1huU+iI/50BvLM2xD2NhGkTOx0f5CkGEsfxs/xljcFszd5Cq1eMg+UEAZCZlv658w2ix0t8At+lV7VcdLLp34mooua3I6TsFmENOiCk3UkNRaL6Ps1zRHkjdoIDqt3RNlEdl4Cu5210GwClwFFZmCAy7ppXf+OngjGWldqLtLwi8s2qFHrf3Yrg3phj4urX4i5GKU1bCO490S8wSTTiPhsmexHdZEGxDwA3akJXLS/u+/SlR+2qoGqPcv10qad6Eex1d7lpqT2oqiwZigiW1yFaT5GL9UlMrTydAfhHbdLtf+OBzFcXCH2AVzgI53cnZosOAtPqNKSuiBGNYi814KnszefnNQqOPlNwle2iM3j8w8MVon8hvMdZLI66E2LXpSbdTA8BjY0GBfUouINGwHY16aCs72xSme5V/HZJEJ0Jqa/bjH6g1J0XT9VafxqlIrcAYvnKH8wxdVsKniad2r/QGHYpO60QVeNA3NdgN0jMjvQcqryqT5K9ryj7Sd+XBRNlNYu1n2ZGJ9UprUcSW4GxSzlGEOXWJ5/qsIloyYVt46+aIaXicMmdT/tlHy+j6uieXc4O2VypcVdibTDDj26aS0ZMOlTAvUDj/C9AucHUh4+c3nOn2wG8XFw6Mi2S5eS2qFeTbRi VWGBMM5U wNlDWfg5g1Lme6HdlUOfVR3ifQbkj59suPvxQDBlLxCF1ONW6JnKeFetQ/lLzuhKECMhtnfWpEAsy/JB9OsD72a/K2WPFi2mNnau2FIso5FDwPA3FFNKRmpu8Yu3aqv6LwfBfX9Lq6Lye358hIPaMnPN9TtJhswVw8ikU 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 9e5bb60c55fe..dbfe08329154 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -14210,6 +14210,7 @@ F: include/linux/mempolicy.h F: include/linux/mempool.h F: include/linux/memremap.h F: include/linux/mm.h +F: include/linux/mm/*.h F: include/linux/mm_*.h F: include/linux/mmzone.h F: include/linux/mmu_notifier.h diff --git a/include/linux/mm.h b/include/linux/mm.h index 0436b919f1c7..e140ee45f49c 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -2,6 +2,7 @@ #ifndef _LINUX_MM_H #define _LINUX_MM_H +#include #include #include #include @@ -27,7 +28,6 @@ #include #include #include -#include #include #include @@ -1818,60 +1818,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 Mar 5 08:59:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Max Kellermann X-Patchwork-Id: 13581857 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 E49D3C54E41 for ; Tue, 5 Mar 2024 08:59:47 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 34BC16B008C; Tue, 5 Mar 2024 03:59:42 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 2F71A6B0093; Tue, 5 Mar 2024 03:59:42 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 14A796B0095; Tue, 5 Mar 2024 03:59:42 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id F1CDB6B008C for ; Tue, 5 Mar 2024 03:59:41 -0500 (EST) Received: from smtpin20.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id D40DF4024B for ; Tue, 5 Mar 2024 08:59:41 +0000 (UTC) X-FDA: 81862387362.20.AA89421 Received: from mail-ed1-f53.google.com (mail-ed1-f53.google.com [209.85.208.53]) by imf16.hostedemail.com (Postfix) with ESMTP id ECF4A180002 for ; Tue, 5 Mar 2024 08:59:39 +0000 (UTC) Authentication-Results: imf16.hostedemail.com; dkim=pass header.d=ionos.com header.s=google header.b=e9BrYIvU; spf=pass (imf16.hostedemail.com: domain of max.kellermann@ionos.com designates 209.85.208.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=1709629180; 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=9wE2HsEwQuIKqCaqriShH9hKkj+cYk+gvkRx/+6+3to=; b=oFmsCC6+Fn78DuSL0r3iZxGDPcObAP01bZN+j0jbJzNuQrXAZoCYpZTQR0vZYRGRi5sEgZ 1YzUSUc/aDufON2fx3pa6zThQQbFdqL+zc/YSbFKv8uO2oMkk+9mod/pU8JhrVH0xEbH2j O/j1ImUYf2zqiGoHcuDb376twjCLbgg= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1709629180; a=rsa-sha256; cv=none; b=O5PyLY16DjvyHMIgCFOR6gSEuVagxu0/or3QhOjHxNFTbSdERJUAJHS0ghE3al9KzrRGpK 6lXITQhSXwGTrknLfieMj9CyUs8m9wNnRoH46amHhJfjloeqqxiFhhvJjVdoFVq43WKiDL EcKGumNRfEQgaIxsGbLaihmINFBX28k= ARC-Authentication-Results: i=1; imf16.hostedemail.com; dkim=pass header.d=ionos.com header.s=google header.b=e9BrYIvU; spf=pass (imf16.hostedemail.com: domain of max.kellermann@ionos.com designates 209.85.208.53 as permitted sender) smtp.mailfrom=max.kellermann@ionos.com; dmarc=pass (policy=quarantine) header.from=ionos.com Received: by mail-ed1-f53.google.com with SMTP id 4fb4d7f45d1cf-565c6cf4819so10769554a12.1 for ; Tue, 05 Mar 2024 00:59:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ionos.com; s=google; t=1709629178; x=1710233978; 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=9wE2HsEwQuIKqCaqriShH9hKkj+cYk+gvkRx/+6+3to=; b=e9BrYIvUlHXFjeZO3Px/NjbknFAPqYhP8amcqWZDrokKFlDz7xeVVxmt2ROCaOhRJX ZZ4CuXLwqVZLQ6wyfJNqFynajT3oI4jFjZ9mBZ0giBP0H+KFoZ7Z5y6jRZrkEhtvZHJd /A6hVmzXxd+eYU4VpaTzaghgiZ7zE5iYb83w7iDCPU5AIUtKq7RAc0mKKyE5A4Y1kNCG XsBT9yeosdBbyXsvc4znZX/hIQjKrxSTNGu6pbGs9eBjZ80BFKUzjZyTYvwFChlgMumc nD9SGPNe0UiDFAhQs7/1ILMnnRv2oOMkonxO7H00VGSdIKzcPs0gvwL2m8VPLFnI2P2A i4pQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709629178; x=1710233978; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=9wE2HsEwQuIKqCaqriShH9hKkj+cYk+gvkRx/+6+3to=; b=AaDUvqekAJuaPRK6rD5AbBfErJJvssTPHKpPgznH6YT2U1v12Gc9Zf/WYVA4B2tm69 jwyrS91B2FyLoc+wNc7y2A6XsVP4ICmLY1f3F5KQZMmtrrEkG482AYzFkkrSSDyBEUK3 xecWhYa0qwvlC4WKzDjzBRiejuUEApBBFbcfvp8HUhvckMSJVIr4+VQRv8fKjNRHYawV ESu6cxLC6PQgQMGqhy2ykwgpxIuyEOuz3fa/LGApSM+1DfG4zecWlPO3fFSK3db7Gm/j x8/9VPRjIpuRORcdl+/Q8Zb42h+73Js7NBFqxKGnlLtD5ZK7se7vh5uR+X5pG1B8oZdV kqPw== X-Forwarded-Encrypted: i=1; AJvYcCWB8b4pvtV/tf9nrfVaNEEtMdk80F0RVVR50CKEgHnSjQ3Tz2IFwHMw0Kw3m+8++G+uwx8Tianfk/ylD4ebUrpw9Mk= X-Gm-Message-State: AOJu0YzRuouKrCRS4EVMliMIPNw6oCKjF2sKrOD8/HIvqMJGwxotIY/X 01v5KaZuBAuzOs3KlYz2FHHIUtxfUTPViOCoxO94IgxST02rTzw4mm3ggzhlpyg= X-Google-Smtp-Source: AGHT+IGclT8SPmvhKpvWUoSnvxxkyS58f2fpOwNpOo6zfJOP/D8VtwzwkRcJh8gYClLS0+CBEo/eNw== X-Received: by 2002:a17:906:6806:b0:a43:67fe:d484 with SMTP id k6-20020a170906680600b00a4367fed484mr2236562ejr.22.1709629178518; Tue, 05 Mar 2024 00:59:38 -0800 (PST) Received: from raven.blarg.de (p200300dc6f010900023064fffe740809.dip0.t-ipconnect.de. [2003:dc:6f01:900:230:64ff:fe74:809]) by smtp.gmail.com with ESMTPSA id gs4-20020a170906f18400b00a449d12cdc5sm4453005ejb.119.2024.03.05.00.59.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Mar 2024 00:59:38 -0800 (PST) From: Max Kellermann To: akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: willy@infradead.org, sfr@canb.auug.org.au, Max Kellermann Subject: [PATCH v3 04/14] linux/mm.h: move section functions to mm/page_section.h Date: Tue, 5 Mar 2024 09:59:09 +0100 Message-Id: <20240305085919.1601395-5-max.kellermann@ionos.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240305085919.1601395-1-max.kellermann@ionos.com> References: <20240305085919.1601395-1-max.kellermann@ionos.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: ECF4A180002 X-Rspam-User: X-Rspamd-Server: rspam11 X-Stat-Signature: kn7o7mwemkkzotgsaq53n8nrqaasgpg5 X-HE-Tag: 1709629179-69849 X-HE-Meta: U2FsdGVkX18SDU/Dubm5AyjB6aMTSSrF3ZRMZPBd2Wc1dIAtmg4woC8c3yTyRzbiSrEBo61/UX5sagIQU/qYcrnV2t2tvZIQKzjEJvILmlyGZSmi8OUFaLFYHeLqm0UJ6J3GPuTu7VUoWb/ZHSyC9wir21ySqnf/KkLW8AagM6ZDKOu7AgH3NE4b1v13Racw0PluD5H+H8DoXWnFdJ3I0RJa7nj5REDRS5BBo08oDl03qfBiNttidiFFhdmJkFVrP6SyamoUWBDNRsem3JF9TX3bMOs2fCtR5dCsaBxi3c7hIqQK14nAUEEyynA/EZFLaue8nBwz7TXENj06BKGkobhetKPmocCIJj6i8NatWE04D0rKrTIiNxoo3M7+8prz+a9FPnOES7APz/4FNneyGIqE/NyFH8IPLXpiPdX5Y8ikjIrOpIfQooFgt0zrB15fzDe99VzLrHnd9w36k3NdbzE+D0M8u9sHrOcaNIZDlyUsIXtNvqeVdpfkv95hxQ5RoS8Jh+z+Vnvtr5Hr16jbNGhvEswNGn6MvcYmfoBt3wP8g8aZpDdZ3l3GTyazhy1W8SRhpt4nE29tt3qjD00YP7DjtgbfmPvBgW5vNFSLxZH3kBwj0arczsnLb1ChhC5/E1g47InIIwARjK5FyUJb892wbgkY8Ex25c/Zcx/Uuj6j8TByipyqBLB7C7w3VSoc8WOXL7GWjf9osxtN94bQC8xZqJYpPDxiGC+C6O7gDooNTvRpgFIwIGX8OYLPjqmt8BMZPgoyNUTdq7yyEKglbNY8kdEXbJnzc58If+2pBBudEjfoFjwsJCGbrIDPID+aUXw7sojWPoMusFgdACOMwbcRQp/AMyTJucK+v9oSUL08ThWU/U7r0JEtIvqxcnNsptp8b1Z6oHtSrVK2OvxBKRvv0yyQw/AfIV9UhmbCg8Fsh/oQLhUzhrQ9A7lbWAXycyqfRNCqmGEHZ8x6HV3 jsS9mLYl Ctp5/IITR+qwoYzCcIrvVrTW7IB3pXaJEesDzwzVsPysv1B6Yks+Kp+/br0jnhdxJIr6kRsp2XwAdX7eyRieZsB2NBJTFK9pUcI64cMMeKg0MxgNpMyrh31FikzcxFZ9OGQGgCfsl/jiB+ymlee44KpNQJ4JRZ7UJKO+Jp5fUN+XVdyn804KZkYZz95R3Bz4T7ua7lneAKjfbtAb6t2qeqK0/EPUCYVD6teIY488Oc5RIEwJMlhve/5HfJLj5d5zvzN/D50xUlqmf40cyXDCMR4TgsbugovCKCd1m8zHCD2Y7c1lqNu2EtOMWUm+mcvQeT2Ak8R6i4uzdP/L4ayr24+wYaQ3NDzzXomfHaTu8kx6RC8+jy4UmYLJSuY7ntoJDOjKYFRzk4ute+JzY8B/7O/GxcvLZPjf0mssmRdO0NcWEEWo= 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 e140ee45f49c..79c1f924d4b5 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -3,6 +3,7 @@ #define _LINUX_MM_H #include +#include #include #include #include @@ -1637,10 +1638,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 @@ -1838,19 +1835,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 Mar 5 08:59:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Max Kellermann X-Patchwork-Id: 13581858 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 D74B1C54E41 for ; Tue, 5 Mar 2024 08:59:50 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 655C26B0095; Tue, 5 Mar 2024 03:59:43 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 605576B0096; Tue, 5 Mar 2024 03:59:43 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 47E3A940007; Tue, 5 Mar 2024 03:59:43 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 2E9516B0095 for ; Tue, 5 Mar 2024 03:59:43 -0500 (EST) Received: from smtpin12.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 0A9AE1C0E29 for ; Tue, 5 Mar 2024 08:59:43 +0000 (UTC) X-FDA: 81862387446.12.3597B24 Received: from mail-ed1-f50.google.com (mail-ed1-f50.google.com [209.85.208.50]) by imf13.hostedemail.com (Postfix) with ESMTP id 45A7E2000B for ; Tue, 5 Mar 2024 08:59:41 +0000 (UTC) Authentication-Results: imf13.hostedemail.com; dkim=pass header.d=ionos.com header.s=google header.b=H2rW9Uro; dmarc=pass (policy=quarantine) header.from=ionos.com; spf=pass (imf13.hostedemail.com: domain of max.kellermann@ionos.com designates 209.85.208.50 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=1709629181; 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=9QtTxRX/inj0OtKTHCIe6FPb0V6jffrKP/nT087XKzU=; b=fM+KH+OrV+b3QRWXAyI775yEI6KXUhVikvIowecwmEyc5+gtuX8F+j5WXe6CDgAp+BP82A xVXibvzsAMGCJqu5kP8EJ5xSNgHh1PT1F60HPn3/AyPj/wq7Teg3jnrw9I5za8nQd1ZiA0 rq2nR/5Q9mhRFbDy8YAyjJ1RHyI5sSI= ARC-Authentication-Results: i=1; imf13.hostedemail.com; dkim=pass header.d=ionos.com header.s=google header.b=H2rW9Uro; dmarc=pass (policy=quarantine) header.from=ionos.com; spf=pass (imf13.hostedemail.com: domain of max.kellermann@ionos.com designates 209.85.208.50 as permitted sender) smtp.mailfrom=max.kellermann@ionos.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1709629181; a=rsa-sha256; cv=none; b=qXTEpm40qJTHTGAyPP+Q3SYYeudL+fguvL631yI1WMiIrkQjtPYGxnMq99qO8TwJH91UJl YSK+7Xw+GFcvnnwxjtcBc3/yXehYP5hv9YXSH+aXhSeqahUD/z/y9RMmWd526GSE++0Z6m uvU4hhHHdpllIeL2WVO2KTwFKf0D87o= Received: by mail-ed1-f50.google.com with SMTP id 4fb4d7f45d1cf-5654f700705so7369280a12.1 for ; Tue, 05 Mar 2024 00:59:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ionos.com; s=google; t=1709629180; x=1710233980; 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=9QtTxRX/inj0OtKTHCIe6FPb0V6jffrKP/nT087XKzU=; b=H2rW9Uro4FBdAebwUX38ib1NFXuLW/L7stA6CuTTBRTUqZ3xe7tx/juS8lj2QpDzuC nYqR8qkMn7Ymk8cHPA1E/nkgCmfqKqW+Zis+jq+IJxBj/Ka+6rGhacfRvLY2Mru6IrPv piEm0aQRoQiDL7JuwmEXF7kZ22x41Wx5dVcfZxAizg9t2gTInqb3fXrh94FnGq3uQQYE 4f1Jpi1hjZykHlvWrELrAhrfn4xvIoG2KzpBsTkABkpN8l2Yz3i242uysHnGNFi9sKvC cpa9wsEh3PqkPFu70fetwj2inqwxpXx+UgSEd3tfmewL4MC4G8BGZ5YHZ1dEVO2OW20q 9bIA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709629180; x=1710233980; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=9QtTxRX/inj0OtKTHCIe6FPb0V6jffrKP/nT087XKzU=; b=BG87Pvtkev0187qFz4FpNV86O9xOH3UuOBJ3ORj5meMHarEBW/HqH8OnqEbCVQEDI1 hIoFoi7Ala/TRWl+JZWBI2Pq2QWOoYh4Kv3dimg1n2CEsOJmIEYQ0cThUOgDmMdHtViS mcWQtgEa5fz7FSAp6t2gwuP1poervAjN9gqT8O6tKf3dNdhw/f/zvRIQQDogMgAtf7sF Rgnw8BL5Vo6cFOxOm9y/6B6/FYAPxlKU5il7uYznLxPbKBCJ+jnDQF9VPZui1F22ZRYn eyVRQWEAi1ohNQcGN+3Ngb99MXalLe9+f0ltN3xMWCl3pFfeivSlPNdQIH7XZDRI475o GogA== X-Forwarded-Encrypted: i=1; AJvYcCXxNyJxKEpsC34878WUJBRixyjH46L8d9gO4NKgzuIYarrXomzAwMMrHOAhb4jvKkmQI3Yk1h/Q7HTiLEClckqnCy4= X-Gm-Message-State: AOJu0YxV7lbcPhV7LX1NLcs9zpdp97uiB3aOpnlDE6TeMb5dV4P2BSP5 yNbYv/KUHq6wlH9TUaqQY+5fIsy+mH7RiohjlaPUhm9EPkJmO3O+5q1Aef3lJEY= X-Google-Smtp-Source: AGHT+IGLVXgC2Q8vwJVeBVQ7VcbMya+GmcQDX1B/t3cUkKCgkZulprKrnzJI+ititEHBWTC1kz24QQ== X-Received: by 2002:a17:906:3442:b0:a44:3ec9:1fd3 with SMTP id d2-20020a170906344200b00a443ec91fd3mr6469936ejb.30.1709629179998; Tue, 05 Mar 2024 00:59:39 -0800 (PST) Received: from raven.blarg.de (p200300dc6f010900023064fffe740809.dip0.t-ipconnect.de. [2003:dc:6f01:900:230:64ff:fe74:809]) by smtp.gmail.com with ESMTPSA id gs4-20020a170906f18400b00a449d12cdc5sm4453005ejb.119.2024.03.05.00.59.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Mar 2024 00:59:38 -0800 (PST) From: Max Kellermann To: akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: willy@infradead.org, sfr@canb.auug.org.au, Max Kellermann Subject: [PATCH v3 05/14] linux/mm.h: move page_address() and others to mm/page_address.h Date: Tue, 5 Mar 2024 09:59:10 +0100 Message-Id: <20240305085919.1601395-6-max.kellermann@ionos.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240305085919.1601395-1-max.kellermann@ionos.com> References: <20240305085919.1601395-1-max.kellermann@ionos.com> MIME-Version: 1.0 X-Rspam-User: X-Stat-Signature: b57nrx93xwu4kwsus73cexni3q6pbn1h X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 45A7E2000B X-HE-Tag: 1709629181-272469 X-HE-Meta: U2FsdGVkX18yre75EUYMCS1lJiKd/0q5G2O0qimCvF+TkUo9QqyxAXOlH7tmtWMEnt4V83SSkd3NtcnpH672yGLTT9GtPYbW/LOjaTUGN4qJjtDx4L+dZIA2bv44QGp/UvF8kAzo0o3G4uWrXKE1bYt1GYKFoIpq1MdYRpHVDbWEirBm4fpE2VBebiPM+5aogtqa7qGtpIWD2AY21Vn3QMcqNf6wyQgee0KLoxVlFi/ir21Bh1hz+KLW2E+oCeCdQ8Pza9c4+JsityHSZbG7INb6eCxC1cMjhqEgzefUonuz62ZL4Z+hZ1ab1dsUG43kJEfnP/19CAsMDc0XUyO8uECsDEdFXpha+8lh7jOVrtiRbv5eCKdNdq005VrxqF3FceapPS2LxEqCsocJ90JW3Pv9WNnX8v4ij5tFT+OL1vF41PO+AUHw3TF1ZMxRDLIM6A0Lz128s/iAI7gjUXNsKm/CtNF3uW1D4zxQMNAPopSGUDeMN+3O+B6t6kA5nXtGS+CzQTYLkt0cve9mR/TM6vyUY85bFON+fjqr1VH3Ebu6wENKz9xMwzChq3D5mhPrTTYWVr5ZEeqjULuB3AhPn75MZtpbT+Xxq7dnP7zJCoQ9RZ8hy9IaaRpCVxt4KDYPOR9vFSF3RhFi3PQDt4H3HbIDpLVKHYomZE0LmN30Br9FASDN/2ALURQP8P4pgAZRAd7e6XOKz97SKpR9c5nHFeUTGqvVwCl+fKWL/LonWjKJCn5GtBYpfbb5jgZbAYddCs4uGuZM5YQ12oU4Qu2Lv6d6wfS9SS7IKBWXXD6gfQqLmPsX3r+v64ftz6We7UvQLxgONKOXvH3G+JnqQCdov5ebEeexLb8jRO5R+Nn86CI1jhAIZQzll7nGBKadCUdxwkGlTDxFpT76Jh+A8gy5QSoQYJKvmwIVS2BYWWZ1rzdz0rGzKMst5WL72NXrKb43r8d/h0IS0DEfVVwFTHE uaj9RXsO 1A7kSbH0h0ATjXaSaNzRojXvYr1fFbeUeEhljlIfODI7ympe+Ni2pqFs/B/FS67PmM2DLtWsRNy3NoLsS729rwpSvcN4uHasBtB/Dx2jH00JAFjVOP7/VTwZapRF0jfzz5jw5Mpsguab4m8pF/6PB1Ysq8uN5AXWTTVzT 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 79c1f924d4b5..713cedc03b88 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -2,7 +2,7 @@ #ifndef _LINUX_MM_H #define _LINUX_MM_H -#include +#include #include #include #include @@ -104,10 +104,6 @@ extern int mmap_rnd_compat_bits __read_mostly; #define __pa_symbol(x) __pa(RELOC_HIDE((unsigned long)(x), 0)) #endif -#ifndef page_to_virt -#define page_to_virt(x) __va(PFN_PHYS(page_to_pfn(x))) -#endif - #ifndef lm_alias #define lm_alias(x) __va(__pa_symbol(x)) #endif @@ -211,14 +207,6 @@ int overcommit_kbytes_handler(struct ctl_table *, int, void *, size_t *, int overcommit_policy_handler(struct ctl_table *, int, void *, size_t *, loff_t *); -#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) @@ -2137,44 +2125,6 @@ static inline int arch_make_folio_accessible(struct folio *folio) */ #include -static __always_inline void *lowmem_page_address(const struct page *page) -{ - return page_to_virt(page); -} - -#if defined(CONFIG_HIGHMEM) && !defined(WANT_PAGE_VIRTUAL) -#define HASHED_PAGE_VIRTUAL -#endif - -#if defined(WANT_PAGE_VIRTUAL) -static inline void *page_address(const struct page *page) -{ - return page->virtual; -} -static inline void set_page_address(struct page *page, void *address) -{ - page->virtual = address; -} -#define page_address_init() do { } while(0) -#endif - -#if defined(HASHED_PAGE_VIRTUAL) -void *page_address(const struct page *page); -void set_page_address(struct page *page, void *virtual); -void page_address_init(void); -#endif - -#if !defined(HASHED_PAGE_VIRTUAL) && !defined(WANT_PAGE_VIRTUAL) -#define page_address(page) lowmem_page_address(page) -#define set_page_address(page, address) do { } while(0) -#define page_address_init() do { } while(0) -#endif - -static inline void *folio_address(const struct folio *folio) -{ - return page_address(&folio->page); -} - extern pgoff_t __page_file_index(struct page *page); /* @@ -2237,10 +2187,6 @@ static inline void clear_page_pfmemalloc(struct page *page) */ extern void pagefault_out_of_memory(void); -#define offset_in_page(p) ((unsigned long)(p) & ~PAGE_MASK) -#define offset_in_thp(page, p) ((unsigned long)(p) & (thp_size(page) - 1)) -#define offset_in_folio(folio, p) ((unsigned long)(p) & (folio_size(folio) - 1)) - /* * Parameter block passed down to zap_pte_range in exceptional cases. */ diff --git a/include/linux/mm/page_address.h b/include/linux/mm/page_address.h new file mode 100644 index 000000000000..e1aaacc5003f --- /dev/null +++ b/include/linux/mm/page_address.h @@ -0,0 +1,71 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef _LINUX_MM_PAGE_ADDRESS_H +#define _LINUX_MM_PAGE_ADDRESS_H + +#include // for struct page +#include // needed by the page_to_virt() macro on some architectures (e.g. arm64) +#include // for PAGE_MASK, page_to_virt() + +#if defined(CONFIG_FLATMEM) +#include // for memmap (used by __pfn_to_page()) +#elif defined(CONFIG_SPARSEMEM_VMEMMAP) +#include // for vmemmap (used by __pfn_to_page()) +#elif defined(CONFIG_SPARSEMEM) +#include // for page_to_section() (used by __page_to_pfn()) +#endif + +#ifndef page_to_virt +#define page_to_virt(x) __va(PFN_PHYS(page_to_pfn(x))) +#endif + +#if defined(CONFIG_SPARSEMEM) && !defined(CONFIG_SPARSEMEM_VMEMMAP) +#define nth_page(page,n) pfn_to_page(page_to_pfn((page)) + (n)) +#define folio_page_idx(folio, p) (page_to_pfn(p) - folio_pfn(folio)) +#else +#define nth_page(page,n) ((page) + (n)) +#define folio_page_idx(folio, p) ((p) - &(folio)->page) +#endif + +static __always_inline void *lowmem_page_address(const struct page *page) +{ + return page_to_virt(page); +} + +#if defined(CONFIG_HIGHMEM) && !defined(WANT_PAGE_VIRTUAL) +#define HASHED_PAGE_VIRTUAL +#endif + +#if defined(WANT_PAGE_VIRTUAL) +static inline void *page_address(const struct page *page) +{ + return page->virtual; +} +static inline void set_page_address(struct page *page, void *address) +{ + page->virtual = address; +} +#define page_address_init() do { } while(0) +#endif + +#if defined(HASHED_PAGE_VIRTUAL) +void *page_address(const struct page *page); +void set_page_address(struct page *page, void *virtual); +void page_address_init(void); +#endif + +#if !defined(HASHED_PAGE_VIRTUAL) && !defined(WANT_PAGE_VIRTUAL) +#define page_address(page) lowmem_page_address(page) +#define set_page_address(page, address) do { } while(0) +#define page_address_init() do { } while(0) +#endif + +static inline void *folio_address(const struct folio *folio) +{ + return page_address(&folio->page); +} + +#define offset_in_page(p) ((unsigned long)(p) & ~PAGE_MASK) +#define offset_in_thp(page, p) ((unsigned long)(p) & (thp_size(page) - 1)) +#define offset_in_folio(folio, p) ((unsigned long)(p) & (folio_size(folio) - 1)) + +#endif /* _LINUX_MM_PAGE_ADDRESS_H */ From patchwork Tue Mar 5 08:59:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Max Kellermann X-Patchwork-Id: 13581859 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 78D27C54E41 for ; Tue, 5 Mar 2024 08:59:54 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C23936B0096; Tue, 5 Mar 2024 03:59:44 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id B0CC7940007; Tue, 5 Mar 2024 03:59:44 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 987F06B0099; Tue, 5 Mar 2024 03:59:44 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 845996B0096 for ; Tue, 5 Mar 2024 03:59:44 -0500 (EST) Received: from smtpin27.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 508F1140DB3 for ; Tue, 5 Mar 2024 08:59:44 +0000 (UTC) X-FDA: 81862387488.27.2D8DD4A Received: from mail-ej1-f54.google.com (mail-ej1-f54.google.com [209.85.218.54]) by imf24.hostedemail.com (Postfix) with ESMTP id 85564180011 for ; Tue, 5 Mar 2024 08:59:42 +0000 (UTC) Authentication-Results: imf24.hostedemail.com; dkim=pass header.d=ionos.com header.s=google header.b=gCYA62bS; dmarc=pass (policy=quarantine) header.from=ionos.com; spf=pass (imf24.hostedemail.com: domain of max.kellermann@ionos.com designates 209.85.218.54 as permitted sender) smtp.mailfrom=max.kellermann@ionos.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1709629182; a=rsa-sha256; cv=none; b=bnub4sbnKmRtLkaJK+UBwvoWXPufhERHNfyY13bE1NOK1xePyhHaaHmH/r72LCc643Y1ed j3+NAdX1Ej1SPJmRBqzhJEmOT9uHNPturEv2vcVUjNhnSNfY0rYCt97tL/w/wvz1sJNBCP l0oQce4XStz76QmRYqaU9m1FWMlY9cs= ARC-Authentication-Results: i=1; imf24.hostedemail.com; dkim=pass header.d=ionos.com header.s=google header.b=gCYA62bS; dmarc=pass (policy=quarantine) header.from=ionos.com; spf=pass (imf24.hostedemail.com: domain of max.kellermann@ionos.com designates 209.85.218.54 as permitted sender) smtp.mailfrom=max.kellermann@ionos.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1709629182; 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=pOCd08dVcNL3Vsd080U9IACgrN+4/kX0/WIiYLCuiY0=; b=vRU4ObWmTomh5k2VdOO2eLBqMu7PfT3tWOMggfY0/kgZX9rrR6tU259oAQOR/bY7oNcseY OI2LrrnndR2nGho6PxE2JpnbtflLXk86f8OeWKsLh5r35gqm6lwyDyJz9pWCeXwa/7P0bU Fjt7XS88nkWkghBvvfsLGrAtinMrT0o= Received: by mail-ej1-f54.google.com with SMTP id a640c23a62f3a-a26ed1e05c7so908069366b.2 for ; Tue, 05 Mar 2024 00:59:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ionos.com; s=google; t=1709629181; x=1710233981; 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=pOCd08dVcNL3Vsd080U9IACgrN+4/kX0/WIiYLCuiY0=; b=gCYA62bSrU5rOrEIKMg1Urm89GHk4Zj2lxoje7sJw8bDaoNtPt/xuJMyxDXMAYDaws kx+g3wdqPtWz1PLT93sdUVkbKufu/ue3ky4bd2EtfvReBQ6qWa9Pa83PqIYcwQh4mF31 KIye1Uvn4yqI3ASvsV6LGNd06w+/R8GvdDWJ/T55a6bWWQSo3itsRJJYm5ppV3ydvitd YMVU1+ol0/wqQilKqlYcE6CodWMc6jX07jdiGL2Ro+6pvP4fJO5cSqobJjmosuzEKws/ u1EsCerHeAZ9sB0bHtKg+QQV0T7zlY7i+9KGvmEa97C/V+ey7kuz2Hl/rywculQepKnG o6vw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709629181; x=1710233981; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=pOCd08dVcNL3Vsd080U9IACgrN+4/kX0/WIiYLCuiY0=; b=tsIAREsSGHshSbk9GgUB1GGr8eQS7DckQ5TTulqmDdSOxSejKWkKAhqha9ZkIX58GZ i+ELz9UfKj4Vpkhu2s73Swsr4MjUUdL+mE8fPCx4srl6nTzKu2oI73Yg+dNzJi2eLQZP +1u6JcK81pgMPWJK2Pqshignz1rRBW9LaqNFLUHGZY2vDEvYDHDJvS39mZFh3NGRzrns cUK/g4v14l8JJ9EbV/x8NJ+BlvHriYt4zBZEC2A9cFoun4sSBxcNnm5uilGiX5KqV1Wh f5O3V0lVMB0+LFZUmx5YcJ0ih+B+oW3bnL00a2zHZGemmIMqtTP60HVKm13EHi7hb9i8 eSYQ== X-Forwarded-Encrypted: i=1; AJvYcCWV2Mqn53ipN+Yaij3csK4Kceeac5fBqnyfVTC3H0mG7/4Hvm2QqrVt3FRqKmCKhG16IgFDH73zcQZ07tLDqWKLVR0= X-Gm-Message-State: AOJu0Yx2K1f2s/c7gbLAuqmTPCabe1rMUUHhZ/UuAEHRumcJKCWsCgVV uvTT3OK1AK50UAb3ZNM2LvbiUbZ0ixv9i1baMgwCM6vJE7/oBKFVKyFqgm9/AuFslssK/Ms63T+ b X-Google-Smtp-Source: AGHT+IGqfqDUczGGo3QetAY7OAT6x3XRZvle5Qp1hnV3EYWTVeS5PH/gGnq4+ZcDT1bZzO9ng+chBA== X-Received: by 2002:a17:906:ca46:b0:a3f:2ef9:598a with SMTP id jx6-20020a170906ca4600b00a3f2ef9598amr7729507ejb.36.1709629180945; Tue, 05 Mar 2024 00:59:40 -0800 (PST) Received: from raven.blarg.de (p200300dc6f010900023064fffe740809.dip0.t-ipconnect.de. [2003:dc:6f01:900:230:64ff:fe74:809]) by smtp.gmail.com with ESMTPSA id gs4-20020a170906f18400b00a449d12cdc5sm4453005ejb.119.2024.03.05.00.59.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Mar 2024 00:59:40 -0800 (PST) From: Max Kellermann To: akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: willy@infradead.org, sfr@canb.auug.org.au, Max Kellermann Subject: [PATCH v3 06/14] linux/mm.h: move folio_size(), ... to mm/folio_size.h Date: Tue, 5 Mar 2024 09:59:11 +0100 Message-Id: <20240305085919.1601395-7-max.kellermann@ionos.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240305085919.1601395-1-max.kellermann@ionos.com> References: <20240305085919.1601395-1-max.kellermann@ionos.com> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: 85564180011 X-Stat-Signature: c9wm4o9jz6y58n1jwerfcq7xgy41qbi1 X-HE-Tag: 1709629182-973564 X-HE-Meta: U2FsdGVkX18OMgsJLyNc2/T1NwSAjRiRrhw2oWM5KVIk58dntI1QL0N6bHsON9bFNc986Uy0Annhd6qFFPgDiQeFEascJkQHHmLZO0UBuNbG6SwOrrV9xA3ykoacaW7BDzm6jrYq7n1t+YA4GiX+ByUalrBdVUK75GZi25BRfyKTQzngFMO1z/pZXmIvw3mhkgNGXETjB7IA1zXWDJvGEzHNDw8bKr2Rn6rgYbu13O65n8I/ERXa4GDbFNPtCyXseN0LJwdPFRkMmU60F3NyICd10t5dDPoSnacdOVKVrKveQKYFJz3uZGv48mWBshUUcZucUppfQa3kgGHiIOdfYfO6dZ4f97YVevWtX2gwn142tcw4tdshEjbIYT/FzSJYsEPFy7N2jsyXVxmpf0/eEF/tz/GYkpIFHouqIAc0J7M1iE/6Gzu8eveaRCfVcdprfjXf9tvsx9DI4sFW3cYlv6nSEy4G+nlMNMkErVbQVJX+iqbd0rkORODpR8/vMN3IaGHinuykGyVV+tq2S1pfrxnl2cEoOQoyfUtTW/ZahtvfNVXSqGuxyDkNnPvqV3Rr5Tk68NMIrfsdGU8J0NR3ZyJQIYktLcP1X296sAfgvO0MB5ajFb66VwNlyLe0LIFIR3jjT27VyHc084OxU1d1ximWA/M5zhRNUouB9KvDWbjJBtKy31wLqKLxcu+XxBIBK24w9wpKutbnN9tqvblwARIBSdOqU3DoVs/txhJjWF6+EwvGxaMiP09/2QIAEnAMOPUmhSIxyTKZVvPMvb01WcJ+fyR6ZFZfXQ9ErrRtOjwiDwUYlZZILnFHNRz9ml4/zHy9jgMQtKueIqbj7QNb7LGpC0mNaQFGzp02K0dtxU56JaX4mQXm9Fx+U3NWtj5QLNIl7ij3S0YXfbJ/qNDapAzOAxf+Q8xZQUjFYZCGlToDEpJCvRCx1AKbesttuHPCHAwN67JX5fEHAYb4Vb1 6TG4rxOZ So6ettD6X8NMNLqviDJscEOdPHczGPNLkMTAEfq/HSbF+iSyAoOi8pqc1UmKjxXdKo4EaBSq9y4XLu736RSZcXg8D5nqvBN4MvTR8stIDGZnGtcE4TXtfiFPw2QZgUn2z0sKD5rZtz6RCdIXyQqFAJ5rkSfDjXhNOc8zm 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 713cedc03b88..0d291ff61db3 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -2,6 +2,7 @@ #ifndef _LINUX_MM_H #define _LINUX_MM_H +#include #include #include #include @@ -1068,38 +1069,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 /* @@ -1306,39 +1275,6 @@ unsigned long nr_free_buffer_pages(void); void destroy_large_folio(struct folio *folio); -/* Returns the number of bytes in this potentially compound page. */ -static inline unsigned long page_size(struct page *page) -{ - return PAGE_SIZE << compound_order(page); -} - -/* Returns the number of bits needed for the number of bytes in a page */ -static inline unsigned int page_shift(struct page *page) -{ - return PAGE_SHIFT + compound_order(page); -} - -/** - * thp_order - Order of a transparent huge page. - * @page: Head page of a transparent huge page. - */ -static inline unsigned int thp_order(struct page *page) -{ - VM_BUG_ON_PGFLAGS(PageTail(page), page); - return compound_order(page); -} - -/** - * thp_size - Size of a transparent huge page. - * @page: Head page of a transparent huge page. - * - * Return: Number of bytes in this page. - */ -static inline unsigned long thp_size(struct page *page) -{ - return PAGE_SIZE << thp_order(page); -} - #ifdef CONFIG_MMU /* * Do pte_mkwrite, but only if the vma says VM_WRITE. We do this when @@ -1979,23 +1915,6 @@ static inline void set_page_links(struct page *page, enum zone_type zone, #endif } -/** - * folio_nr_pages - The number of pages in the folio. - * @folio: The folio. - * - * Return: A positive power of two. - */ -static inline long folio_nr_pages(struct folio *folio) -{ - if (!folio_test_large(folio)) - return 1; -#ifdef CONFIG_64BIT - return folio->_folio_nr_pages; -#else - return 1L << (folio->_flags_1 & 0xff); -#endif -} - /* Only hugetlbfs can allocate folios larger than MAX_ORDER */ #ifdef CONFIG_ARCH_HAS_GIGANTIC_PAGE #define MAX_FOLIO_NR_PAGES (1UL << PUD_ORDER) @@ -2003,33 +1922,6 @@ static inline long folio_nr_pages(struct folio *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. @@ -2049,36 +1941,6 @@ static inline struct folio *folio_next(struct folio *folio) return (struct folio *)folio_page(folio, folio_nr_pages(folio)); } -/** - * folio_shift - The size of the memory described by this folio. - * @folio: The folio. - * - * A folio represents a number of bytes which is a power-of-two in size. - * This function tells you which power-of-two the folio is. See also - * folio_size() and folio_order(). - * - * Context: The caller should have a reference on the folio to prevent - * it from being split. It is not necessary for the folio to be locked. - * Return: The base-2 logarithm of the size of this folio. - */ -static inline unsigned int folio_shift(struct folio *folio) -{ - return PAGE_SHIFT + folio_order(folio); -} - -/** - * folio_size - The number of bytes in a folio. - * @folio: The folio. - * - * Context: The caller should have a reference on the folio to prevent - * it from being split. It is not necessary for the folio to be locked. - * Return: The number of bytes in this folio. - */ -static inline size_t folio_size(struct folio *folio) -{ - return PAGE_SIZE << folio_order(folio); -} - /** * folio_estimated_sharers - Estimate the number of sharers of a folio. * @folio: The folio. diff --git a/include/linux/mm/folio_size.h b/include/linux/mm/folio_size.h new file mode 100644 index 000000000000..dd8af39ef572 --- /dev/null +++ b/include/linux/mm/folio_size.h @@ -0,0 +1,150 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef _LINUX_MM_FOLIO_SIZE_H +#define _LINUX_MM_FOLIO_SIZE_H + +#include // for test_bit() +#include // for VM_BUG_ON_PGFLAGS() +#include // for struct page +#include // for folio_test_large() +#include // for PAGE_SIZE, PAGE_SHIFT + +/* + * compound_order() can be called without holding a reference, which means + * that niceties like page_folio() don't work. These callers should be + * prepared to handle wild return values. For example, PG_head may be + * set before the order is initialised, or this may be a tail page. + * See compaction.c for some good examples. + */ +static inline unsigned int compound_order(struct page *page) +{ + struct folio *folio = (struct folio *)page; + + if (!test_bit(PG_head, &folio->flags)) + return 0; + return folio->_flags_1 & 0xff; +} + +/** + * folio_order - The allocation order of a folio. + * @folio: The folio. + * + * A folio is composed of 2^order pages. See get_order() for the definition + * of order. + * + * Return: The order of the folio. + */ +static inline unsigned int folio_order(struct folio *folio) +{ + if (!folio_test_large(folio)) + return 0; + return folio->_flags_1 & 0xff; +} + +/* Returns the number of bytes in this potentially compound page. */ +static inline unsigned long page_size(struct page *page) +{ + return PAGE_SIZE << compound_order(page); +} + +/* Returns the number of bits needed for the number of bytes in a page */ +static inline unsigned int page_shift(struct page *page) +{ + return PAGE_SHIFT + compound_order(page); +} + +/** + * thp_order - Order of a transparent huge page. + * @page: Head page of a transparent huge page. + */ +static inline unsigned int thp_order(struct page *page) +{ + VM_BUG_ON_PGFLAGS(PageTail(page), page); + return compound_order(page); +} + +/** + * thp_size - Size of a transparent huge page. + * @page: Head page of a transparent huge page. + * + * Return: Number of bytes in this page. + */ +static inline unsigned long thp_size(struct page *page) +{ + return PAGE_SIZE << thp_order(page); +} + +/** + * folio_nr_pages - The number of pages in the folio. + * @folio: The folio. + * + * Return: A positive power of two. + */ +static inline long folio_nr_pages(struct folio *folio) +{ + if (!folio_test_large(folio)) + return 1; +#ifdef CONFIG_64BIT + return folio->_folio_nr_pages; +#else + return 1L << (folio->_flags_1 & 0xff); +#endif +} + +/* + * compound_nr() returns the number of pages in this potentially compound + * page. compound_nr() can be called on a tail page, and is defined to + * return 1 in that case. + */ +static inline unsigned long compound_nr(struct page *page) +{ + struct folio *folio = (struct folio *)page; + + if (!test_bit(PG_head, &folio->flags)) + return 1; +#ifdef CONFIG_64BIT + return folio->_folio_nr_pages; +#else + return 1L << (folio->_flags_1 & 0xff); +#endif +} + +/** + * thp_nr_pages - The number of regular pages in this huge page. + * @page: The head page of a huge page. + */ +static inline int thp_nr_pages(struct page *page) +{ + return folio_nr_pages((struct folio *)page); +} + +/** + * folio_shift - The size of the memory described by this folio. + * @folio: The folio. + * + * A folio represents a number of bytes which is a power-of-two in size. + * This function tells you which power-of-two the folio is. See also + * folio_size() and folio_order(). + * + * Context: The caller should have a reference on the folio to prevent + * it from being split. It is not necessary for the folio to be locked. + * Return: The base-2 logarithm of the size of this folio. + */ +static inline unsigned int folio_shift(struct folio *folio) +{ + return PAGE_SHIFT + folio_order(folio); +} + +/** + * folio_size - The number of bytes in a folio. + * @folio: The folio. + * + * Context: The caller should have a reference on the folio to prevent + * it from being split. It is not necessary for the folio to be locked. + * Return: The number of bytes in this folio. + */ +static inline size_t folio_size(struct folio *folio) +{ + return PAGE_SIZE << folio_order(folio); +} + +#endif /* _LINUX_MM_FOLIO_SIZE_H_H */ From patchwork Tue Mar 5 08:59:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Max Kellermann X-Patchwork-Id: 13581860 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 AFFFFC54798 for ; Tue, 5 Mar 2024 08:59:57 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 2D45A6B0098; Tue, 5 Mar 2024 03:59:46 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 25CC26B0099; Tue, 5 Mar 2024 03:59:46 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0E0E96B009A; Tue, 5 Mar 2024 03:59:46 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id EBFA06B0098 for ; Tue, 5 Mar 2024 03:59:45 -0500 (EST) Received: from smtpin15.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id C7C6A1C09B9 for ; Tue, 5 Mar 2024 08:59:45 +0000 (UTC) X-FDA: 81862387530.15.A5F18D9 Received: from mail-ej1-f51.google.com (mail-ej1-f51.google.com [209.85.218.51]) by imf16.hostedemail.com (Postfix) with ESMTP id D939A180006 for ; Tue, 5 Mar 2024 08:59:43 +0000 (UTC) Authentication-Results: imf16.hostedemail.com; dkim=pass header.d=ionos.com header.s=google header.b=JtfdMlLV; dmarc=pass (policy=quarantine) header.from=ionos.com; spf=pass (imf16.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=1709629184; 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=tPRAHmknVEgQF0+eI0cWSAplWfhzwY2EyeY5NbL7yXE=; b=qbbO1SYKJGgHqivxmAMJbptZ/kgrvCtb30/qImDjqAmf4gkJdDv171aaClyKUmXXLTb/AE 2CJAtQEMO2IC3sMIQcLl8xENl85NeTabkv3hZB2NDPTTmSH7QxpSSWIpktW7v6mYdA9QgW gK+nCJO92sXYeOa5rxe97RVGA1a2PxE= ARC-Authentication-Results: i=1; imf16.hostedemail.com; dkim=pass header.d=ionos.com header.s=google header.b=JtfdMlLV; dmarc=pass (policy=quarantine) header.from=ionos.com; spf=pass (imf16.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=1709629184; a=rsa-sha256; cv=none; b=w3qMXVa9tqdPYo8UAu1EpX7KgNNy52uT+LVEhVNA/IbrbLb0+ziFVbBrT2Np+Akl8e4QnU TBfmV5J+ZW3/D6J6DTufICpCbGbVRjMI0d6VJTkFCwl+UnY728YvLP5hIXr8s0rMSNpHZQ bKUq2Ox0acwR3HK/EJpditgl3ylx8vY= Received: by mail-ej1-f51.google.com with SMTP id a640c23a62f3a-a3f893ad5f4so801684366b.2 for ; Tue, 05 Mar 2024 00:59:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ionos.com; s=google; t=1709629182; x=1710233982; 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=tPRAHmknVEgQF0+eI0cWSAplWfhzwY2EyeY5NbL7yXE=; b=JtfdMlLVgPcOx/SBsACjmwxvwHn6732TgP4HF7zJg1NcnW5J4HVoAFNU2XtbiPTuph c8ach1k/AZTpYkhTRNpeBkGrJsE9h6XQ2V9eLBmnNZMiW/o7q68W8/OVn5Jn9bmncOkZ gHsDE2LUlNzJx8rWkR0dBgvpIcAoR+6Sd5vxsa1oLQ2wU4QQgLN4lEZ/cxD2JxsDaUBF FlqqWlaSaDA1PHO5c6yC2vuZfLrFhty+oKTw2WtWUuYvptPolR2PiPGHBLywJA7Ynjlb 3mo6+ebOOeELpJAAKhU5P3ygEgnedGdjwRQjwdHt9D6EPkuIT7lwnZrAQoRvZkY17R8w j2xw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709629182; x=1710233982; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=tPRAHmknVEgQF0+eI0cWSAplWfhzwY2EyeY5NbL7yXE=; b=hVRrEUPqXgGnW3nj6Ri50JybCXcqOnb+N8+h38n5Mu+mlBkORoZZFNo03hMpc11oUq ZZry90bBSxA2IhLjPpKxYwGEiJmSsCF+CQcPdHXlahKM0n0F33a+tbdYzfrCSpJk/xST ++jt+B8YVyamoMZTgXyRxWC5k2kEbJLaQFR8VO4OOmi0QnTgZ7WF9TJd9DIE6WVK70rg o/5nd3nQNe92+ZpOE30XKvvQmfSk9skUdFMc42E4NC8OYUi+qIOs3dwbvZn++gTnHrFd szyjN/PfkTo4MiEsBpo7OP+/m/DFieHSp97uST5fBnW/H8w57mm2EA4t3cAUaYFykS3r yy0A== X-Forwarded-Encrypted: i=1; AJvYcCVWfOre45uVrdxDLahybEwbTr4mFhdMh+I0Ia1c0n/JvUPjE5gBvv8WaVoY4yCbRXySOKF15vhA4rrkfczhMetNDKI= X-Gm-Message-State: AOJu0Yx+X7q0rE4eJhxsDPwoCaoEQ4spNN4z7V1t9wZhstN/3x4lswvn ZVxm2xEa/2TmzgqSyf1hiALOcSKrKasshOL2iBoaDWg+xy3awQKS49s0q5Ez3b3arZTbLdcWiV+ E X-Google-Smtp-Source: AGHT+IF3qHNB69qnbIhdOhCn87w4BHGGC/TCaWgfYQYaremgBcPzr7gTWpssGSWJR1NdgYL1iKdKJA== X-Received: by 2002:a17:906:37d6:b0:a45:f05:7e10 with SMTP id o22-20020a17090637d600b00a450f057e10mr4709827ejc.24.1709629182494; Tue, 05 Mar 2024 00:59:42 -0800 (PST) Received: from raven.blarg.de (p200300dc6f010900023064fffe740809.dip0.t-ipconnect.de. [2003:dc:6f01:900:230:64ff:fe74:809]) by smtp.gmail.com with ESMTPSA id gs4-20020a170906f18400b00a449d12cdc5sm4453005ejb.119.2024.03.05.00.59.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Mar 2024 00:59:41 -0800 (PST) From: Max Kellermann To: akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: willy@infradead.org, sfr@canb.auug.org.au, Max Kellermann Subject: [PATCH v3 07/14] linux/mm.h: move folio_next() to mm/folio_next.h Date: Tue, 5 Mar 2024 09:59:12 +0100 Message-Id: <20240305085919.1601395-8-max.kellermann@ionos.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240305085919.1601395-1-max.kellermann@ionos.com> References: <20240305085919.1601395-1-max.kellermann@ionos.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: D939A180006 X-Rspam-User: X-Rspamd-Server: rspam05 X-Stat-Signature: kenb7o4jigu3yfs1zqysz7r3xbk5crit X-HE-Tag: 1709629183-914032 X-HE-Meta: U2FsdGVkX1/kJVc+GJ/ILtKj+8V98aSh3ldnl6cO8HOaY6vil2Wefs/0cYsBa0Jf8XvVnGziz5rvrIYnZsQpQ6tegKb78vi52D9il0feaKbXtsNlm2W4+XOkDyCTDpcbKEG7zqbZLVsckD9ZK/W3CJ7Gf++uTJchJpXkxYyYVm8meYLImmnT0IjFXbLiqRjww2h86dOLFG446clCi8foYXWgqfx2A7XpfSjOoJrghHN4/UNON9Ux9064jurlBcpDLvjV+G7bXW+H7I94H75Guvzfq5QHuaRt5bLLJNxjwyC5Pm2TspHH+/c2xD5XnyxHSIe5gbsyl+8K+oXscx9DX6D8qHxVSIdMwpsqSRCezcz9obm+WEj4GKFKeATh6P1oR0sJV7/5cup+cNNqY8BaqPxfvAInO4oB6LWRVsjIMc2pFmVNIqEmvquDL050+nmiIu5W86uWytjnWdq69KDDlFOqBRpOw6mt3MImCRyXnoHaV1ftJIM+KhjhMXuWkOwO5ciC4ioIu+aRA1psghcZGMGcl7wIcJsZ2go1e5TaWWBh0pmv7UjFsLhicp7PyWPjhNlI6KpCHaiCDWu0S6MVYkahE+cg6Q6PRx8iypaWoZIG9HOcGD/XgSp22Qc+s6ZecepYBc5KXDAUomcHh/zcMKo5Hv2RIEPFANaxVfMu4XF6s3p5x7tmqtV6pzhNu6PFLzTjJeS2TbsxEXQ5UqVG5Dc8WYOnmK4ZY2b6k09s1VfZYLNIas8RzZ2EpiaNv4YoZCe5JX3tosKxtArh/KaQcu3d2wNwCzWNAcoP2gHbjJLiGeaBKiyZjo0s1nemkFvp/zmzf6myiZxAS7IsnPT4rZ1PahK53hbUVVN6mnqR0MQUM8sSegPt/hbxOPW7DSM9EjqDS13s1qrGcZfD/BoubOHC9mWfERxYRvtHTtWerrujGe8aMdbMnnN1YKQeY3XTjgd6s8H5TUmy+mJtyEi Hg8SyTDx FO2tq1w5q9FAA3ZAVZBvlUCe58VpnqN913kDwOAC5emXzq+tVwsnrQMKSJUHHN+H03Q6tAL+h7bcmHadmcTE9IgcEW6Woj9qy/JW3PCFrOlUE0KmOY22HwN1bQhIgx5HRPPjFCheFAnw5XwLvKI/0K7yqFswyBMX/J0FWIaWkQXtTZNgJpu5L6AkOB8vl2VEol4bo8li/P48/c8R7ECpt3tDu0EaWK3KsybX7zXndLHwp/fDwbGm9eFGeZJqzk8eE4JttGrxOi0jBzeRRcv4tf8a+Va93pnZ7h8JwJUVL9A8n8ogENbahrEAwB+Bf6lvOSslHn5rsreQCxUxzx9Ja69TKyNgClop5zhw9oLHEUDUbh3h2HYar2EAvdXf2sy7dfA3UfFeHmht95tHtrF6K8iX71VmqJbOlGkb9BoGmOaF+8JtFNcDtfbqInEB/FeXfIqT1GpJOeVfY+g+4YUCdCcGWQA== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000693, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: Prepare to reduce dependencies on linux/mm.h. folio_next() is used by linux/bio.h. Moving it to a separate lean header will allow us to avoid the dependency on linux/mm.h. Signed-off-by: Max Kellermann --- include/linux/mm.h | 20 +------------------- include/linux/mm/folio_next.h | 27 +++++++++++++++++++++++++++ 2 files changed, 28 insertions(+), 19 deletions(-) create mode 100644 include/linux/mm/folio_next.h diff --git a/include/linux/mm.h b/include/linux/mm.h index 0d291ff61db3..e6c2df977abc 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -2,6 +2,7 @@ #ifndef _LINUX_MM_H #define _LINUX_MM_H +#include #include #include #include @@ -1922,25 +1923,6 @@ static inline void set_page_links(struct page *page, enum zone_type zone, #define MAX_FOLIO_NR_PAGES MAX_ORDER_NR_PAGES #endif -/** - * folio_next - Move to the next physical folio. - * @folio: The folio we're currently operating on. - * - * If you have physically contiguous memory which may span more than - * one folio (eg a &struct bio_vec), use this function to move from one - * folio to the next. Do not use it if the memory is only virtually - * contiguous as the folios are almost certainly not adjacent to each - * other. This is the folio equivalent to writing ``page++``. - * - * Context: We assume that the folios are refcounted and/or locked at a - * higher level and do not adjust the reference counts. - * Return: The next struct folio. - */ -static inline struct folio *folio_next(struct folio *folio) -{ - return (struct folio *)folio_page(folio, folio_nr_pages(folio)); -} - /** * folio_estimated_sharers - Estimate the number of sharers of a folio. * @folio: The folio. diff --git a/include/linux/mm/folio_next.h b/include/linux/mm/folio_next.h new file mode 100644 index 000000000000..7016e303439c --- /dev/null +++ b/include/linux/mm/folio_next.h @@ -0,0 +1,27 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef _LINUX_MM_FOLIO_NEXT_H +#define _LINUX_MM_FOLIO_NEXT_H + +#include // for folio_nr_pages() +#include // for nth_page(), needed by folio_page() + +/** + * folio_next - Move to the next physical folio. + * @folio: The folio we're currently operating on. + * + * If you have physically contiguous memory which may span more than + * one folio (eg a &struct bio_vec), use this function to move from one + * folio to the next. Do not use it if the memory is only virtually + * contiguous as the folios are almost certainly not adjacent to each + * other. This is the folio equivalent to writing ``page++``. + * + * Context: We assume that the folios are refcounted and/or locked at a + * higher level and do not adjust the reference counts. + * Return: The next struct folio. + */ +static inline struct folio *folio_next(struct folio *folio) +{ + return (struct folio *)folio_page(folio, folio_nr_pages(folio)); +} + +#endif /* _LINUX_MM_FOLIO_NEXT_H */ From patchwork Tue Mar 5 08:59:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Max Kellermann X-Patchwork-Id: 13581861 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 D03BFC54E41 for ; Tue, 5 Mar 2024 09:00:00 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 3E3F56B009A; Tue, 5 Mar 2024 03:59:47 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 345E66B009C; Tue, 5 Mar 2024 03:59:47 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1E7086B009D; Tue, 5 Mar 2024 03:59:47 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 0B7FB6B009A for ; Tue, 5 Mar 2024 03:59:47 -0500 (EST) Received: from smtpin07.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id D98A2C0C7E for ; Tue, 5 Mar 2024 08:59:46 +0000 (UTC) X-FDA: 81862387572.07.61DF83C Received: from mail-ej1-f54.google.com (mail-ej1-f54.google.com [209.85.218.54]) by imf02.hostedemail.com (Postfix) with ESMTP id 2A3E680005 for ; Tue, 5 Mar 2024 08:59:44 +0000 (UTC) Authentication-Results: imf02.hostedemail.com; dkim=pass header.d=ionos.com header.s=google header.b=IC3THLdd; spf=pass (imf02.hostedemail.com: domain of max.kellermann@ionos.com designates 209.85.218.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=1709629185; 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=TT7smv1j1+eH6dLDpyJyxapeCn0BRAoD8ideYTGL8g4=; b=7e1aAlYhgDu1U2fvqnb+GEEITDl8K8aQjoB3USc/HKeC8hEDdrzKwai4o8V8OU8/SRrGQu 56LOvl4x4TeMLn0ep605KRQf6acDnEPLaoxtbXLbCcYFr3YHVt6OTkBSa67ECRxmMnp+4S UB8EsdA0m1b1VeHvoQXIkIGU5v3osB0= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1709629185; a=rsa-sha256; cv=none; b=a/TZYIn/cmmP0LUDLgO55c6/B3SAsiFgxiv0J1ui3J/iQa/4WZ3e/X5R9vl3iHju3iD/bX 8IXbI9eks4NTkUm/uNIc8e+5j/OTSkBVGcS2lK3PnlscP9MvRcI+Hn4whl8Z2edeCqsh5o cHSYxzYzNP1tumUgP17sjnmHG6BVPWE= ARC-Authentication-Results: i=1; imf02.hostedemail.com; dkim=pass header.d=ionos.com header.s=google header.b=IC3THLdd; spf=pass (imf02.hostedemail.com: domain of max.kellermann@ionos.com designates 209.85.218.54 as permitted sender) smtp.mailfrom=max.kellermann@ionos.com; dmarc=pass (policy=quarantine) header.from=ionos.com Received: by mail-ej1-f54.google.com with SMTP id a640c23a62f3a-a28a6cef709so869761766b.1 for ; Tue, 05 Mar 2024 00:59:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ionos.com; s=google; t=1709629184; x=1710233984; 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=TT7smv1j1+eH6dLDpyJyxapeCn0BRAoD8ideYTGL8g4=; b=IC3THLddgmFGNtxNiolirnVG0u89yBk4oIiQQwzu8ZBvMW1fuOvLr1LjuFLqK/83Do n5A1IPeJTgzQ5MpKlQa9l6nltUfYC5tVDZT7Cx3B7hiRQSPQIWBVE1Fclz7MoACTCYps YPuvkNrVjj4HZ9GnAEDojkwQLac97jEFuEmIvVn0ReaLO85UbP9IK1A2Ri2rrcTaqyWv xBe0uwETUexXhrAIUM6MXqFskIgJlBj4zWKi7+0p3gVWt7HVhgmByU0QZ2N9pZUEh4wr y9lk+MJ4na1xWb2Nu4qpnto9UxwEinxv74nL/M3oUxX/GKmSv4HnoP1bJY0TVlskU5PH uvxw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709629184; x=1710233984; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=TT7smv1j1+eH6dLDpyJyxapeCn0BRAoD8ideYTGL8g4=; b=phTb9Z61d4q9GTtl7utH7DG+IJuG3uYHwbepE5eSDle001zRtXna1gd1S2JnmD+3/o Jnp9jb5OstnVPnBfmVTmVwX2CUIjx1Xu+GxNX/cxcUXBdboOQ14dOj3ZUvA+DeMhMzfk /xZm6Gll6fL24Sp/WzjG6UGpskNc9PHfGBaXocTf0VazdDkDph5qReWIZl1VGcH31IzQ qvEd0fX4J0556x1QLPb4pHmFAHbCq/QZa4YB6D7QPZpjef6P5Ik5BzbfnV9Ejr+xK4mK Rz4svEuKZXpH5q8eT2ZUmlQxBlyNEdxVuyF2RVhrCSPweJ2JWsjsJuXq28hIb5byu4PG reuA== X-Forwarded-Encrypted: i=1; AJvYcCUvd0cC+x9CDs17vLMRNvxspE5EBIkqQMT15W8FNSTbjM/paL0Sdxb8iFFbG9hgBhEr/dKAM9ZdNQNGr94zd4Bnj1o= X-Gm-Message-State: AOJu0YxcPzm8zdERGQf+CKIfczhadwsy3BYct0WB8U8IRr7S/1wm6ha6 m1pAF5/pR5ayQ5+6rCMHiLe2x0iizDosX1IbWYHegm4CAfN4/wiCOgyuqzLwNUY= X-Google-Smtp-Source: AGHT+IHtBtgNb5X5tWn9KArmVzxl5Jnk/MnYuiE1JbQjADDKG/XuWp5/tNkMjxChRCvuGWsrlF/Kqg== X-Received: by 2002:a17:906:c7c3:b0:a3e:34e8:626f with SMTP id dc3-20020a170906c7c300b00a3e34e8626fmr8169467ejb.66.1709629183860; Tue, 05 Mar 2024 00:59:43 -0800 (PST) Received: from raven.blarg.de (p200300dc6f010900023064fffe740809.dip0.t-ipconnect.de. [2003:dc:6f01:900:230:64ff:fe74:809]) by smtp.gmail.com with ESMTPSA id gs4-20020a170906f18400b00a449d12cdc5sm4453005ejb.119.2024.03.05.00.59.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Mar 2024 00:59:42 -0800 (PST) From: Max Kellermann To: akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: willy@infradead.org, sfr@canb.auug.org.au, Max Kellermann Subject: [PATCH v3 08/14] linux/mm.h: move devmap-related declarations to mm/devmap_managed.h Date: Tue, 5 Mar 2024 09:59:13 +0100 Message-Id: <20240305085919.1601395-9-max.kellermann@ionos.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240305085919.1601395-1-max.kellermann@ionos.com> References: <20240305085919.1601395-1-max.kellermann@ionos.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: 2A3E680005 X-Rspam-User: X-Stat-Signature: 1m4r3drds9f4rxj85pomeui5wb6385a4 X-Rspamd-Server: rspam03 X-HE-Tag: 1709629184-929684 X-HE-Meta: U2FsdGVkX18POZ+cSZjFwCghskiGB+yRaE3Cf8kelNFRZhsjqT6ceyRoYOwk1olZ0JwmtFpdA/irfXcliTup77nNS4OtFTaNjT222JHvQgxmU+qLJsnjgz45He6B8GDEv67FEtiAoJ3ahor925xB75x/0z+tARuF+XHpGa9nnxfLDHlN3cFX+F5Y5jD9/t8Wc+lSFc2ey/BYIO978fNT3GRsR0PdXLeBUetS4gkU1iCGC1cUISVOR1gn43tgUDXEnnrtfk9uFidACEBfc9gis0BFwUgYC0E9tH4us23X9UsZALIPigIZNJd4kSUgBA3dct6nExrk/FjMDfSgPkah9NBCKU9KgpJhDvU9cLeAFZtFKjQoPyCaV9nHyA/pTdha198qxbziwPKQPcLRHsRK1HsfbRVXnRG/+xpsU1sKJEcaMc1zLck+3242DAA17KsE+Fa9jGxr7uawKtP9nkfRiGBbqMIeU8jWEmMtHh1w9M7VfyABGsI+vcGovQZ9yR2RXub7tyO+EYOTwTT2Guk2/uVfc/uFpblxmDO+AAuJtJSZCgn5LoliwFMZVFHfkIA7cKVy8wFh3GpYChEQkCXIKmXLanfz4fD3PFzt4vWYggpYXRo8fFRNZYp+hQClRYPiYRV50qYRXdimUU72BSgfKAQlOtl2ui6wPYhc/mtACaG8KXFNXm8ShHJgYNf5safTC+O68uVwn7AUebIvZgK1ClHCrI2B+8jmjqagr7imzEEy6Pv+FcJBGNkfNUK7FdgquFzS6ROE5ZLrhlfxk5RbVrPPnVP680IhMDj9kqPsp9U8yr9aQvzi18JO946U7CG/KsD/Fpwmhv/1/mFn5fe2ng2NuHl9rs2gkhLMYV/qSqCmHlxOUocj1LrxzPYilFRX/CO6M2XSKnjJ8kdFy1qPSJrf3BMaFyf8u+9SbhEIAIwpj2GrVsYhsd7ryX+kmP9U1Rd3EdPIBnZSEwwoiwf JgXInSv2 6M6yFbJ4xC3DEEs1JI2cOLXlA70JutU0/b71rh49yKfj0h70YnU9s51Lq1Lpz/5STw1X0ev7JvItKN4ttdsfodVFyy4h+rPgSSPpaySSoocGCmhIBH34BVjLw9i5xrC0aPKkgqTZTSl3V8vKKzjWe4BwF9ccHJHUs9Bo0 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: Prepare to reduce dependencies on linux/mm.h. put_devmap_managed_page() is called by put_page(). Moving it to a separate header allows us to move put_page() to a separate lean header as well. Signed-off-by: Max Kellermann --- include/linux/mm.h | 25 +-------------------- include/linux/mm/devmap_managed.h | 37 +++++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+), 24 deletions(-) create mode 100644 include/linux/mm/devmap_managed.h diff --git a/include/linux/mm.h b/include/linux/mm.h index e6c2df977abc..61f1312a626e 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -2,6 +2,7 @@ #ifndef _LINUX_MM_H #define _LINUX_MM_H +#include #include #include #include @@ -1357,30 +1358,6 @@ vm_fault_t finish_fault(struct vm_fault *vmf); * back into memory. */ -#if defined(CONFIG_ZONE_DEVICE) && defined(CONFIG_FS_DAX) -DECLARE_STATIC_KEY_FALSE(devmap_managed_key); - -bool __put_devmap_managed_page_refs(struct page *page, int refs); -static inline bool put_devmap_managed_page_refs(struct page *page, int refs) -{ - if (!static_branch_unlikely(&devmap_managed_key)) - return false; - if (!is_zone_device_page(page)) - return false; - return __put_devmap_managed_page_refs(page, refs); -} -#else /* CONFIG_ZONE_DEVICE && CONFIG_FS_DAX */ -static inline bool put_devmap_managed_page_refs(struct page *page, int refs) -{ - return false; -} -#endif /* CONFIG_ZONE_DEVICE && CONFIG_FS_DAX */ - -static inline bool put_devmap_managed_page(struct page *page) -{ - return put_devmap_managed_page_refs(page, 1); -} - /* 127: arbitrary random number, small enough to assemble well */ #define folio_ref_zero_or_close_to_overflow(folio) \ ((unsigned int) folio_ref_count(folio) + 127u <= 127u) diff --git a/include/linux/mm/devmap_managed.h b/include/linux/mm/devmap_managed.h new file mode 100644 index 000000000000..0773529d80b2 --- /dev/null +++ b/include/linux/mm/devmap_managed.h @@ -0,0 +1,37 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef _LINUX_MM_DEVMAP_MANAGED_H +#define _LINUX_MM_DEVMAP_MANAGED_H + +#include // for bool + +struct page; + +#if defined(CONFIG_ZONE_DEVICE) && defined(CONFIG_FS_DAX) + +#include // for DECLARE_STATIC_KEY_FALSE(), static_branch_unlikely() +#include // is_zone_device_page() + +DECLARE_STATIC_KEY_FALSE(devmap_managed_key); + +bool __put_devmap_managed_page_refs(struct page *page, int refs); +static inline bool put_devmap_managed_page_refs(struct page *page, int refs) +{ + if (!static_branch_unlikely(&devmap_managed_key)) + return false; + if (!is_zone_device_page(page)) + return false; + return __put_devmap_managed_page_refs(page, refs); +} +#else /* CONFIG_ZONE_DEVICE && CONFIG_FS_DAX */ +static inline bool put_devmap_managed_page_refs(struct page *page, int refs) +{ + return false; +} +#endif /* CONFIG_ZONE_DEVICE && CONFIG_FS_DAX */ + +static inline bool put_devmap_managed_page(struct page *page) +{ + return put_devmap_managed_page_refs(page, 1); +} + +#endif /* _LINUX_MM_DEVMAP_MANAGED_H */ From patchwork Tue Mar 5 08:59:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Max Kellermann X-Patchwork-Id: 13581863 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 CE80EC54E41 for ; Tue, 5 Mar 2024 09:00:06 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 9D1646B009E; Tue, 5 Mar 2024 03:59:49 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 93F83940007; Tue, 5 Mar 2024 03:59:49 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6A4ED6B00A0; Tue, 5 Mar 2024 03:59:49 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 4D9A46B009D for ; Tue, 5 Mar 2024 03:59:49 -0500 (EST) Received: from smtpin22.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id CA796120DBF for ; Tue, 5 Mar 2024 08:59:48 +0000 (UTC) X-FDA: 81862387656.22.47A07BC Received: from mail-lf1-f49.google.com (mail-lf1-f49.google.com [209.85.167.49]) by imf28.hostedemail.com (Postfix) with ESMTP id DDE22C000C for ; Tue, 5 Mar 2024 08:59:46 +0000 (UTC) Authentication-Results: imf28.hostedemail.com; dkim=pass header.d=ionos.com header.s=google header.b=RZDczbC9; spf=pass (imf28.hostedemail.com: domain of max.kellermann@ionos.com designates 209.85.167.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=1709629187; 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=cowoIpweWt3L2bjBHT1kUeTpunMOhbiTNwgqFnKsuAs=; b=UmdN7ByoORBw54yMpAYeCSiu+ltZqqHSssYLZ9eSDNe6Sej1KfxplBbFzHO5S8odD2gUdj Wn8FWiNsmZJLJPc28v3sdVZ8g3X4XEX2ZURn51qLQfbWS6UuLpG7/YSY/YDr12ojQSEcQB youmGuML7SXwCJyIKENihmoWbNRPfvk= ARC-Authentication-Results: i=1; imf28.hostedemail.com; dkim=pass header.d=ionos.com header.s=google header.b=RZDczbC9; spf=pass (imf28.hostedemail.com: domain of max.kellermann@ionos.com designates 209.85.167.49 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=1709629187; a=rsa-sha256; cv=none; b=7ArU5jHt2shdAzaiJHLjPxcsxXtrvuLtvnGZVs7hkE94gHNSvQISssX2vxFxKbWwYaTqb4 YBm3x9xDR1j4fM/0Ug4VaK5jTaRWywHi+qpfZbw92DKAFq79+bOZZL6E2pb67aeAhhWcks 83YZ7vEGjsuIhTLyRBxde+2DRojmI1U= Received: by mail-lf1-f49.google.com with SMTP id 2adb3069b0e04-512b3b04995so4020012e87.3 for ; Tue, 05 Mar 2024 00:59:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ionos.com; s=google; t=1709629185; x=1710233985; 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=cowoIpweWt3L2bjBHT1kUeTpunMOhbiTNwgqFnKsuAs=; b=RZDczbC9CJ+eSQLFIyXKAAHdC2Xahpe1xWXCm9y4On+Uarbq9bpb/yd1WS8omTyOKn bJuLq+hCBoy5rDv7Lsd5KkOhwJ9k48uJvuivLVwgLjUC+MZiUv1dmJu/Jubbea8nAEAd 1fG/f7T+KC9H7g4vO3m9LwMEEyM0QJDVH42IafGZrcRonzOvNMPbyDKkdjGm7laDmmhl YzQVF4McoqvFlcT7NnLFO0dYrDjMqN9itjZnrrlvj3beKp74POaHcVto8IEiZNcBxAIH /i6vDmO11HAiaf/pX4r6T/QKPtL7KhxP1RNl1PRPjcIE17Q2CDb9W983IsjJIZOJgpuG wsfA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709629185; x=1710233985; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=cowoIpweWt3L2bjBHT1kUeTpunMOhbiTNwgqFnKsuAs=; b=NiIwf4L0hUotYLjekBAA6bYM8BdEJ1SfCEl7eRNYgABl3HqrUkjyhJGGHwlH228UOw uboXf9ViRadfdFl4V1TvM6/fwdaN4Px38DuyGwVGaz9cTQU8gHZfS+XLe7jrsQxL0K2o 3IPkZKlrYgFxfZ8baxicIAlgWPR9jR03igYPnsXvdn1MJfMVtxRrAJnmKsOc+wCjIIhd 4bXSAOoEO/g36mLm0a7idh7Mfu8j14T737sMGCHQA+e+NIrl+WsdnV7NrCfszX7ApDMh bd3vi0VA0PMya8pJRom9T/MBMwFolYAdl+grbc5TCe/yZ2QlKhqvA52olCC6euf88d8L Jznw== X-Forwarded-Encrypted: i=1; AJvYcCWA4HqAiouFJRx89A4SbuJ58fgYtNJKSmgtwmY3Xt6Fxp7eslC5TcwmtcY5ixyxztNAIleTkNeG7KWgUMjiHqF0Fco= X-Gm-Message-State: AOJu0YzNYoveV645UfWRJPMpPoJvfuQpTexezMA5MoDOu9uAnBdLCMyv 2H7fToVcGKgT6nQ8mFGMutckVAv4eH+8a6cxC6+sBIepkCi+udSydxUYxGurzdI= X-Google-Smtp-Source: AGHT+IGKngCTmPmeb81IUjSVUV+bTdylSFgdpzvBNEX+ZfYgXiwTu8YQIgQN2zwEsxNYEM8vJK3Vuw== X-Received: by 2002:a05:6512:1152:b0:513:5203:e255 with SMTP id m18-20020a056512115200b005135203e255mr793839lfg.7.1709629184681; Tue, 05 Mar 2024 00:59:44 -0800 (PST) Received: from raven.blarg.de (p200300dc6f010900023064fffe740809.dip0.t-ipconnect.de. [2003:dc:6f01:900:230:64ff:fe74:809]) by smtp.gmail.com with ESMTPSA id gs4-20020a170906f18400b00a449d12cdc5sm4453005ejb.119.2024.03.05.00.59.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Mar 2024 00:59:44 -0800 (PST) From: Max Kellermann To: akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: willy@infradead.org, sfr@canb.auug.org.au, Max Kellermann Subject: [PATCH v3 09/14] linux/mm.h: move usage count functions to mm/folio_usage.h Date: Tue, 5 Mar 2024 09:59:14 +0100 Message-Id: <20240305085919.1601395-10-max.kellermann@ionos.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240305085919.1601395-1-max.kellermann@ionos.com> References: <20240305085919.1601395-1-max.kellermann@ionos.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: DDE22C000C X-Rspam-User: X-Stat-Signature: yxddjo1t96uoi97meej3f8b4tphtm77f X-Rspamd-Server: rspam01 X-HE-Tag: 1709629186-289838 X-HE-Meta: U2FsdGVkX1/0i7MdlCXbUOIB6mW9GGzjNd1JvAWAngq7FRdgadf645tKBINeDz95ko2uoqfuugQhGnv+dYYE2EHByCAtzB/r70r/NyMOe+MRj0+FpTTuYvLiqEqjCsSUmYE4BKCX8J1FtMBrrmYIrY9LFEKoABShht1KY/SmYorjhenTqbrtZo1OXvl3Z22e9oBl0cQJWQSL0GMVCAtpQhwm09iCUA3WNABJygKbTd0NxxaspMrzDfMTiLXfD1lvMlaSjdDQ16oVdgxOjJJ+I7Giyoj2RkIQjBTx2U2tM1kmG8spJw82CqqlDvE2jx8qsfKj1rZpT/9v2cY6EtB/Gea667py0EOYQ5QI5I9lxOjNorD4Nm8uHR9M375a+OlBHSG6Ey646izp9g8q0O5brBXDOWjnH46GbvFgAOK/8K+miBi2cCdZ86Fzhbdwxiy8EqtGDxnv+mrUCSmJwtDqUI2Ov6G5lazKxVV7/sSu6+yfRIXVQs+tJymamOVhXKzMwHdiGFQ49jWfLDFw5xkeyKkwvCQCGRanoRc3Ga361/xzSKCiaXTR9T6GqTMCS17+3lzNF4+/szwvLjauGa5UJhu1D5O59gHjPIQbUKt1WOZB+4OcOBp3AOEn4DRAGjzndId+QHwRh+Z4/H1DjcBNl96NcsDyvuEtH7RhsP5VJGnzDJJGi4tsjsIl4hYnfcavOBJ0AGpptl0URXdTyWynkQ6lallOho7+DZJGotkdqx0gOZuXNuSW7ZAcwrjwDAybLpM8BhPhVY/jhV8t4xHKEb5VRNI3bTdw2A38+UGsIyJ9Cf0zwaoJpL07jrSQvld4O0xMISFGPv1pUm507FBcGavqhfS1PQ2gX0bgAzdNvVrfdPDlxaJaz5agT16xNEXpMdgyNzEAKYACQ7YKEjBB2rWDA3LoluGuxFG7P5nsqctg7KB6G+AjkNBr889V1LuYGZcLIb3YSM87tueRh6M xwASDKBk R+1EOtxD9tpxlT5jicKdn/wyRxneq7dUu9yl3CfvpVsc3IxfKn4zkQgCuev5H26GNlCagDm52pSBUUxASz0QPplU/ojzr3Bgl8tNxq8VgZtEAzXLMnS5P7oc2LAWzAB+4cBK8W6+q8v9ULxkG/1BTWJgNijpMPw96Zc2a 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 61f1312a626e..e8a914e7bebd 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -2,9 +2,9 @@ #ifndef _LINUX_MM_H #define _LINUX_MM_H -#include #include #include +#include #include #include #include @@ -1073,51 +1073,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 { @@ -1266,8 +1221,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); @@ -1358,129 +1311,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_page(&folio->page)) - return; - folio_put(folio); -} - /* * GUP_PIN_COUNTING_BIAS, and the associated functions that use it, overload * the page's refcount so that two separate items are tracked: the original page diff --git a/include/linux/mm/folio_usage.h b/include/linux/mm/folio_usage.h new file mode 100644 index 000000000000..4a7e9cd74909 --- /dev/null +++ b/include/linux/mm/folio_usage.h @@ -0,0 +1,182 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef _LINUX_MM_FOLIO_USAGE_H +#define _LINUX_MM_FOLIO_USAGE_H + +#include // for put_devmap_managed_page() +#include // for VM_BUG_ON_PAGE() +#include // for struct folio +#include + +struct folio_batch; + +/* + * Methods to modify the page usage count. + * + * What counts for a page usage: + * - cache mapping (page->mapping) + * - private data (page->private) + * - page mapped in a task's page tables, each mapping + * is counted separately + * + * Also, many kernel routines increase the page count before a critical + * routine so they can be sure the page doesn't go away from under them. + */ + +/* + * Drop a ref, return true if the refcount fell to zero (the page has no 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_page(&folio->page)) + return; + folio_put(folio); +} + +#endif /* _LINUX_MM_FOLIO_USAGE_H */ From patchwork Tue Mar 5 08:59:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Max Kellermann X-Patchwork-Id: 13581862 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 C9A9CC54798 for ; Tue, 5 Mar 2024 09:00:03 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 7686C6B009D; Tue, 5 Mar 2024 03:59:49 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 6F45E6B009E; Tue, 5 Mar 2024 03:59:49 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 59F276B009F; Tue, 5 Mar 2024 03:59:49 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 3CF396B009C for ; Tue, 5 Mar 2024 03:59:49 -0500 (EST) Received: from smtpin18.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 05B2812044F for ; Tue, 5 Mar 2024 08:59:48 +0000 (UTC) X-FDA: 81862387698.18.440C1AF Received: from mail-lf1-f54.google.com (mail-lf1-f54.google.com [209.85.167.54]) by imf11.hostedemail.com (Postfix) with ESMTP id 020564000A for ; Tue, 5 Mar 2024 08:59:46 +0000 (UTC) Authentication-Results: imf11.hostedemail.com; dkim=pass header.d=ionos.com header.s=google header.b=aJoNoaIm; dmarc=pass (policy=quarantine) header.from=ionos.com; spf=pass (imf11.hostedemail.com: domain of max.kellermann@ionos.com designates 209.85.167.54 as permitted sender) smtp.mailfrom=max.kellermann@ionos.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1709629187; 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=KC2kNgBeF7Vel8Ro1rxtb7kBWctFnYPn6ChmmeyuWYw=; b=vWkBM5tIy5PhqkgdzEH2kjchZlZ2M02DQLlgzFaKC2fNcftHOAzQsx0qGH3qcSEhM5TOH/ ozk1r2AqrnAyG1VrbGK6vqvzcOsZUDQGtInwbwbo8NNGJyskAxHK9Oqzq0zAsQj6apxh1h /uPhhSx9EycQk6vBFzxti6VwJkM2dLo= ARC-Authentication-Results: i=1; imf11.hostedemail.com; dkim=pass header.d=ionos.com header.s=google header.b=aJoNoaIm; dmarc=pass (policy=quarantine) header.from=ionos.com; spf=pass (imf11.hostedemail.com: domain of max.kellermann@ionos.com designates 209.85.167.54 as permitted sender) smtp.mailfrom=max.kellermann@ionos.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1709629187; a=rsa-sha256; cv=none; b=DiYLs26C0wa/vMdIwNLarLxpR+V46uJEY7NDtwORDg/bpodbo3KPvmXEHMp2T2pB277NeA JqoSxcqLjBE/wa0kZxUCvjUCI5gw0klHUNfvfbcb2XQbPl18rqh79theYK3fMbjWxQtgXf TAoqkirwI24IRrR1mpxD4B5xp/9tjfU= Received: by mail-lf1-f54.google.com with SMTP id 2adb3069b0e04-513382f40e9so3712237e87.2 for ; Tue, 05 Mar 2024 00:59:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ionos.com; s=google; t=1709629185; x=1710233985; 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=KC2kNgBeF7Vel8Ro1rxtb7kBWctFnYPn6ChmmeyuWYw=; b=aJoNoaImTX6N7QFaORKHDI7EBO3GrVc8g325lHeAz2Tadc49U1bS/wdCUdGuAJH6EI nieDYFw8LB/1nrnIOQdHVciK1Yn1XeJJilZsWu5HAKmWdIoa/m6rdBAhyNq7OhZrBMUs wp+riTrRhKDsB41gbaLob+npwVlyRZD2Wducv7KDHJclGXucTFNDkK7NSrXZD6LsvdyP nuj0UKlOEkouR4rv1DiHVYSAY1521cRF+f0sg2UhzuX/fq2YqDZLdN6ga92o5du/IeSp Jw1Q8W6zNK2PGZxacxxMLla69WbRM5+TkbZu31ukfu25N5u4Qoh6K+HMSeJ8RubVf17+ IteA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709629185; x=1710233985; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=KC2kNgBeF7Vel8Ro1rxtb7kBWctFnYPn6ChmmeyuWYw=; b=ZevW7T/DDEePFrUBKXs+cSA9uvPKUeRWIjJlVz0BMVAqlSQ9hW6kzhbYzVxLLl93Y8 MygXGVH6ch/exENNPURoVPudT9HakP4KQ2FTDpinL69GVp4NnyD/xNvWICq2AW5PPGeJ rYsWFsPN1KtUdDD9r+0p3Lqkj2ZDTEVSBhz0S4iYI/StWrH/IFINQLq3n1oQ850sfXpp MS/7VbXQ2/C0uqAH3kNjTtK/KaGM99VXes6NKlNqa9cJ16wFyCaK6tUJOC7hACdZeOuu iX5wlPQiDS5AFGKPwAEibSRdNZAIxtHnnvTb5PHaMGVTPnGTBOHd1mCOuyoOnoD9y++E QAow== X-Forwarded-Encrypted: i=1; AJvYcCUfLuNhhf5h3dn+zWhAWalXxg/NOa1xlynhyZwele1eAmUA2u5JfWBP0Xy5naYQO9UbxSqZ8rTH1Qral0yULk57Mrc= X-Gm-Message-State: AOJu0YzUuuxCtj+rE+OE7geMo1n8hfHnFKVmAjeUPvFSXQlQLIrNHJmG fIzNueMyoXOpby4+UCuIm7Ze6S7JOd4265jzvoELl07+P/yXoz+8RuPcV76G8KM= X-Google-Smtp-Source: AGHT+IEOCYDpUQLk3buGpFhw7wVnYWZuernsI+pAHl/63TvTJG0550L21BMcbBfy9DsuHHJx6gg/Gw== X-Received: by 2002:ac2:5a48:0:b0:513:575f:cee0 with SMTP id r8-20020ac25a48000000b00513575fcee0mr318604lfn.16.1709629185320; Tue, 05 Mar 2024 00:59:45 -0800 (PST) Received: from raven.blarg.de (p200300dc6f010900023064fffe740809.dip0.t-ipconnect.de. [2003:dc:6f01:900:230:64ff:fe74:809]) by smtp.gmail.com with ESMTPSA id gs4-20020a170906f18400b00a449d12cdc5sm4453005ejb.119.2024.03.05.00.59.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Mar 2024 00:59:45 -0800 (PST) From: Max Kellermann To: akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: willy@infradead.org, sfr@canb.auug.org.au, Max Kellermann Subject: [PATCH v3 10/14] linux/mm.h: move page_zone_id() and more to mm/folio_zone.h Date: Tue, 5 Mar 2024 09:59:15 +0100 Message-Id: <20240305085919.1601395-11-max.kellermann@ionos.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240305085919.1601395-1-max.kellermann@ionos.com> References: <20240305085919.1601395-1-max.kellermann@ionos.com> MIME-Version: 1.0 X-Rspam-User: X-Stat-Signature: gxube31z47t3ha35wjwcocy8o647o6ff X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 020564000A X-HE-Tag: 1709629186-737632 X-HE-Meta: U2FsdGVkX19FZkJKM4fiM1kojyDZSlaejIox/9iEAbZxF2QNX0D0pEREeKFsNBSwV7/btrZ7Wu4rZsD1OpjBsumr6XRHh2CDzVoaS5Z1fK6i34Bsv9To2O3LqDHiSxtkoEdyhZgfAjEVGSQuMlHDwK+AEihB19EHVaVY/eM+33j5lb/GvIq+S35YWMlhEW+mw8OOzivMgswuC8sUSbYfHY8Dz9bAK16xLpc7Ya3Ex2qyAnqVmc/neyqyRBhqarK7n2bbxt7kJ2lgU/ioJ3Azsb+ayPrMs2fOksEfTfMAaNwqjYljIZsbR7GwvE/JQHsLqEaK7HZ/kXmB4yEdf7gK/DBkf7Ru7rsUeVIpRaCa9xsn2N+1MJjmmuMBx4vKDA0JiL4YGZWWPTos0Pkn09dT+GH91WZY+IUpmecLMyNlhuvw3GALA3CjoX9xRgU3qTHSQlx2BD3tBAQNKAFwPK1iMAXb9uQa6LulFuWZk4aUAJ9roKBtAWgstyAi7IN9ez80++/YWnDskgL+gTGHifjlBFmK/bKsSRH8qEfID8bA9diwYCW7EOcv/m22H7W9Our3ASv5goUEvjP+i9RK72xyh2FR6dRZb12wAlpL5o8F7Y/hPTY0CYWruWSvfBUGLM5WpWtrMpx6jJqeJX5zEiLBCBSxLuaQcO6jA3ly1Bsiy+Y/Dz/MuBH0JR4J5GvxWHgVUCv/OYxLBfaJQY3CIywO+29qpm4abZnO+EAIwNkAJhofzLo0UBZKWaX6AU1nOIbD2145U2sZJ43+TQr1VtvX9U+Jus95t9fi6RP0taKZog3ixnWZp2zx5qjVU0NOm7C976bwT/FTQFhlMXaSE0Au6TYHr5XAVBUkXqQE+gSoNzyRoIjTelzIykptNY+kSmme9Suh01kz2fZwhFdpiBxc/E7AWPwM0U4Pid8LbsFJAXA5Tx6+oTh0y52RMRWk+Jful9uJYre77D4T+OuFte8 +aEodvzj VYSYhWpMh4qToNW7gmevN7g1Lx6X6yzEPG6yLpy9ce+tKLkOp8zQuU+mVIvAIm0WfvyaTuGtHGQGBAuXg79jLjL8w1YzMAQiqRhtCLpUg1kkMF5e0kzLL9l7398uXY1NbxYo38FjTYanhGysS75/QAg/gv8e7ECWxpbptXi2yr0tJWE4lyKOx4isP9gtsSWl895EoSq69RlcwtxZ1OAFwEWzZFaR+bQAK/8rjfsTifPg8eX+k7dEgBhuy7Nq2Uq4aqE1dC7pOa6UQ5IY5WKO+I0EnH/62VRHlZ0twliXJEWX9mOxzLeEKoJBnehmVq80R2JPguAp4ywdbOsk4M0+pYZ4GiKwKJKlRqulAdkg4mjVhB4pC9z+BUj6QXRg84wEGFhaI7iMFUqHVdHXGxOgxC0RSo0XCZH1J2Q4/+0B2+0mLWF4= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000024, 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 | 28 +-------------------------- include/linux/mm/folio_zone.h | 36 +++++++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+), 27 deletions(-) create mode 100644 include/linux/mm/folio_zone.h diff --git a/include/linux/mm.h b/include/linux/mm.h index e8a914e7bebd..b3f83fb26aca 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -5,6 +5,7 @@ #include #include #include +#include #include #include #include @@ -1370,33 +1371,6 @@ static inline bool is_nommu_shared_mapping(vm_flags_t flags) } #endif -/* - * The identification function is mainly used by the buddy allocator for - * determining if two pages could be buddies. We are not really identifying - * the zone since we could be using the section number id if we do not have - * node id available in page flags. - * We only guarantee that it will return the same value for two combinable - * pages in a zone. - */ -static inline int page_zone_id(struct page *page) -{ - return (page->flags >> ZONEID_PGSHIFT) & ZONEID_MASK; -} - -#ifdef NODE_NOT_IN_PAGE_FLAGS -int page_to_nid(const struct page *page); -#else -static inline int page_to_nid(const struct page *page) -{ - return (PF_POISONED_CHECK(page)->flags >> NODES_PGSHIFT) & NODES_MASK; -} -#endif - -static inline int folio_nid(const struct folio *folio) -{ - return page_to_nid(&folio->page); -} - #ifdef CONFIG_NUMA_BALANCING /* page access time bits needs to hold at least 4 seconds */ #define PAGE_ACCESS_TIME_MIN_BITS 12 diff --git a/include/linux/mm/folio_zone.h b/include/linux/mm/folio_zone.h new file mode 100644 index 000000000000..572fe37068f1 --- /dev/null +++ b/include/linux/mm/folio_zone.h @@ -0,0 +1,36 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef _LINUX_MM_FOLIO_ZONE_H +#define _LINUX_MM_FOLIO_ZONE_H + +#include // for struct page, struct folio +#include // for ZONEID_*, NODES_* +#include // for PF_POISONED_CHECK() + +/* + * The identification function is mainly used by the buddy allocator for + * determining if two pages could be buddies. We are not really identifying + * the zone since we could be using the section number id if we do not have + * node id available in page flags. + * We only guarantee that it will return the same value for two combinable + * pages in a zone. + */ +static inline int page_zone_id(struct page *page) +{ + return (page->flags >> ZONEID_PGSHIFT) & ZONEID_MASK; +} + +#ifdef NODE_NOT_IN_PAGE_FLAGS +int page_to_nid(const struct page *page); +#else +static inline int page_to_nid(const struct page *page) +{ + return (PF_POISONED_CHECK(page)->flags >> NODES_PGSHIFT) & NODES_MASK; +} +#endif + +static inline int folio_nid(const struct folio *folio) +{ + return page_to_nid(&folio->page); +} + +#endif /* _LINUX_MM_FOLIO_ZONE_H */ From patchwork Tue Mar 5 08:59:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Max Kellermann X-Patchwork-Id: 13581864 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 9075FC54E41 for ; Tue, 5 Mar 2024 09:00:10 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id BD2D26B009F; Tue, 5 Mar 2024 03:59:50 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id B83116B00A0; Tue, 5 Mar 2024 03:59:50 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9FD5D6B00A1; Tue, 5 Mar 2024 03:59:50 -0500 (EST) 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 8DBA86B009F for ; Tue, 5 Mar 2024 03:59:50 -0500 (EST) Received: from smtpin03.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 5E33940B45 for ; Tue, 5 Mar 2024 08:59:50 +0000 (UTC) X-FDA: 81862387740.03.0ACBEF1 Received: from mail-ed1-f52.google.com (mail-ed1-f52.google.com [209.85.208.52]) by imf10.hostedemail.com (Postfix) with ESMTP id 9B30EC0011 for ; Tue, 5 Mar 2024 08:59:48 +0000 (UTC) Authentication-Results: imf10.hostedemail.com; dkim=pass header.d=ionos.com header.s=google header.b="E/xocz8E"; dmarc=pass (policy=quarantine) header.from=ionos.com; spf=pass (imf10.hostedemail.com: domain of max.kellermann@ionos.com designates 209.85.208.52 as permitted sender) smtp.mailfrom=max.kellermann@ionos.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1709629188; 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=i50xlwbZc74AakEZHNdRuLF9vXbOX6ErFGehWmkuapg=; b=4ZCDtc/dJgHDt3Q9eIEZQ2h5DfnThe3skNrOJaIq/vulPeJaIqCJYXaN5MboOt1YpB51YE d7dOIpGBri8Furhzsm5dhODAbtm3IwqxDUGTgDnu4jKTwcS7Mi/CEH7HHgXcvH8/h9Azk5 mosQsa3JONZI1nT2XIzMbZYxhucspwM= ARC-Authentication-Results: i=1; imf10.hostedemail.com; dkim=pass header.d=ionos.com header.s=google header.b="E/xocz8E"; dmarc=pass (policy=quarantine) header.from=ionos.com; spf=pass (imf10.hostedemail.com: domain of max.kellermann@ionos.com designates 209.85.208.52 as permitted sender) smtp.mailfrom=max.kellermann@ionos.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1709629188; a=rsa-sha256; cv=none; b=sRFwFtuw9JyUSEytNFGaALROGUZpODvOImEi889ftTruuJ0NtkHyBVkQGWZEBAN65KaeXq vfVhAVX+PZBmmS3VCB79pqIB7dqyHMnkJb37YBHWVIGSZ1yepbghRWNICYpBqnSPVnBWRV crLr2yDNZYlPek08dul77BOXRNGIySY= Received: by mail-ed1-f52.google.com with SMTP id 4fb4d7f45d1cf-5658082d2c4so7403411a12.1 for ; Tue, 05 Mar 2024 00:59:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ionos.com; s=google; t=1709629187; x=1710233987; 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=i50xlwbZc74AakEZHNdRuLF9vXbOX6ErFGehWmkuapg=; b=E/xocz8EadQxpDPMx8HAzQvRIrDCfliOvtMp3JKYBX1srz+WeKwfjW90J/BaIMKdPF 3lKGC0N5hUlU1qtT1owG52S3M+DnONu8JgcoHBBzLVzTBg2gkgAe6A7PcAm4a7gAFmCK +jlLUXBqGx6QVMUpl1EV20TtLb0Hjm/cjkJdWUfelAtKhACtvEpkLZuXBMmBwv/TT9EG 5WI/LjlbST8wjluxBfAJGUHn+MLh8tg/jtOMFZykTYdakD4n66dwi6YJa8OQiXitqpeK IAH+OL9Oke9HwP6AlxbP6E+kjH+KklUCsqOSlnB2Wyj6LLbjcZbke1JtNSZLHKrCoT4C SeyQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709629187; x=1710233987; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=i50xlwbZc74AakEZHNdRuLF9vXbOX6ErFGehWmkuapg=; b=B5MOe1V06Rtu5WtR5y5Al4t2V3LleerPxtAu6n25FcGgPco0Hfe9mSHit4faqtOl8B dpaxi7+YZ1M7xsHhnKaHLskChaaFA1dmmWF2M3j+prU1LgueTICfaayoYNAQm9NotkQ7 O18Cwn+MYdO+0WkrlMQ2Yb1eiJipKxQweNoeMNSv/iTWrYSpokXlbPvawiVFJSdp0n3+ XptgBBzF2zRxT/HPvVG1O/IqU3flVEzUCDbNAYmQ4ygggiyOOCEnlgwIyrSac7e+Nrta RIJd2Qmstv/LWbxRQEtiPiI2n/W8YwtFke/WpZLnvgwCz7LPxrm5Olo71sCxLf9cY3uH 1abA== X-Forwarded-Encrypted: i=1; AJvYcCWi0kOGYV0OYBXQSd2pc10eUb5KrMbsDp/h9BwxelQMWKWB4fVssY/8FqlNjSvtbi81i1EMQSJQ9oKBDSJZelQBjWE= X-Gm-Message-State: AOJu0YzdGgq3dYhVJndifHFSX/2y7WIZSKX2kMAK171jW3CuJ9fhgPki GyeLZWQeOQOVeUNQRawfRBmJnvdXvDKMyPHLCukR8pBQEc5QHPNPm5/DddjX+bw= X-Google-Smtp-Source: AGHT+IH5rQymVzDyRd5/kVEF3MMnB3QjDXj4i4rk7c4yzXXCC29AJ9nQ021BYHQfLPW889VaZHI1rw== X-Received: by 2002:a17:906:d114:b0:a45:ac31:4bde with SMTP id b20-20020a170906d11400b00a45ac314bdemr450647ejz.29.1709629187311; Tue, 05 Mar 2024 00:59:47 -0800 (PST) Received: from raven.blarg.de (p200300dc6f010900023064fffe740809.dip0.t-ipconnect.de. [2003:dc:6f01:900:230:64ff:fe74:809]) by smtp.gmail.com with ESMTPSA id gs4-20020a170906f18400b00a449d12cdc5sm4453005ejb.119.2024.03.05.00.59.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Mar 2024 00:59:45 -0800 (PST) From: Max Kellermann To: akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: willy@infradead.org, sfr@canb.auug.org.au, Max Kellermann Subject: [PATCH v3 11/14] linux/mm.h: move pfmemalloc-related functions to pfmemalloc.h Date: Tue, 5 Mar 2024 09:59:16 +0100 Message-Id: <20240305085919.1601395-12-max.kellermann@ionos.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240305085919.1601395-1-max.kellermann@ionos.com> References: <20240305085919.1601395-1-max.kellermann@ionos.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: 9B30EC0011 X-Rspam-User: X-Rspamd-Server: rspam05 X-Stat-Signature: csezdjbxwm9raxbs6crahi5j5ioroxut X-HE-Tag: 1709629188-774406 X-HE-Meta: U2FsdGVkX18cRyizyLa5cRk5pzgW5hxhWGDSkg9ALy/lhJjyAmGGmNxkUGz8U2mkKPSWYhmcrOOc1fPHm9c1ROaVXD7k/EumtjkEvF1kuOkSCQ+rV5H34g7masU4oRo+vpsC9n86x4iczxEfoaghGMPeCt4J+goHqZg4WnrVfh7R6NRpgM5Xuk7SMdFxsbjRoiuXE3F6mgJPuydPJ+LHhPjcS4XDR59gDp59C11bxX1fhI0Losl3DTgxxsvMMUhrim2OJ99IG0pbvEV3hmXyQKztG8Z4nNFUKArPcJFanDDPD7oxPi5yltNPa2RG78iaI70cxc2CZxTgz8E8Ck/uOsUsW1D/DbDFM5ze6bRiandPibVWZSDsVmEELyfESRHk0Lbj3X7nRqhSxRTaK9upZRP2Q/tpd9/IT1ZOFjeo6Guz4EKUEvt5bWNLSY0l3QaGrilKH+EubsHf0BMoYHdL1fNUz0RtqdDsA9AUbBCAgVpAv7pZtIZr/BV/44JOKvO1YZABrcf8mZhIej13T8ZUQfF9Tv+96YpOXgFcuR2LNy6RqctMpYuLZWyP9Q5mtleR4pIl6y+a+BMrgobR2/hSLa8oNXZ/YXUasNsEkGxBfAhKOkGMQ2StJTvE2e9HGamGGSK1W0QGh8/LX+Xb2RqWrVa+Bi0r6iN8+B23OivgihYCLev2eTfmWfBryWFr1W49v7dJB4/PD/ivUQWC7/X6kpE1eopJ4qyPg2IG2WyuIGuMGCZ8Wq0UmySqsrWopsKTSECeVO5w6W3C9Gtr41Z1PedX4D9zYvxWgIiYCxIk+werBc6ZtIqYrf1OQtTkM2ucVFvn3b3l1LpLbUBJ5G4AhpErGXoOobrgIhaHwj06Nj/0D1uz6u8/E4/SPiiEHGuA/bckXMsg/A67jjZfpizzLytqSBZyr0PZPQKwxKiyvHhuGhlrQ6iGdxUHDJY584Ne95LzOik5V4l0Z+GqZ7/ fCeSyEAS vWEjbMdyCk/lEMvyW4iR35l4xZ7WBbREh6zUsbsBl+h9HzRvFySbEU0boTJ0Y81L0piuJkh/sYJ1nfvj+/3kajIN7TgCb+H6Qf3TT0IKZtwaPm1sg9yxN1BtIqw== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000890, 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 b3f83fb26aca..07262ae43c5d 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -8,6 +8,7 @@ #include #include #include +#include #include #include #include @@ -1763,50 +1764,6 @@ static inline pgoff_t page_index(struct page *page) return page->index; } -/* - * 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 Mar 5 08:59:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Max Kellermann X-Patchwork-Id: 13581865 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 230E4C54798 for ; Tue, 5 Mar 2024 09:00:14 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 1C5106B00A1; Tue, 5 Mar 2024 03:59:52 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 14D656B00A2; Tue, 5 Mar 2024 03:59:52 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id F08D96B00A3; Tue, 5 Mar 2024 03:59:51 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id DCCC06B00A1 for ; Tue, 5 Mar 2024 03:59:51 -0500 (EST) Received: from smtpin23.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id AF03B120E00 for ; Tue, 5 Mar 2024 08:59:51 +0000 (UTC) X-FDA: 81862387782.23.F3491C7 Received: from mail-ej1-f41.google.com (mail-ej1-f41.google.com [209.85.218.41]) by imf30.hostedemail.com (Postfix) with ESMTP id 054D280010 for ; Tue, 5 Mar 2024 08:59:49 +0000 (UTC) Authentication-Results: imf30.hostedemail.com; dkim=pass header.d=ionos.com header.s=google header.b=aA2LjCIk; spf=pass (imf30.hostedemail.com: domain of max.kellermann@ionos.com designates 209.85.218.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=1709629190; a=rsa-sha256; cv=none; b=QARvTWCWMv22bJOUx99kCQottaAKDitLAtEhEDnes57qt3B9zPOE630BaBOlcwxUA1+tcc 2AmvaFV6ORKxhJ/IdoTWzr51VSMoYd7wyqaVGGcAnSLsaJPsAe2ZVs+I7lYGx/ri1IogQ1 2RqB8aJKQjrlrMBDumJmVMpGOuNi708= ARC-Authentication-Results: i=1; imf30.hostedemail.com; dkim=pass header.d=ionos.com header.s=google header.b=aA2LjCIk; spf=pass (imf30.hostedemail.com: domain of max.kellermann@ionos.com designates 209.85.218.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=1709629190; 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=ATfCxZ0IifVoQF3dNCoyZLQIGDsbM/UfOW1XioKp6uI=; b=sOHznW6+srUJIKfxAeJuw5s8rcUCb4CAELpzL9mF1wj+RVC5AzMlVA+K1IUGjA76WbMlo5 oAfOHKZkiT8zeLmiSe9/c0vlC7ZK5MCqW+we4/oiZFuQsdnH2IFkvJUa+jA5DWbEYyuQe1 8fqIxApwdlNlQOXiPz10HqLh/vFPN10= Received: by mail-ej1-f41.google.com with SMTP id a640c23a62f3a-a44f2d894b7so330585466b.1 for ; Tue, 05 Mar 2024 00:59:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ionos.com; s=google; t=1709629188; x=1710233988; 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=ATfCxZ0IifVoQF3dNCoyZLQIGDsbM/UfOW1XioKp6uI=; b=aA2LjCIksMe02eoSnEUHkGnCRoWfrSxv3coZXHppBgnZbesR9z/yUd0z7WYNg9Qqq7 JeQs/iRNdKwzdJc01v3PzH0rgUmGDFMrjG+6VwnfnZ+BrNmp0gKTNc+C9aKAP2dDkVna YGlIoQcHm6o4UUG9F3zbPbILEpAdOHJQdHrs/pKzky42QzzJ7iC6EGnEmDWmn7xrLy11 /bhxlQJ9Q0Qbl/v3FDgXEQXwgfV489G03EvSmeHW6SoMXa/0OoUN4JjMrHWJ3N6UT+1o Mi1zSaAweygUyvqSXih9pXeZts78YiqOC9+o/lCWJ6b6Q1+ESSBckSHKvQom+ThgET21 /T1Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709629188; x=1710233988; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ATfCxZ0IifVoQF3dNCoyZLQIGDsbM/UfOW1XioKp6uI=; b=F12o/984ypfDqsBiOMT524ooouw2UT49uTkIPP6zoih2Vq5qftifnqQMS4u/267FfR ++TsvXDYpEbM9mxIvdU9ikTF11OgTfUipylC/uOoMLhuL9mOsQ/WvF6qxYRO2l8uEVmI 8wto7CdQT0MQaIHGzcjZhpAHvZnxevw9Vn1PY1h2l8ZL8dj+VOuWsNP3M4odiML9XMeb tobI2nGB+lFTuxaJ5E71T49IE20RT9H6EjlV+b3hCWqMD4Muqb4YqJAamAupvNDa1kTz eL92rODEnK94Sx50K+AgpX9l18mq2q5wmhcHbzbDHVhlkt0RKdgkEdkA0Zr8/6M0lhje jSEg== X-Forwarded-Encrypted: i=1; AJvYcCWf4oAW1AN9EvuIDWhpuJs2eZA2Vudla5/qDqroMpD//LsMAvc03AN2rzoDs3OjiEpPtOwfSWv3UotlEl8OKiWkmEg= X-Gm-Message-State: AOJu0Yxkoy9C5tE6cL6hXUzZycy3kbXLD/qjBriHifv/lusMqk7XCnSy 4Sdqkb253fmeK2VBTShCMEpFEUYLoVr++REEFAmqPc5W6V1RwQfsdo+jE4PLJs0= X-Google-Smtp-Source: AGHT+IGDWjdTWBhp9yoamhZMNLezFfIn6Lq1nEJWjHZkb5MGsCgGfbPtzgnfRK1QoTBK5gAAf0Xdmg== X-Received: by 2002:a17:907:20d9:b0:a44:1b98:1829 with SMTP id qq25-20020a17090720d900b00a441b981829mr8277971ejb.57.1709629188722; Tue, 05 Mar 2024 00:59:48 -0800 (PST) Received: from raven.blarg.de (p200300dc6f010900023064fffe740809.dip0.t-ipconnect.de. [2003:dc:6f01:900:230:64ff:fe74:809]) by smtp.gmail.com with ESMTPSA id gs4-20020a170906f18400b00a449d12cdc5sm4453005ejb.119.2024.03.05.00.59.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Mar 2024 00:59:47 -0800 (PST) From: Max Kellermann To: akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: willy@infradead.org, sfr@canb.auug.org.au, Max Kellermann Subject: [PATCH v3 12/14] linux/mm.h: move is_vmalloc_addr() to mm/vmalloc_addr.h Date: Tue, 5 Mar 2024 09:59:17 +0100 Message-Id: <20240305085919.1601395-13-max.kellermann@ionos.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240305085919.1601395-1-max.kellermann@ionos.com> References: <20240305085919.1601395-1-max.kellermann@ionos.com> MIME-Version: 1.0 X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: 054D280010 X-Stat-Signature: gzaghxawrfi5ounuz5sg6g5w4csc1ruq X-Rspam-User: X-HE-Tag: 1709629189-142147 X-HE-Meta: U2FsdGVkX1+RzdTyqvt/3KCsGqUOPo1sWVcaIAyCxkMviiDGyLVhepzBiug5oeOhNwcaGAMbCF+6JrecnKCZt4N+w14ZQc5bEPHk+vKIwwJWViK4g+h6Zq5ngz9EDts2swDjtlGmPA9pkUQE+JxRAnY34JGUxCZ+sUsvy5N6fp/rYdfWi20eiy7GP4xtoebTtu9594mpnBKR2l1MZJz74e+aT8mnrlDQIN2wUTH/XnxjI+irFTPSN86a8N4iJMA0mnHxGiN1vlyw5L/N530kMJgtQpBszmWUEqFJ0OZi9ik2N1Q8gzZ3gzGGO6YtNmzZUnxLQSLWgggPbS2L6I4q3eslDFTppvpKRL0pPfhauJuHUdmVC/3jDvIZhGeJiaIv9xuN71Gpu3XFeYsebB6asQWhdJOIteu6FP7Hv54zaVEIAipQHoORUT5z4UzBgMtvvcnoKAErL99bAMH+JY+OyMaIqEyHLR1bng7mfqJdm2c4MbJoSwykdU2q6LvzX2o+EIcspI1rrrka0T2Em4HgBCX3D4jxqaHk/TS9RTbF96I0H7zq6VEGFDti53GPnpDwXJyli8PaKDCZ6lEJBOiYwK6m0n136NCqdyWShwkHLeQu0B1QM6xCeCPQYhShfdXc7VMCSghACOOIU+STgO5Fp0CrkUlVNi141ElAxxY5nYknZNlKzTN/3ltNGd+1OgGSWym6M5YNzo5ZHkkeGIJCbI09OTMIHFHD1DjDwc67OvKsTyi9iuqzsOA+dtdD29wAq6uLEe74aBtdmg65eLKeOVHwEioHx3h4xKuIdYwDnjvCz9Dfj6oJPNQIoGb/FdyCSKUCjsqEIm1a9yDItfqg0X1v4YCT4LDatwpE57JmxYFncLW0Sxbu5jhLRqoa0f/pjTv9grJh3H7PmoDdCY7bweqPnTM7FYTbFnEDIhZKX2vMc47Q0nV/K6e4ejVdJ9pdttigQUjXEOVtIqH6aq2 3YHq1lPg qRjJVKrM2DdkKhTSEFdbOB8rr/qDvaies6SjHKcc1EbobwBH4UpjbSv9ExdhC8J1jE3gJniZ71G85bODaluCb+GDKVBHbyL/R6TcWPIkZo6eRSxun0X7g639+a5s72PgsWY5somRyocaCE+kRnPzACY9SP3H2PUzJ/H8P 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 07262ae43c5d..80fc7df2856a 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -9,6 +9,7 @@ #include #include #include +#include #include #include #include @@ -1086,30 +1087,6 @@ enum { int region_intersects(resource_size_t offset, size_t size, unsigned long 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 Mar 5 08:59:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Max Kellermann X-Patchwork-Id: 13581866 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 5307EC54E41 for ; Tue, 5 Mar 2024 09:00:17 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id BD4936B00A2; Tue, 5 Mar 2024 03:59:53 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id B88456B00A3; Tue, 5 Mar 2024 03:59:53 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 913BB940007; Tue, 5 Mar 2024 03:59:53 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 73B7B6B00A2 for ; Tue, 5 Mar 2024 03:59:53 -0500 (EST) Received: from smtpin10.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 4D06D40DA3 for ; Tue, 5 Mar 2024 08:59:53 +0000 (UTC) X-FDA: 81862387866.10.EEF8296 Received: from mail-ej1-f50.google.com (mail-ej1-f50.google.com [209.85.218.50]) by imf04.hostedemail.com (Postfix) with ESMTP id 5289740005 for ; Tue, 5 Mar 2024 08:59:51 +0000 (UTC) Authentication-Results: imf04.hostedemail.com; dkim=pass header.d=ionos.com header.s=google header.b=a90ocAmI; dmarc=pass (policy=quarantine) header.from=ionos.com; spf=pass (imf04.hostedemail.com: domain of max.kellermann@ionos.com designates 209.85.218.50 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=1709629191; 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=rAj7+x69ZY+4IfKY/7bKK9Eao6rfkUHshm8TstoFK2I=; b=UGFLv8UkmF+ia+9gMxjXU0WCyOGp67p+lbrrxdjMa+ONe1+gzzQ7JJFKXkqWB802y4kswm gFypOPgCMdmiXVbyGUNhTpMJOiDCu9wfT4S8wbcGdZuxmxIk+WpHshZAx/L6CKNsVu4iuj DeKqEFlETsCv/XUJamc7ixhNcs9jzuA= ARC-Authentication-Results: i=1; imf04.hostedemail.com; dkim=pass header.d=ionos.com header.s=google header.b=a90ocAmI; dmarc=pass (policy=quarantine) header.from=ionos.com; spf=pass (imf04.hostedemail.com: domain of max.kellermann@ionos.com designates 209.85.218.50 as permitted sender) smtp.mailfrom=max.kellermann@ionos.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1709629191; a=rsa-sha256; cv=none; b=RHwO7LcAZ1GUn4rQOjlLr4VDSpVY7irOwtP1oXq2oq4TQDhePwB7yO1dYXIPTxIHxQF2IN bhRoA8bRlnUo4Z/pawC19vz9Yu+fuvie5r/snLJlgKmmfVgUQHhEG89oiFJHFbCJYVjaM2 hHIDjriBFfvvCVehMfJiBErTC5SFW/o= Received: by mail-ej1-f50.google.com with SMTP id a640c23a62f3a-a4515f8e13cso257821466b.3 for ; Tue, 05 Mar 2024 00:59:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ionos.com; s=google; t=1709629190; x=1710233990; 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=rAj7+x69ZY+4IfKY/7bKK9Eao6rfkUHshm8TstoFK2I=; b=a90ocAmIVzWITolZry5NC7XfeRqgUuWEQORLKlb2jcpFJ32iySoto4wZvhEBPrGKO8 /OYlpdHtcIFepye9B0u/VkTvdYj0kDosZiwDNtVDeCqu1IjTVe/iwtHAmDG4pmlw8HOt hT6b02cuV6jl5CdummmLdkxHS/CJudZhTlNXfDFRnVqW7sQh0pIEsk1ohrKSCsAYf0oP cpOmd6HJBzskZkJ6+67iSNp3+pH6jYN9vA8mTnFb79kHjOi4gm/RHbdeDBwkSB1ay8mc DS8dXXD3zL+X+Y35H34iSwyE1H6dUf55YYCdWDgeagzqjm/Dgirs1L3qnciRRTkZe0Dv UECQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709629190; x=1710233990; 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=rAj7+x69ZY+4IfKY/7bKK9Eao6rfkUHshm8TstoFK2I=; b=tMJcpn21VX8Fs7H231s2psMy1CgJQh+NvyU7DJfV0f+T5hf1VHnowdyWtpM1HWmyuw Wy/pOHGEMNLHtDsT5oUrbVKEo7PPOdDZmEvLo6qKog1gOC6SLCpoSkxK0E6e0ogEpitX T/k4GCSIYwX1hBapKep65rxrdw/gQZUXIOqxttUyRO69sD49tPfG6nRj8wstsgcQKPg4 xi66/huomTQ0VlX17tAFaGztEuI1C5w4xX382A0KFf7xfYQdDjMXXe/ZG4oSaaCJmAd8 xEk5vAzz0n3meuzGDWAv8atQuTtKypEL1VO9UBkjp6dw5hbJGFjqJgjeg/MmaLH4xxIW SgFA== X-Forwarded-Encrypted: i=1; AJvYcCXeMezoCC5BDqgiBYNQc0ZjyDUu72MQS2FQPqs1RmJ8C/Gydx10LT9GA/JKU6go7lnURf1Q/mM4dj+hGqGzBWM40wg= X-Gm-Message-State: AOJu0YyTATtr22uv7C5bdxK6+MxWsYbdwmF9zyYmSn5B0CS4/NqbxQb0 9UIFCD9JzitTVwyx+8wQS62C8BhzDfrDW2jQJM8qYp4g/h13dvUKybWp32uju/g= X-Google-Smtp-Source: AGHT+IGszUMHFAY8nQqRc7qWBrdOVwxqgaSpJbhboGAmezWe2V+nz5/IYJkGc34N3h/3F3gINvIIXA== X-Received: by 2002:a17:906:b893:b0:a45:5cd9:81ac with SMTP id hb19-20020a170906b89300b00a455cd981acmr3215788ejb.22.1709629189950; Tue, 05 Mar 2024 00:59:49 -0800 (PST) Received: from raven.blarg.de (p200300dc6f010900023064fffe740809.dip0.t-ipconnect.de. [2003:dc:6f01:900:230:64ff:fe74:809]) by smtp.gmail.com with ESMTPSA id gs4-20020a170906f18400b00a449d12cdc5sm4453005ejb.119.2024.03.05.00.59.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Mar 2024 00:59:49 -0800 (PST) From: Max Kellermann To: akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: willy@infradead.org, sfr@canb.auug.org.au, Max Kellermann Subject: [PATCH v3 13/14] linux/mm.h: move high_memory to mm/high_memory.h Date: Tue, 5 Mar 2024 09:59:18 +0100 Message-Id: <20240305085919.1601395-14-max.kellermann@ionos.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240305085919.1601395-1-max.kellermann@ionos.com> References: <20240305085919.1601395-1-max.kellermann@ionos.com> MIME-Version: 1.0 X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: 5289740005 X-Stat-Signature: 7yto6h7hcgmcobuetft3xh54bs7e6kbm X-Rspam-User: X-HE-Tag: 1709629191-250441 X-HE-Meta: U2FsdGVkX1/cWQSBMYfzfBoRey8Ux2FwuMp9Gdw5YHoEffUqC34lTxsTy5iQYLOaE9oVllPagOi8gY2S118j8RONh1TppheZVKTHcK/NCnpS7LLXboMVWNGOv4n0LXM/666q051/UJsDFiaV5AZd0yMU1/ADDWBpSnJKWncFCdxO1U8NUJbD0DLrldquC7vl7stnOnXdiIg4eZQIcU59iSxMmL6m11cHJu0B2Bf8+FBSBNxT0uJRKLrQyVrmTY9KBnLXpaMd39GcRmzPcqHH5BxtaH3zB2DyPTb6h/y9eNhA7mHS+Zc8SE5a+TR3sUNXxirUHWjT6DCI9JB+vsQR77VrIyIiYIiMBXdAwTFk4zIja/3jEB4yTmbXN4bi2ipA2vxLoMCCtlreJ+ExyM3fVmiNk8YfNjlge+T25FJHEM4VBWDggv0W0KYs+O/9YDdqJJQgQMGv68G5n2gbXGcwBymEzSdJ/aHJcRUINtx8D66YQ3WJubB11ZhfYF8ipo7Fp06V9Fu8okRN+YpghqHpiRn+AeeIGz2d5hhXSsieXotqzbQBww+MKTJPkLdHrmqQJ/VP8blqGKl5tktC3ezzxdAUBaQK2Pd73urbfqZa/HLQye77AuZQRj/LsQ1VQNQRoPKraLuavA/z0pjKENzagDohjaaq8Wek62KzcX6oBe0xALL4cqm7zyZQds9k0QWEXuCt0lJWANDZXAFhl4C0vCHx8oe8ddJNCo318ES6PSlo7c+0QbKSaceTosIDr/Ko2NZAai91BHag2bKLo7hGCYtInGnJg61PMLKPif+VB6k6NDC99GIlHVxO+k13NhHQb16PTdz65ufy4uzdzuUEgJE8aTND6ryUGhXWTevnEKobJvqNNgdW6Rv+GyIEw+pulhMoosuIJCeL/fIiW+d/wLaE5i0bkj2vSYCQshP1iFOiZIvxO2EfSj2vZhCArvItBDd526hKMEJbOez61vy QNn9+KRD x7DxsSUecuVAl/g66YmzsqHQ3pz3ZfqOUJGnov/6L7CrgvCXs9W9iOrZdNsTpJmo5agi79+AXFYbyeCSMNicAfq0Io/K8QxahH5Skvr9YdnmkBzUUaUF86upYfACqyxriM4yNUTWHjv+K02F5GJy6RO+31e6405jW7a35nscOQFZF1J8KhpXoSZ2m6XV87tHStmoMABq9WfWb/fpVCW6umEWDbJxbMERyo99MCRqK+f+Ls/gLCn1Ber9KxpyA60kyCkr3RRaOmxRMCBbIQLKKK58BusdgAiHoIWXd5aNLs0/FXIXxOes9rx5DVGEnnVeZY/yQqe1iKukuEE/G7HGG274S7NYv7U0szCXNdBE/GqlSUyaCP9w608/3XaKczFOjoHNkqHKW6BiPLplsAQs13mAUsevLDU52NFtH9KANtUJWDMc= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: This variable is used by lots of arch/*/include/asm/ headers, but these do not (and should not) include the huge linux/mm.h header. Let's move this "extern" variable to a separate header and include this one in arch/. Signed-off-by: Max Kellermann --- arch/arm/include/asm/memory.h | 4 ++++ arch/arm/include/asm/pgtable.h | 2 ++ arch/csky/include/asm/page.h | 1 + arch/hexagon/include/asm/mem-layout.h | 4 ++++ arch/m68k/include/asm/page_mm.h | 1 + arch/m68k/include/asm/pgtable_mm.h | 1 + arch/parisc/include/asm/floppy.h | 1 + arch/powerpc/include/asm/book3s/32/pgtable.h | 4 ++++ arch/powerpc/include/asm/nohash/32/pgtable.h | 1 + arch/powerpc/include/asm/page.h | 1 + arch/x86/include/asm/floppy.h | 1 + arch/x86/include/asm/pgtable_32_areas.h | 4 ++++ drivers/mtd/nand/onenand/onenand_samsung.c | 1 + include/linux/mm.h | 2 +- include/linux/mm/high_memory.h | 7 +++++++ 15 files changed, 34 insertions(+), 1 deletion(-) create mode 100644 include/linux/mm/high_memory.h diff --git a/arch/arm/include/asm/memory.h b/arch/arm/include/asm/memory.h index ef2aa79ece5a..a67afb213e2e 100644 --- a/arch/arm/include/asm/memory.h +++ b/arch/arm/include/asm/memory.h @@ -387,6 +387,10 @@ static inline unsigned long __virt_to_idmap(unsigned long x) */ #define ARCH_PFN_OFFSET PHYS_PFN_OFFSET +#ifndef __ASSEMBLY__ +#include +#endif + #define virt_to_page(kaddr) pfn_to_page(virt_to_pfn(kaddr)) #define virt_addr_valid(kaddr) (((unsigned long)(kaddr) >= PAGE_OFFSET && (unsigned long)(kaddr) < (unsigned long)high_memory) \ && pfn_valid(virt_to_pfn(kaddr))) diff --git a/arch/arm/include/asm/pgtable.h b/arch/arm/include/asm/pgtable.h index be91e376df79..eb80f6a65619 100644 --- a/arch/arm/include/asm/pgtable.h +++ b/arch/arm/include/asm/pgtable.h @@ -11,6 +11,8 @@ #include #ifndef __ASSEMBLY__ +#include + /* * ZERO_PAGE is a global shared page that is always zero: used * for zero-mapped memory areas etc.. diff --git a/arch/csky/include/asm/page.h b/arch/csky/include/asm/page.h index 4a0502e324a6..016f722fbe43 100644 --- a/arch/csky/include/asm/page.h +++ b/arch/csky/include/asm/page.h @@ -32,6 +32,7 @@ #ifndef __ASSEMBLY__ +#include #include #define virt_addr_valid(kaddr) ((void *)(kaddr) >= (void *)PAGE_OFFSET && \ diff --git a/arch/hexagon/include/asm/mem-layout.h b/arch/hexagon/include/asm/mem-layout.h index e2f99413fe56..a09116c50043 100644 --- a/arch/hexagon/include/asm/mem-layout.h +++ b/arch/hexagon/include/asm/mem-layout.h @@ -10,6 +10,10 @@ #include +#ifndef __ASSEMBLY__ +#include +#endif + /* * Have to do this for ginormous numbers, else they get printed as * negative numbers, which the linker no likey when you try to diff --git a/arch/m68k/include/asm/page_mm.h b/arch/m68k/include/asm/page_mm.h index e0ae4d5fc985..f958655d1931 100644 --- a/arch/m68k/include/asm/page_mm.h +++ b/arch/m68k/include/asm/page_mm.h @@ -5,6 +5,7 @@ #ifndef __ASSEMBLY__ #include +#include #include /* diff --git a/arch/m68k/include/asm/pgtable_mm.h b/arch/m68k/include/asm/pgtable_mm.h index dbdf1c2b2f66..ec593656bdc5 100644 --- a/arch/m68k/include/asm/pgtable_mm.h +++ b/arch/m68k/include/asm/pgtable_mm.h @@ -13,6 +13,7 @@ #ifndef __ASSEMBLY__ #include +#include #include #include diff --git a/arch/parisc/include/asm/floppy.h b/arch/parisc/include/asm/floppy.h index b318a7df52f6..98ed37c5dc59 100644 --- a/arch/parisc/include/asm/floppy.h +++ b/arch/parisc/include/asm/floppy.h @@ -8,6 +8,7 @@ #ifndef __ASM_PARISC_FLOPPY_H #define __ASM_PARISC_FLOPPY_H +#include #include diff --git a/arch/powerpc/include/asm/book3s/32/pgtable.h b/arch/powerpc/include/asm/book3s/32/pgtable.h index 52971ee30717..03e0a32e1c2c 100644 --- a/arch/powerpc/include/asm/book3s/32/pgtable.h +++ b/arch/powerpc/include/asm/book3s/32/pgtable.h @@ -4,6 +4,10 @@ #include +#ifndef __ASSEMBLY__ +#include +#endif + /* * The "classic" 32-bit implementation of the PowerPC MMU uses a hash * table containing PTEs, together with a set of 16 segment registers, diff --git a/arch/powerpc/include/asm/nohash/32/pgtable.h b/arch/powerpc/include/asm/nohash/32/pgtable.h index 9164a9e41b02..8a9f5b546e4a 100644 --- a/arch/powerpc/include/asm/nohash/32/pgtable.h +++ b/arch/powerpc/include/asm/nohash/32/pgtable.h @@ -5,6 +5,7 @@ #include #ifndef __ASSEMBLY__ +#include #include #include #include /* For sub-arch specific PPC_PIN_SIZE */ diff --git a/arch/powerpc/include/asm/page.h b/arch/powerpc/include/asm/page.h index e5fcc79b5bfb..c541e71d3d5c 100644 --- a/arch/powerpc/include/asm/page.h +++ b/arch/powerpc/include/asm/page.h @@ -7,6 +7,7 @@ */ #ifndef __ASSEMBLY__ +#include #include #include #include diff --git a/arch/x86/include/asm/floppy.h b/arch/x86/include/asm/floppy.h index 6ec3fc969ad5..7756e984f146 100644 --- a/arch/x86/include/asm/floppy.h +++ b/arch/x86/include/asm/floppy.h @@ -10,6 +10,7 @@ #ifndef _ASM_X86_FLOPPY_H #define _ASM_X86_FLOPPY_H +#include #include /* diff --git a/arch/x86/include/asm/pgtable_32_areas.h b/arch/x86/include/asm/pgtable_32_areas.h index b6355416a15a..b339137b4f4e 100644 --- a/arch/x86/include/asm/pgtable_32_areas.h +++ b/arch/x86/include/asm/pgtable_32_areas.h @@ -3,6 +3,10 @@ #include +#ifndef __ASSEMBLY__ +#include +#endif + /* * Just any arbitrary offset to the start of the vmalloc VM area: the * current 8MB value just means that there will be a 8MB "hole" after the diff --git a/drivers/mtd/nand/onenand/onenand_samsung.c b/drivers/mtd/nand/onenand/onenand_samsung.c index fd6890a03d55..7c3cc270386d 100644 --- a/drivers/mtd/nand/onenand/onenand_samsung.c +++ b/drivers/mtd/nand/onenand/onenand_samsung.c @@ -15,6 +15,7 @@ #include #include #include +#include #include #include #include diff --git a/include/linux/mm.h b/include/linux/mm.h index 80fc7df2856a..1d7b4c781995 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -6,6 +6,7 @@ #include #include #include +#include #include #include #include @@ -82,7 +83,6 @@ static inline void totalram_pages_add(long count) atomic_long_add(count, &_totalram_pages); } -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 Mar 5 08:59:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Max Kellermann X-Patchwork-Id: 13581867 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 E05C2C54798 for ; Tue, 5 Mar 2024 09:00:20 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 542EC6B00A3; Tue, 5 Mar 2024 03:59:54 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 4F43E6B00A4; Tue, 5 Mar 2024 03:59:54 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 346DC6B00A5; Tue, 5 Mar 2024 03:59:54 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 1D3FA6B00A3 for ; Tue, 5 Mar 2024 03:59:54 -0500 (EST) Received: from smtpin06.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id BEF5080D50 for ; Tue, 5 Mar 2024 08:59:53 +0000 (UTC) X-FDA: 81862387866.06.C4109C3 Received: from mail-ej1-f48.google.com (mail-ej1-f48.google.com [209.85.218.48]) by imf22.hostedemail.com (Postfix) with ESMTP id E693BC0012 for ; Tue, 5 Mar 2024 08:59:51 +0000 (UTC) Authentication-Results: imf22.hostedemail.com; dkim=pass header.d=ionos.com header.s=google header.b=DnroNY6s; dmarc=pass (policy=quarantine) header.from=ionos.com; spf=pass (imf22.hostedemail.com: domain of max.kellermann@ionos.com designates 209.85.218.48 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=1709629192; 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=kg2bpXGSRrzoISiqX7O1pb+MwUieZ+xnjYvseU34GPw=; b=pwrICu11MHcg+B0d0mrwQZT/y3ddnvelbIYukBqjImkG/VS91F75ow47xNXvyr127d+8Z3 p7nTYYbo8rApW0PDlRMLyeE/EBItpisb1+s3qrWo654RqyxXqtPOvXDZtwW9Jv6JqBkqPv k1GNH9SZ0lKftYysnoG4ZRiaCeW6hAE= ARC-Authentication-Results: i=1; imf22.hostedemail.com; dkim=pass header.d=ionos.com header.s=google header.b=DnroNY6s; dmarc=pass (policy=quarantine) header.from=ionos.com; spf=pass (imf22.hostedemail.com: domain of max.kellermann@ionos.com designates 209.85.218.48 as permitted sender) smtp.mailfrom=max.kellermann@ionos.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1709629192; a=rsa-sha256; cv=none; b=X87Ys9eEr6W93uhPAlQbp3Fag0N2/VVG7MYnHOCqpnzPkVRAzCXHzPYcxxzUWeD1g43gXZ Fe/Ndq0OnY+9uhvsWtaQ9B9FPvw6Y1hCGt5R39EjquylGjAomGBlT5pttzj/zrLhW2wXkW XIKYFzancmE5m4qw0l+OLiyQVDhqaZU= Received: by mail-ej1-f48.google.com with SMTP id a640c23a62f3a-a450615d1c4so399324666b.0 for ; Tue, 05 Mar 2024 00:59:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ionos.com; s=google; t=1709629190; x=1710233990; 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=kg2bpXGSRrzoISiqX7O1pb+MwUieZ+xnjYvseU34GPw=; b=DnroNY6shXVM1Q0DJaaUdR74KwCg2jGIZBvZRDtKHHtM+rG1/dttnQFhgKLK+IJdpN f/BD6kaARmrhvl9SxQZFzD4+xcNwLXdhlJqJIHZVF1AD8iJ9rNegsQ9NKsXJkQozr49V Hn4Di0eK0rOrDDan4wxScv3gpAb1uZFdp9Jri1RlT9YMGnWR+jyj2bekTJf46f2V/wQl Msg/oVg8kiDtKD38Dc02zWlFF+T6stRWoMsb+AaZvzujoHZTOv8oOJiJtjmVfGMEvKk0 2dx795c95l4V0KwFJ7es51a7Q0mdHhg3EWluKIh03QIhDYX4ekW8X2I3pGmHvoGsiShw 3DKw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709629190; x=1710233990; 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=kg2bpXGSRrzoISiqX7O1pb+MwUieZ+xnjYvseU34GPw=; b=FWOtQUH05Ifj8AQrYF1+9EZRrKvHXmZGjz0H+08tcfaF/6tbtQSgPOzBnFFhRfb7ty 2f8jfPz25zObyv7b48lnh4g2PKnJcQsX62j6YkiYC0n53co5bGYttjNsBR3s7mLCd1lR g4D61d+OOyE1ij8v920cleVILp6WKqkYUJaxYNYXXakrYAj7XKUFtucUUa8hDLrxNyBH 1iqL/rx1OJeegF57haXNGM0DY/R2nvHCXpciVQTvIPWqQN6COtKT9tiOm+0DDpKhSeI7 fSTswjYoAGetO2Jxwmmjuh1aL2U+Ne30/aq8vBeWh+sCe1iXqreUvlnQ6woriFM8ZKV6 +Fgg== X-Forwarded-Encrypted: i=1; AJvYcCUS4Qa8tEGoa+RgQcUlPDI2WsGQtNTiRjn4jpIcxoEpUXHoKKVKA/mFfItyt6aa/0E5s4I2rHhTJU8G3aPltjHjcc8= X-Gm-Message-State: AOJu0YyNUYJ/gUU4ksiuP4RB6MU1dtYQJvnk/KbwvcSBWW4/jIx4fWu6 521uNGAJJMY8zNIuWKNBIucX23Inshga6LPfDmADNxKYRbAS9ZcZVIzEWw7YyfQ= X-Google-Smtp-Source: AGHT+IEzQL7M2UuAo9MnJ/pbyNhFbLssWyCiOGjpuRhDJu5ujpFN+An9p4+sh1nmIhJdXaRA1x3R/g== X-Received: by 2002:a17:906:190e:b0:a43:ab6f:ef6b with SMTP id a14-20020a170906190e00b00a43ab6fef6bmr1942409eje.32.1709629190675; Tue, 05 Mar 2024 00:59:50 -0800 (PST) Received: from raven.blarg.de (p200300dc6f010900023064fffe740809.dip0.t-ipconnect.de. [2003:dc:6f01:900:230:64ff:fe74:809]) by smtp.gmail.com with ESMTPSA id gs4-20020a170906f18400b00a449d12cdc5sm4453005ejb.119.2024.03.05.00.59.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Mar 2024 00:59:50 -0800 (PST) From: Max Kellermann To: akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: willy@infradead.org, sfr@canb.auug.org.au, Max Kellermann Subject: [PATCH v3 14/14] include: reduce dependencies on linux/mm.h Date: Tue, 5 Mar 2024 09:59:19 +0100 Message-Id: <20240305085919.1601395-15-max.kellermann@ionos.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240305085919.1601395-1-max.kellermann@ionos.com> References: <20240305085919.1601395-1-max.kellermann@ionos.com> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: E693BC0012 X-Stat-Signature: rtibfw6ooodbii1ir8hca6ecyoa6uy5y X-HE-Tag: 1709629191-325674 X-HE-Meta: U2FsdGVkX1/c++Oq+hdKCUUIo1vmChqCFFHiWrM0Wb0F2WGCIUlgOOV4HDqDmzqJZxbq9sQsiTeJQhlJ2UvIEDsooo/a5v0OVKl7LC26ae44MW6Q28odAanrNKan59eRTPwyuiDwwmVuZQ84E0kdS0MeGo6AKnWHY388KxZTFl51mVJXqoN9PsWgQr1MqoBAJszctHxd9xAmwD3r+199X43u0GFAwOEAu6VIALIHaQ6cNlwMMkjEDe5nB7TJfwgefzbsZaRTHgDIFL+wsq4FkATo9kY1N/KgOVXbUubOZWqQu4Q1btP1c/IjQ5CY/GTNUET9Tit75GGXScezsTyi4nEslc2t8en1bv+EQVBAdzWsKOm6uFyAZIfDY4MtBbpR2fxOnVD/Z/1gLh0b478qWgy2A5KvxYn+WT+ayyUy8mbzlqA24E5uygLKjt4WFRqCOxa51+yJ067Nn2HJUzTlWIIVlZZEpITsQ/MxTTIqnVuGtRvSsLdV8Qfel7hLOyLtDK8zedA4P+0Gqe9wV1QqO9HWagY6Icn+sEAq/w1n49ptdGHNU+KtOlcXCJsN0NdqhoKQZXpJmoh4yzNtWDindb87f1pqUYISoJyhJi30A01s/yI7p3crUcXUzfAJ3d8gEyP3GMjuDJy76/LuLDVsna228xJaypEcdQmeyS04LKCRNQO8AP6l9lQX+B8p6HyIzLuILP9luxSyGqlTotKn9KFrdtEHakI20NQ1jpA19c3Jqo3DsW6QMz+vlm+g9AFOm+VOD5biWFpZkV0rCitrHHm5hvFay0gAYlVMuC1FgRA8V7iqOqjM/dvLaZJDY+0U7wWZxFoYujrDzYJHKk9W4IE8YxQ4BWkqYyvcP66qnz9Woslqy3DEj1CsiNfz3sMWPzIc4z3sm5xG23pFy2DP4kd2kAoQ9PbltdDiPZmNgoW+clQ/Iu6KbEBikHeA0wOcNlJfD+elfOlXZWmNIeH hoS95Rrp 8EisXkaSGTuxM8pAOYh7oi5ULKFvbUmdjIJHFSKVl+9LLX9Ss5cVw8h+32YevpoZ2heykUOgGiAQLQhG66viZptEWO8NT20eF+GU4RA8cOhvYizOEnG3e3xV108wGDloSkU7Y8EDAhwRvUsiN1ddy6E/H6OZ5GFR7FkNv X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: Replace with the smaller pieces that were just splitted out. This affects a few headers that are included by many, e.g. bio.h and highmem.h, which now no longer depend on the fat header. For this, several missing includes need to be added because they are no longer indirectly included, e.g. . Signed-off-by: Max Kellermann --- include/linux/bio.h | 2 ++ include/linux/dma-mapping.h | 1 + include/linux/highmem-internal.h | 2 ++ include/linux/highmem.h | 4 +++- include/linux/scatterlist.h | 2 +- include/linux/skbuff.h | 4 ++++ lib/scatterlist.c | 1 + 7 files changed, 14 insertions(+), 2 deletions(-) diff --git a/include/linux/bio.h b/include/linux/bio.h index 875d792bffff..e2f24d7235d3 100644 --- a/include/linux/bio.h +++ b/include/linux/bio.h @@ -5,7 +5,9 @@ #ifndef __LINUX_BIO_H #define __LINUX_BIO_H +#include // for struct kiocb, IOCB_NOWAIT #include +#include /* struct bio, bio_vec and BIO_* flags are defined in blk_types.h */ #include #include diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h index 4a658de44ee9..37d5591039c7 100644 --- a/include/linux/dma-mapping.h +++ b/include/linux/dma-mapping.h @@ -11,6 +11,7 @@ #include #include #include +#include /** * List of possible attributes associated with a DMA mapping. The semantics diff --git a/include/linux/highmem-internal.h b/include/linux/highmem-internal.h index a3028e400a9c..a479e6b7c54c 100644 --- a/include/linux/highmem-internal.h +++ b/include/linux/highmem-internal.h @@ -2,6 +2,8 @@ #ifndef _LINUX_HIGHMEM_INTERNAL_H #define _LINUX_HIGHMEM_INTERNAL_H +#include + /* * Outside of CONFIG_HIGHMEM to support X86 32bit iomap_atomic() cruft. */ diff --git a/include/linux/highmem.h b/include/linux/highmem.h index 00341b56d291..10a165a913ad 100644 --- a/include/linux/highmem.h +++ b/include/linux/highmem.h @@ -7,7 +7,9 @@ #include #include #include -#include +#include // for page_size() +#include // for folio_put() +#include #include #include diff --git a/include/linux/scatterlist.h b/include/linux/scatterlist.h index 0516e64dc03e..9221bba82b23 100644 --- a/include/linux/scatterlist.h +++ b/include/linux/scatterlist.h @@ -5,7 +5,7 @@ #include #include #include -#include +#include #include #ifdef CONFIG_UML diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index d577e0bee18d..ac121262bedb 100644 --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h @@ -16,6 +16,10 @@ #include #include #include +#include // for alloc_pages_node() +#include // for get_page(), put_page() +#include // for page_to_nid() +#include // for page_is_pfmemalloc() #include #include #include diff --git a/lib/scatterlist.c b/lib/scatterlist.c index 68b45c82c37a..03599396f15d 100644 --- a/lib/scatterlist.c +++ b/lib/scatterlist.c @@ -9,6 +9,7 @@ #include #include #include +#include #include #include