From patchwork Thu Feb 15 14:55:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Max Kellermann X-Patchwork-Id: 13558581 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 60B02C4829E for ; Thu, 15 Feb 2024 14:56:16 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 66C018D0021; Thu, 15 Feb 2024 09:56:15 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 559A08D001F; Thu, 15 Feb 2024 09:56:15 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 384B68D0021; Thu, 15 Feb 2024 09:56:15 -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 1BDD18D001F for ; Thu, 15 Feb 2024 09:56:15 -0500 (EST) Received: from smtpin12.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 2D020A2900 for ; Thu, 15 Feb 2024 14:56:14 +0000 (UTC) X-FDA: 81794338668.12.8130DA6 Received: from mail-ed1-f44.google.com (mail-ed1-f44.google.com [209.85.208.44]) by imf20.hostedemail.com (Postfix) with ESMTP id 0D6811C0013 for ; Thu, 15 Feb 2024 14:56:11 +0000 (UTC) Authentication-Results: imf20.hostedemail.com; dkim=pass header.d=ionos.com header.s=google header.b=VW8+TWZm; spf=pass (imf20.hostedemail.com: domain of max.kellermann@ionos.com designates 209.85.208.44 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=1708008972; 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=0oDI3MVOC+gdByL2sDhjkqrwTXc1Ta5YNXoQZrfiEOU=; b=virhF/L6phyY04R8Gw/SvicZhwU81TuzGP40ckhGE5zqaEQPMFJTJ2gpHL67GdcZOwc3tP 24iOxZlKQBG5YkMwjkWE09ZkcV+kPcLfY1B4mzo+XuDkLnNA/Daqvhdim2ceN5fZ4TC1XF GBwKlZMWzVu4Y2oHHltd0FqmEho0mbw= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1708008972; a=rsa-sha256; cv=none; b=7MNuHLj8/rKC4y3J9nB3wdiJ2b8k8iqoen9Wwp7YpM/N9dJcfyfx/gCq7HRl8sakTk/pN6 zoJjY99aR5x7m0RKaCUzceBG9e8c1YRRW6nRgQNMqXNj0dTHiAVhKDy0rcif0LXDRrek2q jRGjYpVfprbqsu3tiJmTsn5s5fORPeQ= ARC-Authentication-Results: i=1; imf20.hostedemail.com; dkim=pass header.d=ionos.com header.s=google header.b=VW8+TWZm; spf=pass (imf20.hostedemail.com: domain of max.kellermann@ionos.com designates 209.85.208.44 as permitted sender) smtp.mailfrom=max.kellermann@ionos.com; dmarc=pass (policy=quarantine) header.from=ionos.com Received: by mail-ed1-f44.google.com with SMTP id 4fb4d7f45d1cf-563b7b48b9aso670846a12.2 for ; Thu, 15 Feb 2024 06:56:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ionos.com; s=google; t=1708008971; x=1708613771; 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=0oDI3MVOC+gdByL2sDhjkqrwTXc1Ta5YNXoQZrfiEOU=; b=VW8+TWZmZXlufO7npcIkQsl0QCg9sOIxkOFMxUZ8F+AVOUvWG4macnVZdHJjTeRETa VLQr7jZU1SjGVfgiuJmCbsZKKorS5WndPC1yR9xZzisfoWAh4dVQRuxrPIeppv/Id5Ho CtiQaJBXND6ZYsSxSKrs1AD1ik9tkHaaeoxphqgGBMnL4VG7pOlCcEEUswleyaIPz5Lj cqxAJawOLz2/RYtDYTpU4nwmWQuQknIqFd8S8llcYvS9hWFGK0GSofwRctQAuRoNfSPb vBlKcRcmks99gd5w5mPxGpFiV+TUrmD/DmafbSlpSA3KlFtmlL5k/9qK0T9SD4XlgC8x BxoA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708008971; x=1708613771; 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=0oDI3MVOC+gdByL2sDhjkqrwTXc1Ta5YNXoQZrfiEOU=; b=HJWZPI58qS8/5rQXr7D57zn5aojdItvIQOE35MC2pjJDWFZpbqg7LueR2I+pdg7U2j mWUDmKGDP4ZQpJ5vWOsL4u9jqn/0ham+252jveYqrA0LfZv2tDoYtDpE5LYppAFE8SXN wAJsCG8A5Y33SohWVp4W11gxDBjhKgMnoi4F5uvOdzWWukcXIObmTZPKM/HE3n9yk1uE /THNmNql5stTp78vkAKOG6f1p7UqNvPklc0hIa09P3JP9+CID9gThqaE2irh1U52xaMe oIpFLKj9EkLiYJ2nrygIcbqILW/pKFv8+MRPHdst08mvath3inkwdFAWUKAlPK7FNYZI kEPg== X-Forwarded-Encrypted: i=1; AJvYcCV1vixSWwx6dc2whEGdEUfdFTmICCzYWmXoP9wDoYGFi8avZfD49v4jbo5HgsdfjgC83uZk6jPo4y5Y/zGxDd17g00= X-Gm-Message-State: AOJu0YxDNDVzBETpSeAvIKlhcqj5Sx+lxTaZG1uOfWfp9KXYJg3aOd+D wFDtXz0238dDByQsRqW7I4R1/2BIgER82pFCu6LYj25FQJJE9pPG8HMDvCTXqec= X-Google-Smtp-Source: AGHT+IEitTAWYbveUJr+PF64RWYCpKlCDLm/0Qp98VmYAYYJ+ah4ani7ivdRMaHpceHgriKsshu2vg== X-Received: by 2002:a17:906:f343:b0:a3d:643f:1cd4 with SMTP id hg3-20020a170906f34300b00a3d643f1cd4mr1443557ejb.48.1708008970666; Thu, 15 Feb 2024 06:56:10 -0800 (PST) Received: from raven.intern.cm-ag (p200300dc6f267100023064fffe740809.dip0.t-ipconnect.de. [2003:dc:6f26:7100:230:64ff:fe74:809]) by smtp.gmail.com with ESMTPSA id s18-20020a170906169200b00a3d1897ab68sm631175ejd.113.2024.02.15.06.56.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Feb 2024 06:56:10 -0800 (PST) From: Max Kellermann To: akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: Max Kellermann Subject: [PATCH v1 01/14] drivers: add missing includes on linux/mm.h (and others) Date: Thu, 15 Feb 2024 15:55:49 +0100 Message-Id: <20240215145602.1371274-2-max.kellermann@ionos.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240215145602.1371274-1-max.kellermann@ionos.com> References: <20240215145602.1371274-1-max.kellermann@ionos.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: 0D6811C0013 X-Rspam-User: X-Rspamd-Server: rspam11 X-Stat-Signature: g8k3effpwjyyn97gt4f6oiwrtagtdw3n X-HE-Tag: 1708008971-58698 X-HE-Meta: U2FsdGVkX18ELnNLIXASnYBVnjSKUtppI8JTFJBZXfT9AaL+ZZIcO3u4CWILQ6iBeda7AIQ0kmLfggIqxsVJXeyUV109TLJBJ4en0fAipZBRF9sOmbGF7vZ1BxMqUIKyg25uCiSTJeVHR+1T9mVftnQUmn2r2Az5EeIz8/VH4TMtd3qjF/0J5y6jbGKe2+IqknkyO6kggYFLlWYy/JnwMtNF5Ll0Y+e6rIlE55E/nt0If98uMHnYtqti+MWjQidMM1ALbZLH6bPlqgCmbGwK344r0kZ5b8mQKC19kjsQhhyaj+dEIH5ytx3vHDDLJfNVxzKnHhSn0j+VP1bhmqzUmf+39R6iFYPqpbqS3f+q/DDi5zfJkzq8DCdIy6zgER2kA8jBQtN07b2ope4QqPQuqLaOEyiKE+DGVKCrQRcWEyettIck2lCeiv7L4G/Midgi7lR8YZWZv8HR82OR0oow+WeT0BPZmKPxYY3vilKjAvkPQoSEy4/oNXDQjSR9qYHkdPY52YjMOLndZlW96nM75Pw/YVI1HAlmtYzTVpzc+1F2/yjx0FzNMqPtWH0vsnHSK/D/amwY4TChkS1hHEGW65MoSIdjpVgF1UDxnGKolOQiWctfQhGxCn6ZulKbWMczpiyF0Um40X8jFi3Z7um7s+S5DUHI5OooDMpcFIp+mrRWbHWe5/DNnTK0koq5QplD6nR7Cx9ucZIID52yR1QvdkqGJ3JSEoTXHq7JwlSn2Yv0mwBNAoNbSaaSuGfRYHN4HJBlL6c5PSnWDqwlho+7gYQqyORU8vsD8D7AWbbtsizc9sWQn8H5XPVLGP2Wp+U3Npct6pG5OqITyoPda1kkfFXHTHDAfTdIXbWpcdoI1cp7GxMMfcxqgf2SdTU0wNoSwvrCS9gbUauNV+4FSCv0VLJFLt6mqJfysS3UnYKdnYzlQzacsEXkFedT2MU4Ehq9PUm8EsbhWkBEMiAlnVL 1UnqxisG VKAfzu8hOy9eSS9dMzEfglk//PThrR306n13oT2UHsTJTyn6H/SUU9Sb0i1fdcKmqS16bDYNFsVpY612Tdpoeo6PM96KGQjYcgQNHcESdXiiW+FLkgnX89yJjsn5Pt3YDY3FzebRWvs7uP3NEdiJsPdqtiZ6aC6N1RluU7/+PGdSXFP4rUAJDr9f26/A1mVnnI1aRgUGFLuVLbD1wuHD6UI6qsywZf4jNX/wKTyBiEjU5o+uFsQXGfyCWC4h4NGeSw2UucuOQd1saMjQZbDz6MI3/dr4Eue/Jnw5Y 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/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/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/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-bcm2835.c | 2 ++ drivers/spi/spi-intel.c | 1 + drivers/virtio/virtio_ring.c | 1 + include/linux/iommu.h | 1 + include/linux/nvme-keyring.h | 2 ++ kernel/dma/ops_helpers.c | 1 + kernel/dma/remap.c | 1 + mm/dmapool.c | 1 + 27 files changed, 31 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/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/selftest.c b/drivers/iommu/iommufd/selftest.c index 8abf9747773e..710789a2add9 100644 --- a/drivers/iommu/iommufd/selftest.c +++ b/drivers/iommu/iommufd/selftest.c @@ -5,6 +5,7 @@ */ #include #include +#include // for GUP_PIN_COUNTING_BIAS #include #include #include diff --git a/drivers/media/platform/mediatek/vpu/mtk_vpu.c b/drivers/media/platform/mediatek/vpu/mtk_vpu.c index 7243604a82a5..885b873982e4 100644 --- a/drivers/media/platform/mediatek/vpu/mtk_vpu.c +++ b/drivers/media/platform/mediatek/vpu/mtk_vpu.c @@ -8,6 +8,7 @@ #include #include #include +#include // for totalram_pages() #include #include #include diff --git a/drivers/media/platform/ti/omap/omap_voutlib.c b/drivers/media/platform/ti/omap/omap_voutlib.c index 0ac46458e41c..3b653b49cc48 100644 --- a/drivers/media/platform/ti/omap/omap_voutlib.c +++ b/drivers/media/platform/ti/omap/omap_voutlib.c @@ -18,6 +18,7 @@ * */ +#include // for PAGE_ALIGN() #include #include #include diff --git a/drivers/misc/bcm-vk/bcm_vk_dev.c b/drivers/misc/bcm-vk/bcm_vk_dev.c index d4a96137728d..c5a39a8189bf 100644 --- a/drivers/misc/bcm-vk/bcm_vk_dev.c +++ b/drivers/misc/bcm-vk/bcm_vk_dev.c @@ -11,6 +11,7 @@ #include #include #include +#include // for io_remap_pfn_range() #include #include #include diff --git a/drivers/misc/fastrpc.c b/drivers/misc/fastrpc.c index 03319a1fa97f..43448a97e502 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/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-bcm2835.c b/drivers/spi/spi-bcm2835.c index e1b9b1235787..d8ed5575a9c6 100644 --- a/drivers/spi/spi-bcm2835.c +++ b/drivers/spi/spi-bcm2835.c @@ -33,6 +33,8 @@ #include #include +#include // for ZERO_PAGE() + /* SPI register offsets */ #define BCM2835_SPI_CS 0x00 #define BCM2835_SPI_FIFO 0x04 diff --git a/drivers/spi/spi-intel.c b/drivers/spi/spi-intel.c index 3e5dcf2b3c8a..cf8e4f1c4d93 100644 --- a/drivers/spi/spi-intel.c +++ b/drivers/spi/spi-intel.c @@ -8,6 +8,7 @@ #include #include +#include // for SZ_* #include #include diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c index 49299b1f9ec7..5c3ca44aef42 100644 --- a/drivers/virtio/virtio_ring.c +++ b/drivers/virtio/virtio_ring.c @@ -12,6 +12,7 @@ #include #include #include +#include // for PAGE_ALIGN() #include #include diff --git a/include/linux/iommu.h b/include/linux/iommu.h index 8141a37556d5..25a3613a1f66 100644 --- a/include/linux/iommu.h +++ b/include/linux/iommu.h @@ -14,6 +14,7 @@ #include #include #include +#include // for copy_struct_from_user() #include #define IOMMU_READ (1 << 0) 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/kernel/dma/ops_helpers.c b/kernel/dma/ops_helpers.c index af4a6ef48ce0..641363b13bb9 100644 --- a/kernel/dma/ops_helpers.c +++ b/kernel/dma/ops_helpers.c @@ -4,6 +4,7 @@ * the allocated memory contains normal pages in the direct kernel mapping. */ #include +#include // for PAGE_ALIGN() static struct page *dma_common_vaddr_to_page(void *cpu_addr) { diff --git a/kernel/dma/remap.c b/kernel/dma/remap.c index 27596f3b4aef..87b3c874d370 100644 --- a/kernel/dma/remap.c +++ b/kernel/dma/remap.c @@ -3,6 +3,7 @@ * Copyright (c) 2014 The Linux Foundation */ #include +#include // for vmap(), PAGE_ALIGN() #include #include diff --git a/mm/dmapool.c b/mm/dmapool.c index f0bfc6c490f4..b8e23fdc81d7 100644 --- a/mm/dmapool.c +++ b/mm/dmapool.c @@ -25,6 +25,7 @@ #include #include #include +#include // for want_init_on_alloc() #include #include #include From patchwork Thu Feb 15 14:55:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Max Kellermann X-Patchwork-Id: 13558582 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 1D76EC48BC4 for ; Thu, 15 Feb 2024 14:56:19 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id CFE6F8D001F; Thu, 15 Feb 2024 09:56:15 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id C0E138D0022; Thu, 15 Feb 2024 09:56:15 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9ED048D001F; Thu, 15 Feb 2024 09:56:15 -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 688278D0022 for ; Thu, 15 Feb 2024 09:56:15 -0500 (EST) Received: from smtpin05.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 44C02A04B3 for ; Thu, 15 Feb 2024 14:56:15 +0000 (UTC) X-FDA: 81794338710.05.DD64A9E Received: from mail-ed1-f51.google.com (mail-ed1-f51.google.com [209.85.208.51]) by imf18.hostedemail.com (Postfix) with ESMTP id 853951C001C for ; Thu, 15 Feb 2024 14:56:13 +0000 (UTC) Authentication-Results: imf18.hostedemail.com; dkim=pass header.d=ionos.com header.s=google header.b=NOwKUTpu; dmarc=pass (policy=quarantine) header.from=ionos.com; spf=pass (imf18.hostedemail.com: domain of max.kellermann@ionos.com designates 209.85.208.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=1708008973; 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=o1iBYcy0qTXtxPXRfS4KUEd2ESr8alUAFUT2n+uSACXHnRiVuv0z55sV+zHcMzimwkD0zx KDRCr/lncCHLxc+qeHGhUoA0A4Sy0FItMLgENJgBRTkgY2ga3enge+CgjpFPdyRDQMVRds W9NRPk4eOEmIQbyfBVMiUbYAtuTEpY4= ARC-Authentication-Results: i=1; imf18.hostedemail.com; dkim=pass header.d=ionos.com header.s=google header.b=NOwKUTpu; dmarc=pass (policy=quarantine) header.from=ionos.com; spf=pass (imf18.hostedemail.com: domain of max.kellermann@ionos.com designates 209.85.208.51 as permitted sender) smtp.mailfrom=max.kellermann@ionos.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1708008973; a=rsa-sha256; cv=none; b=jRoO8UXKoDK+llBF7qWF7/8Q7YMtsCdJqVSnTwmMKAMiEYsG//DENxanjbofVyUK+kT9fV rxR5h8146JxdoiesN+caIG1bJEMC0Lmv4R8SBp3chsIwXra4dYPTqEjthb44n0tqUIp4rP DPxz87PQGuo4wF8wSi6FHqrqgx+JSwY= Received: by mail-ed1-f51.google.com with SMTP id 4fb4d7f45d1cf-563a6656c46so1408517a12.1 for ; Thu, 15 Feb 2024 06:56:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ionos.com; s=google; t=1708008972; x=1708613772; 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=NOwKUTpuFofeIqizouhWbCzM//81SWQGcW1blx4qqRim5o7xF+loK1hr04dpNgs3qh oM5F79PUuSJY8MoyRAukXIJr3jqdIaachYkFLleOVoIk4iMVdO7vJMxSELHE/c6gHEkl ZZ1qwBJ+drLRl/Xzjqa0Hj94ZmVFgSyMhT7E9p2ZnhoQKXnUPKzxb30X7g4VKOm7F1fB obXa2tyovm2sH8Zg9taBs9EoQ3Dddt55aXGpNUsmux/wrbwrH8yEz0yBVATbVBqzHNBs UUA9gVLEa1fuQUa0E7tou0tBHdt/xQTKmlX103NFLc0x0C15iUfSBQ0mzqJRWrnYjZIr 3LcQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708008972; x=1708613772; 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=S3GaZxp2fpvpFJVzeq4/z9VtRuyeXasMV99uKqwEPuTJ5bhNyb4Kwy9r8KvRrIT837 Kfw2En81/Nk9ljy1ZguunDbyIR90nne1mVK4wx0tZDSPs24k/5Nw1g32qRCl0DAbBXwe zTmNz8w1wGFi6qu3BDh3+t4U9ZHzTYW6nb2aVYLPugTRNoGBmSAbRdS4gNeOV1voIst5 SZGqBHMwEjyJ9lquN2cYVw+5ri1D0fwbxESe5DFCyOgNU1IncKFqumqX08WrPGGKaNTG FYuUyf5v5ZVHS1y1Ce0922LrVKKFis4IjliU5bJEJw2VTeYrzVwO5I4jvTw3CjAGPyVc 7NkA== X-Forwarded-Encrypted: i=1; AJvYcCV0i3p03IXH4q62cRfNj6/hXNSo4Hpd4uRBGhE9gprMvVa4d/4pMJ3sPSDmiF/XBQ0fV0aL+I7ONG6gGEE4GK62JAI= X-Gm-Message-State: AOJu0YywsTaW1MYnmGz5Py3NrQ7DKJ9JT3wnacnczViOKhKwxW19Z9D7 K+cR5/97b/w2rVVInAIBHb9PGHr+O8cDkSvwv6qbshMt9xsi7bSB1euU4NhTxxqGHflut6IixZo 7 X-Google-Smtp-Source: AGHT+IFKfxSMdDU58egMnr1nDOgEiMLO3WKEhWBKIvifvsssID7+Frq6c2q9Yzb4eyPMkscD2JQmYw== X-Received: by 2002:a17:906:4157:b0:a3d:7ca3:fbab with SMTP id l23-20020a170906415700b00a3d7ca3fbabmr1539833ejk.27.1708008972211; Thu, 15 Feb 2024 06:56:12 -0800 (PST) Received: from raven.intern.cm-ag (p200300dc6f267100023064fffe740809.dip0.t-ipconnect.de. [2003:dc:6f26:7100:230:64ff:fe74:809]) by smtp.gmail.com with ESMTPSA id s18-20020a170906169200b00a3d1897ab68sm631175ejd.113.2024.02.15.06.56.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Feb 2024 06:56:11 -0800 (PST) From: Max Kellermann To: akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: Max Kellermann Subject: [PATCH v1 02/14] include/drm/drm_gem.h: add poll_table_struct forward declaration Date: Thu, 15 Feb 2024 15:55:50 +0100 Message-Id: <20240215145602.1371274-3-max.kellermann@ionos.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240215145602.1371274-1-max.kellermann@ionos.com> References: <20240215145602.1371274-1-max.kellermann@ionos.com> MIME-Version: 1.0 X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: 853951C001C X-Stat-Signature: k6m7addobo9a8cc3cbw1ief6smmnesws X-Rspam-User: X-HE-Tag: 1708008973-379173 X-HE-Meta: U2FsdGVkX19Jk9SiqZ1DjA6etMfqr7tqdLme0bnWzs57K/Dg4Jm+67mnx6wH2P5LdvOoAeWScNQJubTTPNI/VoxsU+poBk2HxK8RqzD3awMFxmVZA680lGxFiepliMv+yIQGIixZa1aN/I0nDfyK+Kdm3ru77f5v61f5JarP7lMnjU798WjqY/umDcExDqtM3+FZPBhqo40Ph0bwJLND7UPJfgl6pjzRLkF1Zg6Ef45QxR8RGITPn8B4l4bQhkT0MThzbYah6TheHTR4YLtsbyqjwfI7A+t5+jxuGwZg+FYO53PDGogGorhlByeHic1nnluXd0sEdUwD24oGpuEuIL6+M9hVGDBiNFGP4N1sriUngQje6S0/LqsEOPzFvJOG+cQFMjvVeog5/7vjH/lHy/+jW+so4nNJsNWbepsAGBsI3XfdvxXwVsVx84ebekDlPIbL9/GaHYBatLHj895TscLD4inmwpS9hAdmFpcAagNNkowFNcldqRYAy6dLjOeC+P2G9BFAvuj3REwBcMWpHHb9Fp2pFSTwbY1OQflC24NbLUtzg9FnbESf3l1ymS689kRox7uDcusFXdguQIeibqv/x4tPPvAKPaRxeX8M8s7h9oZvaA1o/yXudV57Ia56DjcxOuMrnNoapKHNzPe0tbLlM/33OMLmWlt5xmfQu+BjGWYtnBko2GVdPJ3YJhe9OWx3wY4BuDDGPYv+6tfQ6mv8tmmsERn6InAZgVoEVkyj0qcsm2BEWwTD014Cjru7rV/nuREWI9wjslxD/1NvF3RyPzHX6wULFoHhnQR4JGn4X5A4huTswtkqFk50QIb2NnZ+KVvyi7JKRtziSaJMADxwIIc14i6r+uHbkQccF9l/gOl9PVCNdHdBm+PF0X6015oEqwy6gncDoMMjXMwQ400iPkguW7w2QCISlUPVHJtKqt9biLB0NRq2PvGYm1KDW2UNcnXhdWjCs/3We3I KDpFLyog RAfeCubiC3faUdRnntaeXdd8cOsgLfLys4WX8nqdMbksg0qRap9b86eZNPVIludlW4JTqiO/NHM2aXHYzYlBceP5rjt4ruevZ2VtLX5nZXTRMrZjtWnBx6NRwzg== X-Bogosity: Ham, tests=bogofilter, spamicity=0.028649, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: After eliminating includes of linux/mm.h, the following build failure occurred: ./include/drm/drm_file.h:443:45: warning: ‘struct poll_table_struct’ declared inside parameter list will not be visible outside of this definition or declaration 443 | __poll_t drm_poll(struct file *filp, struct poll_table_struct *wait); | ^~~~~~~~~~~~~~~~~ In file included from drivers/gpu/drm/imagination/pvr_gem.h:12, from drivers/gpu/drm/imagination/pvr_fw.h:9: ./include/drm/drm_gem.h:447:27: error: initialization of ‘__poll_t (*)(struct file *, struct poll_table_struct *)’ {aka ‘unsigned int (*)(struct file *, struct poll_table_struct *)’} from incompatible pointer type ‘__poll_t (*)(struct file *, struct poll_table_struct *)’ {aka ‘unsigned int (*)(struct file *, struct poll_table_struct *)’} [-Werror=incompatible-pointer-types] 447 | .poll = drm_poll,\ | ^~~~~~~~ The compiler is confused, and that can be fixed easily by forward-declaring the struct expicitly. Signed-off-by: Max Kellermann --- include/drm/drm_file.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/drm/drm_file.h b/include/drm/drm_file.h index ab230d3af138..f24ade9f766f 100644 --- a/include/drm/drm_file.h +++ b/include/drm/drm_file.h @@ -44,6 +44,7 @@ struct drm_device; struct drm_printer; struct device; struct file; +struct poll_table_struct; /* * FIXME: Not sure we want to have drm_minor here in the end, but to avoid From patchwork Thu Feb 15 14:55:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Max Kellermann X-Patchwork-Id: 13558583 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 C95FEC48BEB for ; Thu, 15 Feb 2024 14:56:21 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 5A6A58D0023; Thu, 15 Feb 2024 09:56:18 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 531258D0022; Thu, 15 Feb 2024 09:56:18 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 383E38D0023; Thu, 15 Feb 2024 09:56:18 -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 227DA8D0022 for ; Thu, 15 Feb 2024 09:56:18 -0500 (EST) Received: from smtpin06.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id F0568809AF for ; Thu, 15 Feb 2024 14:56:17 +0000 (UTC) X-FDA: 81794338794.06.B0068F8 Received: from mail-ej1-f51.google.com (mail-ej1-f51.google.com [209.85.218.51]) by imf10.hostedemail.com (Postfix) with ESMTP id 42DAFC0025 for ; Thu, 15 Feb 2024 14:56:15 +0000 (UTC) Authentication-Results: imf10.hostedemail.com; dkim=pass header.d=ionos.com header.s=google header.b="aUi+AY/C"; dmarc=pass (policy=quarantine) header.from=ionos.com; spf=pass (imf10.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=1708008976; a=rsa-sha256; cv=none; b=PwwepgeFvdNYvHV6TsYhDDSH8dYJwbp3w6E+3KEgvt4V+yJg/swuDNUtUZGPT4QswWlQ6I UlAKUEeLtKSGnw7GEk/umvMaJl8WuaMHkmNnmE6jRPfvtZwv7+T+HuCF+Zfxv2uPtTHoXP JlhatwizGeuhD5tZbQYJOTE+3SHcKTM= ARC-Authentication-Results: i=1; imf10.hostedemail.com; dkim=pass header.d=ionos.com header.s=google header.b="aUi+AY/C"; dmarc=pass (policy=quarantine) header.from=ionos.com; spf=pass (imf10.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=1708008976; 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=5yWhRxx5j9/Xhrml0aMKDxvuRZarY+DeLwc3tl7RleQ=; b=OyIOfJSwZ9jo2FOKD7vvOUbgCx1IOBs6TbstTGpqfXl5Yhk8y/01diRca90LshjNI3eAfu XWAqDUIIFsqe5Wu4jw3tF0UGyH8go1AFTQrzfAepckCNM/0bgBPmI3RxYe1eT4D0Be1shx QE8PMga77nl6xtHIBblPvdaaFaW6TcI= Received: by mail-ej1-f51.google.com with SMTP id a640c23a62f3a-a3c1a6c10bbso116264366b.3 for ; Thu, 15 Feb 2024 06:56:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ionos.com; s=google; t=1708008975; x=1708613775; 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=5yWhRxx5j9/Xhrml0aMKDxvuRZarY+DeLwc3tl7RleQ=; b=aUi+AY/CpmO85rjvtA/Zak2Pi2PMkv7kn0TJ4DPQwEXrY7Nn1xlzxk28+eItpUZM6v qCrBFFGir+qP/klqomWFCqNLSK+SWBCoTHLYKaAow+wRuIxjr71Za2J0tqbMMhKl2JnM Li92DjPGFEHkFCYFsV8+qy9Jq0tOEaff6qerZWKgCDNBic2+k9uwyEgZf+kMHJ5ltB2M VLcxWmOJzO7OjqJ4YT/EIbEleh82TUoMYOG4ybrEHs9CaSRPdwMoEuBDzSEMoRegU4zf 3wrKywHTPf8+ucOsJl7rSadMG+7VZA0/icJSIHxo//tW1R3SnUgsLlyNDwR8nPr3L44c NXgg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708008975; x=1708613775; 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=5yWhRxx5j9/Xhrml0aMKDxvuRZarY+DeLwc3tl7RleQ=; b=Pe+kHk4rMuRYpfvHSeukU8Wvvt1+i8WcU1nXduZpEFy2CIugfR5+j2b8dLSt5nJsz+ /+hGFEsjxsmBPCfTqGtzCZx7ipOB0ZmwYeS3wFPKr8hL8dR9xsBrn4V/DlSrwfiw7NAF nX/Gk6fqT9zEtadwXwwUMvCJ3COrbl4MsBVSen9mJh0uSdYXLxs3UUPOetjZuiq0W3Ge tv2vwNgRcYrVffGSnJfOpH78wYNg4bTru1otOTCffiYxv+GN+MtiHWDYo4LpdK16RxYT k02ADClg8GlklIHLqubuAd8kddhp6FbAsTv+/DEDA1O6+divRPXV3T+P+ZfUZAWUvDMR KdEA== X-Forwarded-Encrypted: i=1; AJvYcCX+qkfBMbWYItfy/vtx/Antsj/u+lDJ/Yjr+COHuVSd1JUUZbrzaLTePV1wT0B43ZME3KaiKOtCnspo/4NuRRH8d5E= X-Gm-Message-State: AOJu0Yz79dju0+BUl37WK9TZt4fE8W3DScgNyzhweOlYtw/bCpDsB3AI 731h3qtG8mllPHPO0c49oJqG85eNcNhUWhlat/yddoRD9BqMyatEFWYnWbvooI76VjfmzNo1uls r X-Google-Smtp-Source: AGHT+IEh5MY1NSY3moqMbuwNAu7FXKM3QrZkqq8fUn4fINWuAnXtgbc+LSmCPQJW7QL2YVRWsHbq+Q== X-Received: by 2002:a17:906:1186:b0:a39:6c07:d31c with SMTP id n6-20020a170906118600b00a396c07d31cmr1552619eja.25.1708008972867; Thu, 15 Feb 2024 06:56:12 -0800 (PST) Received: from raven.intern.cm-ag (p200300dc6f267100023064fffe740809.dip0.t-ipconnect.de. [2003:dc:6f26:7100:230:64ff:fe74:809]) by smtp.gmail.com with ESMTPSA id s18-20020a170906169200b00a3d1897ab68sm631175ejd.113.2024.02.15.06.56.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Feb 2024 06:56:12 -0800 (PST) From: Max Kellermann To: akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: Max Kellermann Subject: [PATCH v1 03/14] linux/mm.h: move page_kasan_tag() to mm/page_kasan_tag.h Date: Thu, 15 Feb 2024 15:55:51 +0100 Message-Id: <20240215145602.1371274-4-max.kellermann@ionos.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240215145602.1371274-1-max.kellermann@ionos.com> References: <20240215145602.1371274-1-max.kellermann@ionos.com> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: 42DAFC0025 X-Stat-Signature: qqbssp61wwyx8u1dbfoycqmgxh9o5xxz X-HE-Tag: 1708008975-53361 X-HE-Meta: U2FsdGVkX19n/nVNqZPiORQpaLOYlT9ZlN6tfthwGL/bLT22kaBj/nO+smziZHabeKgoVD9tl1FJRp5kTNH0ypwN1c5bBHJndhNIsjCI0dhyQWEzT21I1EKxKWD1RMdcynzvbww5DzoB5zJ6NpZ72ETc2k54byMzmkIBUhoJgF3goeSIfEedymglSfhb5WgTCyzfWk/MJAu+kuNPc8xqLsoWV1nBJncmQVctgyXJcbzbCoZHj8YzTy2LLy1xKe1fPXJZVBOJvgs17qz4iAl441hNsQ2NvIko7XCQRgMvQqcWTHlc7AYtzUZtXgb7l4NZyHpK1tQfT+Gr7tv5mJCb/G5n1ruV/pyjyj8eWVQwV9O0YmfvTf3ceEog+Iki0d+Mr0HLsQKKz5y8YLzGg2QctyIc4yO1mYeMK+uUiecPlNnQ07BQON6qHC2R/yoSXnCziQvSnUXaqWfdPDphGXE7gKP91rT3XetjUizZNqPtTNBIS53bxS9Gn4Yj34keOw2xo069jnkXZBg95YnP0QpSIpQtV7V+ijGn6gfZqGUakc3u6SqvLah30C/QNHL+vAXObDjvzvBvDYgKfaKLb+bJgy4Z4iRVCgvPQp+YOU9lh4dl2m/x8yBbFr+44glnwHtyF5QpnWKmBbM+XR61rlsj7d6/2h5Xxuij5lB+pCjdlWxer2BLi0m24WLy9l8EI+uwWiF0DaJWkm1Poyfw91G+KvscGxFdB2Qjn2wcwY9c7Eir40CuhOgM3hSkyz2AiZpilDfa2QsRkvtFOFe012G68ESLhabE0YAn+BL8mc9y9X6OLHdT1pH5DBnSJVdCqSSSJVgLuUE8RUxvA/awChK0Gm1Bt5yvZLGt6x/ApUiRAScf7pXFEHeb9HidzJuZK05JYXru/IoIoKLt/e/8EuXjY7Cr1ANSb8W0yW7lUvkNOZElChSsH9CyjEH6BsX9isTkiKqjRcCpptYUkQApHCp XErm9dnt tzXKUASw49YzuBouutknHA8CcgM0vg5SYXs6ZDXSSM6L7d6d8eI8R3eZ/vpn5oBREild+CAw4g76Bs3+Q8dJshswskCLGkz/OIfwRYGAFqCjTvvhfpSlBhn/NyOGnc4DRj2crPlukpiLSKW1a5DMP5HwM0s4MAW8v33J1 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 in linux/mm.h. 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 897fbf1b0701..4fba8597b2c1 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -14227,6 +14227,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 6095c86aa040..decc0cb8ed32 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 @@ -1805,60 +1805,6 @@ static inline void vma_set_access_pid_bit(struct vm_area_struct *vma) } #endif /* CONFIG_NUMA_BALANCING */ -#if defined(CONFIG_KASAN_SW_TAGS) || defined(CONFIG_KASAN_HW_TAGS) - -/* - * KASAN per-page tags are stored xor'ed with 0xff. This allows to avoid - * setting tags for all pages to native kernel tag value 0xff, as the default - * value 0x00 maps to 0xff. - */ - -static inline u8 page_kasan_tag(const struct page *page) -{ - u8 tag = KASAN_TAG_KERNEL; - - if (kasan_enabled()) { - tag = (page->flags >> KASAN_TAG_PGSHIFT) & KASAN_TAG_MASK; - tag ^= 0xff; - } - - return tag; -} - -static inline void page_kasan_tag_set(struct page *page, u8 tag) -{ - unsigned long old_flags, flags; - - if (!kasan_enabled()) - return; - - tag ^= 0xff; - old_flags = READ_ONCE(page->flags); - do { - flags = old_flags; - flags &= ~(KASAN_TAG_MASK << KASAN_TAG_PGSHIFT); - flags |= (tag & KASAN_TAG_MASK) << KASAN_TAG_PGSHIFT; - } while (unlikely(!try_cmpxchg(&page->flags, &old_flags, flags))); -} - -static inline void page_kasan_tag_reset(struct page *page) -{ - if (kasan_enabled()) - page_kasan_tag_set(page, KASAN_TAG_KERNEL); -} - -#else /* CONFIG_KASAN_SW_TAGS || CONFIG_KASAN_HW_TAGS */ - -static inline u8 page_kasan_tag(const struct page *page) -{ - return 0xff; -} - -static inline void page_kasan_tag_set(struct page *page, u8 tag) { } -static inline void page_kasan_tag_reset(struct page *page) { } - -#endif /* CONFIG_KASAN_SW_TAGS || CONFIG_KASAN_HW_TAGS */ - static inline struct zone *page_zone(const struct page *page) { return &NODE_DATA(page_to_nid(page))->node_zones[page_zonenum(page)]; diff --git a/include/linux/mm/page_kasan_tag.h b/include/linux/mm/page_kasan_tag.h new file mode 100644 index 000000000000..1210c62170a3 --- /dev/null +++ b/include/linux/mm/page_kasan_tag.h @@ -0,0 +1,66 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef _LINUX_MM_PAGE_KASAN_TAG_H +#define _LINUX_MM_PAGE_KASAN_TAG_H + +#include + +struct page; + +#if defined(CONFIG_KASAN_SW_TAGS) || defined(CONFIG_KASAN_HW_TAGS) + +#include +#include // for struct page + +/* + * KASAN per-page tags are stored xor'ed with 0xff. This allows to avoid + * setting tags for all pages to native kernel tag value 0xff, as the default + * value 0x00 maps to 0xff. + */ + +static inline u8 page_kasan_tag(const struct page *page) +{ + u8 tag = KASAN_TAG_KERNEL; + + if (kasan_enabled()) { + tag = (page->flags >> KASAN_TAG_PGSHIFT) & KASAN_TAG_MASK; + tag ^= 0xff; + } + + return tag; +} + +static inline void page_kasan_tag_set(struct page *page, u8 tag) +{ + unsigned long old_flags, flags; + + if (!kasan_enabled()) + return; + + tag ^= 0xff; + old_flags = READ_ONCE(page->flags); + do { + flags = old_flags; + flags &= ~(KASAN_TAG_MASK << KASAN_TAG_PGSHIFT); + flags |= (tag & KASAN_TAG_MASK) << KASAN_TAG_PGSHIFT; + } while (unlikely(!try_cmpxchg(&page->flags, &old_flags, flags))); +} + +static inline void page_kasan_tag_reset(struct page *page) +{ + if (kasan_enabled()) + page_kasan_tag_set(page, KASAN_TAG_KERNEL); +} + +#else /* CONFIG_KASAN_SW_TAGS || CONFIG_KASAN_HW_TAGS */ + +static inline u8 page_kasan_tag(const struct page *page) +{ + return 0xff; +} + +static inline void page_kasan_tag_set(struct page *page, u8 tag) { } +static inline void page_kasan_tag_reset(struct page *page) { } + +#endif /* CONFIG_KASAN_SW_TAGS || CONFIG_KASAN_HW_TAGS */ + +#endif /* _LINUX_MM_PAGE_KASAN_TAG_H */ From patchwork Thu Feb 15 14:55:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Max Kellermann X-Patchwork-Id: 13558584 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 C0605C4829E for ; Thu, 15 Feb 2024 14:56:24 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 8428D8D0024; Thu, 15 Feb 2024 09:56:19 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 72E7C8D0022; Thu, 15 Feb 2024 09:56:19 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4E5228D0024; Thu, 15 Feb 2024 09:56:19 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 3683F8D0022 for ; Thu, 15 Feb 2024 09:56:19 -0500 (EST) Received: from smtpin23.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id EF6B01409D5 for ; Thu, 15 Feb 2024 14:56:18 +0000 (UTC) X-FDA: 81794338836.23.7AA48A3 Received: from mail-ej1-f49.google.com (mail-ej1-f49.google.com [209.85.218.49]) by imf05.hostedemail.com (Postfix) with ESMTP id D6407100003 for ; Thu, 15 Feb 2024 14:56:16 +0000 (UTC) Authentication-Results: imf05.hostedemail.com; dkim=pass header.d=ionos.com header.s=google header.b=LSs63XhU; spf=pass (imf05.hostedemail.com: domain of max.kellermann@ionos.com designates 209.85.218.49 as permitted sender) smtp.mailfrom=max.kellermann@ionos.com; dmarc=pass (policy=quarantine) header.from=ionos.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1708008976; 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=GOKW+J+Ft2qh+SDtx4ZJQpIK78L9+qr7BGcqORkx+gI=; b=A30amz9vb+D8MW9GOX0tR04z7qLzZxRuby1zb6djgLgl0gdhs6NdT255WZZMPPQhg/ZKzU 69ZO2yullzM4U92o216kXgJO3coyA+ML3aIx5V0h7E7OkB1Cqq20eu8VbVQQXnt/e0bDy6 FD6hA3/xpY8qG9U0IbjaABV8EA9iEGo= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1708008976; a=rsa-sha256; cv=none; b=B5mwVBHw7TK4Tv1k966Zh1dJ3F0B/oPJJzDTmqpiUr75XPzCLdw4K1F5pAtEMbeoncIVPB lhs38KOKdQ0wYYzW2V44WJnACZ9PflUICmCnuoxiDrxEA1k+vJFyI1jj9eRVCOWx7lGKPT TIOb1uACvpU1Xtgj5aeHFNm4vLDaR+c= ARC-Authentication-Results: i=1; imf05.hostedemail.com; dkim=pass header.d=ionos.com header.s=google header.b=LSs63XhU; spf=pass (imf05.hostedemail.com: domain of max.kellermann@ionos.com designates 209.85.218.49 as permitted sender) smtp.mailfrom=max.kellermann@ionos.com; dmarc=pass (policy=quarantine) header.from=ionos.com Received: by mail-ej1-f49.google.com with SMTP id a640c23a62f3a-a3d0d26182dso101242366b.1 for ; Thu, 15 Feb 2024 06:56:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ionos.com; s=google; t=1708008975; x=1708613775; 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=GOKW+J+Ft2qh+SDtx4ZJQpIK78L9+qr7BGcqORkx+gI=; b=LSs63XhUQ1Fr+minOX5deQxEv4f2zAFdhzvZdID9g50qh9CYUmAX6hW2koqUoE2HGf /XeAm6geVfQeYkBTJ2jkOEtvSkuxTPcBO1u6sx7PQS5S48yIPtqak45x6INrQbggiS5w ep4fyglroLYQa+tJsG+u1NujzXkzYUofzA+qFO8nsEgmZuFVEcwCOEAFNhOY7sCIxOJc 9UXxLrjOSLJNGcnJLj32mOWBy6JLpzKYWD+y+gvS22iju2zsZ+3HAlRMbfJ8htchPO8G 1cr+3ZHhcteOydWKODN8feQcwkRdbEvWDNAdD3D414/ny6cv89YTkNS/9NQXR6pNEmOp Zkvg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708008975; x=1708613775; 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=GOKW+J+Ft2qh+SDtx4ZJQpIK78L9+qr7BGcqORkx+gI=; b=D4oXqQqsK6eVJcryFKUh14do7CR+l1gQpqoJGtE3S/PbcorMeYp2aAsvH3hj5lrsnb rW2r+qk6Uaz01KjKhfYvoidq7wdMLpnK+nNuZ1kCTcZ/G6ycaeC35f1xigAjE1yAJLiC wT48jwDO505Zlqm+3C0yNbvGE0F1Vpv1S1T+/+lnxG2JHjoH0xiABRWvlHm5JxgtL6pt a5yqKhzkCNT082PoeI9uJC7Sl8UZ2F8iqyFSy/tvHxCcwOFuGXC16FLhOGV1w3UmzEU8 uMKgC/BiENTNHRt1BhkMojsx2TthfWbR07gHwFAi0hoC5K4TPGV6qIHoDfybPGXexg7r BabA== X-Forwarded-Encrypted: i=1; AJvYcCUjChb2+Ro6MulIpKrf3djth0Rnqhn+HvNmKhhDSeGqvSCISE0SLpAvIZ06iNghCSblsTWw5on02pO5Xy3M8ZkpuUU= X-Gm-Message-State: AOJu0YxdcHN6w2j1FyXBghC9FdZviJWpkkcnmyUE90Oi1U2t/FcBjroj M5Mu6KZLHLv/ADg+8Zsh/E66kqWACy9Yyyqogtzlt3NYYeWnDeip6I3RD4g3+/8= X-Google-Smtp-Source: AGHT+IHmFd2m5CBKvzK5k3i8fLODdswNsgNMEnNccU6hMgsi68rJFyx72Ggm1uvQlSg441yXaAhOiw== X-Received: by 2002:a17:906:35c9:b0:a3b:b947:af77 with SMTP id p9-20020a17090635c900b00a3bb947af77mr1309692ejb.67.1708008975496; Thu, 15 Feb 2024 06:56:15 -0800 (PST) Received: from raven.intern.cm-ag (p200300dc6f267100023064fffe740809.dip0.t-ipconnect.de. [2003:dc:6f26:7100:230:64ff:fe74:809]) by smtp.gmail.com with ESMTPSA id s18-20020a170906169200b00a3d1897ab68sm631175ejd.113.2024.02.15.06.56.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Feb 2024 06:56:15 -0800 (PST) From: Max Kellermann To: akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: Max Kellermann Subject: [PATCH v1 04/14] linux/mm.h: move section functions to mm/page_section.h Date: Thu, 15 Feb 2024 15:55:52 +0100 Message-Id: <20240215145602.1371274-5-max.kellermann@ionos.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240215145602.1371274-1-max.kellermann@ionos.com> References: <20240215145602.1371274-1-max.kellermann@ionos.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: D6407100003 X-Rspam-User: X-Rspamd-Server: rspam11 X-Stat-Signature: dfw8q9noriiras7x1b5g1x5py36fzf1i X-HE-Tag: 1708008976-721453 X-HE-Meta: U2FsdGVkX19MPYMQD9QGBAnR3/Bf3t6/7lrwxjqm9iSDIk/8JEtGhCU3auCOKq1JrB1J3JqBDFnIBpDXy2pV+H7GvToJK2v+BoFU7F0zZ0lI249ksp2QXRj+qqBZpbMYziAxIwsvTpKsazCfqt4F+8EzjvHPfhr7k5MwtccL7aNgUCw6nrYrtWS6JqCWun59M99WdCOvdGalrRXgY4M+HxkaUCvGlI8jU60GJK8LjLD7db2wLRsEnPqmyffWs0cHgmborYFWssE1vDq19a2yMYs5RGboBLQMJIkxn6TjMcwkXMdjQvOfQgQDkIT47gR1uu0LLuRK1urLOeIUd5qbrUKQzKVBr7Puclam9/fxz0A+AxjRTmRrsEaShbSOGv1Wl8Hz2iHC4CvwZhyC3yuZbz1KkaWCH56FOFJREqE5DgIG4Nv9KFa2JAUD0OmdJSzh7BHRHImCivF3Zp/dJLM1KInsCq9ZQ2hgFaO5T3bqf/Lx7iM7ZmqjJpfRswR8r9GYm1gZb11wfeoGWsFXfggs12cqDqfXY7nmgJAaKUhWiFodoVqWWEFyVbT5Z6FdCMhQ9WCGYXuwYeDYV98lXY0vzi6aO95XYrF37nkCFupE+Y0W6c9OUZzvLtQkWBOMFMq+ekhenHUKWr+lfzOAP1n0Eq+bnfCF/uivQdQ0tTa8ood346jgOAzhQwQzpxsccw0AdpDl7xIJuN1gY0f+FOoXjaRfvGApsGny+XJSUQkXyhFVfCcWnwzoYKXAcXtWuS661t7PO3G4hqjm2Ur1EkyE+yWWxqmqMGnu62hpPcFWvN8YxCGExOc31AhsTPkEj1WnFlhHE5lIpVyKwvzEseeck56z7drJIU2xywN/Eu2feJAT/EwqUtUSga+psomChR6ETfdriJq6AtG49P8AlY/eZAOTqTiT4UYOG/JBqKEdzIFTNtYhPQJbI9OpHOLTYv0jvq5huB7p24l6fyZRuE9 TJqmSdMI kBjuowfReKeMCYpSB/igA/ZYkPvnb9nMa42PFQtySZCQllMg6dSFeTbqAm9cTicR4C77HawQ+kRB5Bb8vQFTmvxa8fM7B938Wq06oS838jEXKoh0gI2QkKGhVzHs+QJDH2Cvoy68tv369WdO7IewEwnw6nNgwauFeBs28OdluCbpyzoboevlFe3TtPgjzCN6wTUs1Dz3en6/kCDjjdxfWl64rfx8EaTl99DSEHlH4kHnJOQ4q1JtYBx8Rcq51zmRNPy+FF3cWQZj79qb1Hj6cvYOT7u39qVYzx/zEhxZZe82sJEowrZ6vdZAIO36lv49j/7xRcawIcM0L4qhjcLNMnCJrdpL6RGdifAArEoRZzgq9Rd1Eqlk5vpMnLs7IPQzpoWCdlpHV5Rd2waKG4LN/6umIC2l04VlF0oqC4J6ww5hqtNI= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000012, 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 in linux/mm.h. 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 decc0cb8ed32..84a49178b94a 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -3,6 +3,7 @@ #define _LINUX_MM_H #include +#include #include #include #include @@ -1622,10 +1623,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 @@ -1825,19 +1822,6 @@ static inline pg_data_t *folio_pgdat(const struct folio *folio) return page_pgdat(&folio->page); } -#ifdef SECTION_IN_PAGE_FLAGS -static inline void set_page_section(struct page *page, unsigned long section) -{ - page->flags &= ~(SECTIONS_MASK << SECTIONS_PGSHIFT); - page->flags |= (section & SECTIONS_MASK) << SECTIONS_PGSHIFT; -} - -static inline unsigned long page_to_section(const struct page *page) -{ - return (page->flags >> SECTIONS_PGSHIFT) & SECTIONS_MASK; -} -#endif - /** * folio_pfn - Return the Page Frame Number of a folio. * @folio: The folio. diff --git a/include/linux/mm/page_section.h b/include/linux/mm/page_section.h new file mode 100644 index 000000000000..e4558c2691b8 --- /dev/null +++ b/include/linux/mm/page_section.h @@ -0,0 +1,23 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef _LINUX_MM_PAGE_SECTION_H +#define _LINUX_MM_PAGE_SECTION_H + +#include // for struct page +#include // for SECTIONS_* + +#if defined(CONFIG_SPARSEMEM) && !defined(CONFIG_SPARSEMEM_VMEMMAP) +#define SECTION_IN_PAGE_FLAGS + +static inline void set_page_section(struct page *page, unsigned long section) +{ + page->flags &= ~(SECTIONS_MASK << SECTIONS_PGSHIFT); + page->flags |= (section & SECTIONS_MASK) << SECTIONS_PGSHIFT; +} + +static inline unsigned long page_to_section(const struct page *page) +{ + return (page->flags >> SECTIONS_PGSHIFT) & SECTIONS_MASK; +} +#endif + +#endif /* _LINUX_MM_PAGE_SECTION_H */ From patchwork Thu Feb 15 14:55:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Max Kellermann X-Patchwork-Id: 13558585 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 B4698C48BC4 for ; Thu, 15 Feb 2024 14:56:27 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 3AD028D0025; Thu, 15 Feb 2024 09:56:20 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 3347C8D0022; Thu, 15 Feb 2024 09:56:20 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 04E3C8D0025; Thu, 15 Feb 2024 09:56:19 -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 E17758D0022 for ; Thu, 15 Feb 2024 09:56:19 -0500 (EST) Received: from smtpin18.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id B504112111E for ; Thu, 15 Feb 2024 14:56:19 +0000 (UTC) X-FDA: 81794338878.18.126A414 Received: from mail-ej1-f45.google.com (mail-ej1-f45.google.com [209.85.218.45]) by imf09.hostedemail.com (Postfix) with ESMTP id B3B84140038 for ; Thu, 15 Feb 2024 14:56:17 +0000 (UTC) Authentication-Results: imf09.hostedemail.com; dkim=pass header.d=ionos.com header.s=google header.b="cE/SfAQT"; dmarc=pass (policy=quarantine) header.from=ionos.com; spf=pass (imf09.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=1708008977; 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=f2uzIED0RGgrcDO6EVVxl3NNU/jaMuJjJACfUgXp0rs=; b=czA+CrxY9zrS8SIsYcd0dwsV9QGseTClTL/BfdFS6Tehy8ZLhWNNJK2ZWGi6RG7KPQ5hDw 1/PSfQLEjoM7/q9W46iuxGrkRPibERVYK08kfrR9NWR0QkeC3V2gwuHfoj37+93gUF07W3 DjIA0Ep9eQeClBeAKZ7GOMLBDlS5O28= ARC-Authentication-Results: i=1; imf09.hostedemail.com; dkim=pass header.d=ionos.com header.s=google header.b="cE/SfAQT"; dmarc=pass (policy=quarantine) header.from=ionos.com; spf=pass (imf09.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=1708008977; a=rsa-sha256; cv=none; b=25YHPrDuNMNyhtIIgszDIHJ2JC0IiAsCxxtpz7Y+do9tQw8Ea/48bcmCjl6LzIwXvREQpw j1BKfzstPC7fGrTmQ8zsFAcAfV4DW2wtBnQXeP7k4Sk0UlMsyl7uA3tLhCtPsF7P3WND7l jFAoOGf/hHSDMBP1L4tdLd96ScSwntw= Received: by mail-ej1-f45.google.com with SMTP id a640c23a62f3a-a29c4bbb2f4so124901266b.1 for ; Thu, 15 Feb 2024 06:56:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ionos.com; s=google; t=1708008976; x=1708613776; 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=f2uzIED0RGgrcDO6EVVxl3NNU/jaMuJjJACfUgXp0rs=; b=cE/SfAQT5+AtdH0LMg7hWC2LuqEjiLkpsj8pWVJzAmVuvfVY3TBhgK6QIGQE4vHLnK 8wF6lwzdarVW9rWExcfj8dOENqD1c5sgT7In60gY70jUSljwTn8MULQlf7OpG7d2A2pM 3p0OrdAg8HskAX3biGoBRW9QOFSXWEuAl+hnLYZimX+5LlkD9mZWR6Pz9kCRkkhhS/xm xt+SWVEIzV65PuWvr6mMiNFa6A8prZcb6/VGG0A1N25XdbSndSKGvUHgDjkFtzwlmbsh Z6x+PpWiiHyKGsmEpJYQASfIX4E3VfWVvbuh23UkOJx1s1NTv4mYDtLzcbbLW8VFwA8d 5bTA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708008976; x=1708613776; 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=f2uzIED0RGgrcDO6EVVxl3NNU/jaMuJjJACfUgXp0rs=; b=TOlpfDK8W9t/O4XaknEq+/6IK+cEB1Ltx98cV+OpRD95TIXOHt5tbrdE0GhwYj81x5 beuK0J5U6259GE3a8VvCRkSfSNBXsh2cGSYSApaSkPqhL4IBMiXzICwLVmmWudDDuUb4 RqqgOsGXcBpH64dC3QOGbpvQ0x3qxEuNjPc0sjCGZOacg12cMfFZo0Npd642jIX8vjMy i8dYp3yC66FVTuE7WxKZzERfJau2z/l7+OOI9QLbQO+rtKIDgPRpm9CSk/OPhQkyMF+e mrnWtRT4MBP0+UC91mUhFUVnjzwEwlwxrcvY7VSnpAawWOq9Sm3lB1R4eyjEIU/l0ipA tMdw== X-Forwarded-Encrypted: i=1; AJvYcCUP+NDaej0rSoRGntpzu1zpzk+ncZNpM0J7FY7y5G0yJj7JVQMkctyGD/4Q7j0hbjtVjwAxuM68lQoGS2Gjh3f1I3s= X-Gm-Message-State: AOJu0Yxiv7bdIQhnKhOio6YiwVIbRQk3fePlGK7gALwcH5Y8EVWMt4u3 SK8PBsDLEAhEwfizPOGxqRMDuPfBLaYWHMx636I9D0UXO3XEHGXZdojEJqyM25k= X-Google-Smtp-Source: AGHT+IEogiGpBqeDYKaXFqCb508Hw08QFq2QQBDux+q+ITm+88gc/oYv7hnWpDwgdVDup9PJgOOyvw== X-Received: by 2002:a17:906:4894:b0:a3d:bbea:da41 with SMTP id v20-20020a170906489400b00a3dbbeada41mr67225ejq.12.1708008976461; Thu, 15 Feb 2024 06:56:16 -0800 (PST) Received: from raven.intern.cm-ag (p200300dc6f267100023064fffe740809.dip0.t-ipconnect.de. [2003:dc:6f26:7100:230:64ff:fe74:809]) by smtp.gmail.com with ESMTPSA id s18-20020a170906169200b00a3d1897ab68sm631175ejd.113.2024.02.15.06.56.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Feb 2024 06:56:15 -0800 (PST) From: Max Kellermann To: akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: Max Kellermann Subject: [PATCH v1 05/14] linux/mm.h: move page_address() and others to mm/page_address.h Date: Thu, 15 Feb 2024 15:55:53 +0100 Message-Id: <20240215145602.1371274-6-max.kellermann@ionos.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240215145602.1371274-1-max.kellermann@ionos.com> References: <20240215145602.1371274-1-max.kellermann@ionos.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: B3B84140038 X-Rspam-User: X-Rspamd-Server: rspam02 X-Stat-Signature: ra7cbpxyfaxwd4secfdbripuzxyuhdba X-HE-Tag: 1708008977-258577 X-HE-Meta: U2FsdGVkX1/h/LXpi3Cxjwo9Y5SeKv723ICgsMMwlyN9eRIBDIxEyzrDGYO9YZ8i6ogjA3sp9kGBMrfGzZ3bdQWJw8ED1pEvbII9vkVuEUuVdC1w8KnPgiqiGNxC1n16CxANMR06Wftbh+2wtO2MvdufVbx83ZNik4TKISvnD9m9yol62f0dr8c4P/tulGlBH5LWu/vhj3Hi/iHSZ0r7CDbfF/YF7TS019omZtCqxoWpe+9bLoKvOaPMbMvYsEpghWTpooprMdEiAHLxWgfyCuIJnn19FN73wiiP4YTV7cac2Emu8UCNjEfbNnuUei2ZUoGaQBsLylsoAWtECFb4XMFz556jxeqT8voxh1bg2bDUbX8b8yHigphEHPvCNnKe5YgvQsMwb95EZ8LcLK5gk/QFKJMMb+bnUcHZuDPwOaggXOH8xmYVLWTT5WBYsmt95ZRoV8Hu1rlLN2QYy0UkvH9hmgKtQ5o55TZkrQ6GIYNsj2P6tuyPM8Ftp6ZyfQ0RaeBtL/c/+GCUi0NsVPNSJTV9VMDlQAM2pykd83wSuXjZ7FtYFONOeswNqLyPkwsJk+IAVJeOmdH8Av7ATi/HpgwKDdwAj5SNL7oI7N3MyLoWCP3s2BpTDEwH+fZBHVZx7MezQ144xVLgaO80HgyLNUm2PHlBPrl8/MBJ2ju1/5KNshKlpIbFBbYycVQMkAiNj2K107ReEV5Q6QtrTOpCOE+U3CFifGqzlfFbxwFoFU1F9Atvs1yBO61L/ixuQHnbCBwPYaAAiQRTc/Slb8VpCkGWbf4PV38G683SJhiVlZCIuTRuKtRY1j//OPmm7Pf67gVoRI18rF1FMZjKlw2XRf8iZX6kznC31qZlribk927xo/5yvb7c8dm8gyLakllTd31CFpMexwoTpvgtPXRNV1SsufscglMLxCsTdiVevAOrUqjt+D+L/flrPN5kK9VOk/+bsDsFAVGzyyIeEdz clle9o2L NWje0QB8o32peKowvwHZNmdQ7hG921V6rHPMjJ47vgv2AiyVxzVjkpKvgsbhnMy9xG+bDXq5x10Bo2NlmlOHyqnfgpzwvg6tGm0FuvHz2WwMT07F2PQKcda6oVC+isqO3iyjVhZ1En6GIedW+SS7NBZdFlQAWFRAI59cmWgGbILXI76HentBfsae/D5+a3TcXplskuYxak3ULeAupQAhJReovT6MZ/V3OFajMUOXO+bz4nK6VtL7yaysKQ2Q6wPaWrta5KtIXr2L42bqFdZw2Wc053TtJBRPlvHQkKqfH+SVXmmK8X+QPw78CARq2n2agVfFm9CewMPUT7S1DMD2xwWkHZQ2/YHbjuoSveciqLhb+HvSMaFiq5MQGgMJdltPdOOXsB8S+Lb1sp5YbfMR1kpd8PdBZbUzyyV/F4WyA0rTGkuI= 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 in 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 84a49178b94a..2cc39916cf04 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -2,7 +2,7 @@ #ifndef _LINUX_MM_H #define _LINUX_MM_H -#include +#include #include #include #include @@ -103,10 +103,6 @@ extern int mmap_rnd_compat_bits __read_mostly; #define __pa_symbol(x) __pa(RELOC_HIDE((unsigned long)(x), 0)) #endif -#ifndef page_to_virt -#define page_to_virt(x) __va(PFN_PHYS(page_to_pfn(x))) -#endif - #ifndef lm_alias #define lm_alias(x) __va(__pa_symbol(x)) #endif @@ -210,14 +206,6 @@ int overcommit_kbytes_handler(struct ctl_table *, int, void *, size_t *, int overcommit_policy_handler(struct ctl_table *, int, void *, size_t *, loff_t *); -#if defined(CONFIG_SPARSEMEM) && !defined(CONFIG_SPARSEMEM_VMEMMAP) -#define nth_page(page,n) pfn_to_page(page_to_pfn((page)) + (n)) -#define folio_page_idx(folio, p) (page_to_pfn(p) - folio_pfn(folio)) -#else -#define nth_page(page,n) ((page) + (n)) -#define folio_page_idx(folio, p) ((p) - &(folio)->page) -#endif - /* to align the pointer to the (next) page boundary */ #define PAGE_ALIGN(addr) ALIGN(addr, PAGE_SIZE) @@ -2117,44 +2105,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); /* @@ -2217,10 +2167,6 @@ static inline void clear_page_pfmemalloc(struct page *page) */ extern void pagefault_out_of_memory(void); -#define offset_in_page(p) ((unsigned long)(p) & ~PAGE_MASK) -#define offset_in_thp(page, p) ((unsigned long)(p) & (thp_size(page) - 1)) -#define offset_in_folio(folio, p) ((unsigned long)(p) & (folio_size(folio) - 1)) - /* * Parameter block passed down to zap_pte_range in exceptional cases. */ diff --git a/include/linux/mm/page_address.h b/include/linux/mm/page_address.h new file mode 100644 index 000000000000..e1aaacc5003f --- /dev/null +++ b/include/linux/mm/page_address.h @@ -0,0 +1,71 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef _LINUX_MM_PAGE_ADDRESS_H +#define _LINUX_MM_PAGE_ADDRESS_H + +#include // for struct page +#include // needed by the page_to_virt() macro on some architectures (e.g. arm64) +#include // for PAGE_MASK, page_to_virt() + +#if defined(CONFIG_FLATMEM) +#include // for memmap (used by __pfn_to_page()) +#elif defined(CONFIG_SPARSEMEM_VMEMMAP) +#include // for vmemmap (used by __pfn_to_page()) +#elif defined(CONFIG_SPARSEMEM) +#include // for page_to_section() (used by __page_to_pfn()) +#endif + +#ifndef page_to_virt +#define page_to_virt(x) __va(PFN_PHYS(page_to_pfn(x))) +#endif + +#if defined(CONFIG_SPARSEMEM) && !defined(CONFIG_SPARSEMEM_VMEMMAP) +#define nth_page(page,n) pfn_to_page(page_to_pfn((page)) + (n)) +#define folio_page_idx(folio, p) (page_to_pfn(p) - folio_pfn(folio)) +#else +#define nth_page(page,n) ((page) + (n)) +#define folio_page_idx(folio, p) ((p) - &(folio)->page) +#endif + +static __always_inline void *lowmem_page_address(const struct page *page) +{ + return page_to_virt(page); +} + +#if defined(CONFIG_HIGHMEM) && !defined(WANT_PAGE_VIRTUAL) +#define HASHED_PAGE_VIRTUAL +#endif + +#if defined(WANT_PAGE_VIRTUAL) +static inline void *page_address(const struct page *page) +{ + return page->virtual; +} +static inline void set_page_address(struct page *page, void *address) +{ + page->virtual = address; +} +#define page_address_init() do { } while(0) +#endif + +#if defined(HASHED_PAGE_VIRTUAL) +void *page_address(const struct page *page); +void set_page_address(struct page *page, void *virtual); +void page_address_init(void); +#endif + +#if !defined(HASHED_PAGE_VIRTUAL) && !defined(WANT_PAGE_VIRTUAL) +#define page_address(page) lowmem_page_address(page) +#define set_page_address(page, address) do { } while(0) +#define page_address_init() do { } while(0) +#endif + +static inline void *folio_address(const struct folio *folio) +{ + return page_address(&folio->page); +} + +#define offset_in_page(p) ((unsigned long)(p) & ~PAGE_MASK) +#define offset_in_thp(page, p) ((unsigned long)(p) & (thp_size(page) - 1)) +#define offset_in_folio(folio, p) ((unsigned long)(p) & (folio_size(folio) - 1)) + +#endif /* _LINUX_MM_PAGE_ADDRESS_H */ From patchwork Thu Feb 15 14:55:54 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Max Kellermann X-Patchwork-Id: 13558586 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 B734BC4829E for ; Thu, 15 Feb 2024 14:56:30 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id CD52D8D0026; Thu, 15 Feb 2024 09:56:20 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id C5DBC8D0022; Thu, 15 Feb 2024 09:56:20 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id AAFEB8D0026; Thu, 15 Feb 2024 09:56:20 -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 8EE008D0022 for ; Thu, 15 Feb 2024 09:56:20 -0500 (EST) Received: from smtpin09.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 69204C0F93 for ; Thu, 15 Feb 2024 14:56:20 +0000 (UTC) X-FDA: 81794338920.09.647EA2D Received: from mail-ej1-f41.google.com (mail-ej1-f41.google.com [209.85.218.41]) by imf22.hostedemail.com (Postfix) with ESMTP id 64A67C0009 for ; Thu, 15 Feb 2024 14:56:18 +0000 (UTC) Authentication-Results: imf22.hostedemail.com; dkim=pass header.d=ionos.com header.s=google header.b=L3hurrd3; dmarc=pass (policy=quarantine) header.from=ionos.com; spf=pass (imf22.hostedemail.com: domain of max.kellermann@ionos.com designates 209.85.218.41 as permitted sender) smtp.mailfrom=max.kellermann@ionos.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1708008978; 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=eRdb10/lfp5UXJT3tHF43SuGZ47dFW6seynzctgmvuM=; b=ZWxXG6lHpYoAPFAFVZ8NIZft6UkJhMe8gIE/E+kH+3dKfo5Fm4UGCRgauNQzXWxMzZRwXh ii01PNVi97LRyxmolWlIW3zAnz9BzR6zZENh/fP7WyUtcUMFYZcHx4RjiPccn2hXvu/zHZ yZPKmQmzyLfwFQWj5rMsVnCzSO3zC18= ARC-Authentication-Results: i=1; imf22.hostedemail.com; dkim=pass header.d=ionos.com header.s=google header.b=L3hurrd3; dmarc=pass (policy=quarantine) header.from=ionos.com; spf=pass (imf22.hostedemail.com: domain of max.kellermann@ionos.com designates 209.85.218.41 as permitted sender) smtp.mailfrom=max.kellermann@ionos.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1708008978; a=rsa-sha256; cv=none; b=lS8oCQQvNTo2WyTX2yfCljuLCgbsBgyx1uEY58glV1U92tC6J083OyxV65syDemK1MiAd1 xvVADbtnAXXm76oAR38106IsK3pcpYtTRKyAkx4+EOZwOn4Cu2WSNe8k2W3FNBBmFeNSnS Lynr46cDr+iaVWpIc+kAaQeojO9Zeb4= Received: by mail-ej1-f41.google.com with SMTP id a640c23a62f3a-a3d5e77cfbeso177475766b.0 for ; Thu, 15 Feb 2024 06:56:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ionos.com; s=google; t=1708008977; x=1708613777; 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=eRdb10/lfp5UXJT3tHF43SuGZ47dFW6seynzctgmvuM=; b=L3hurrd3og6EXdSkGAxJd3j+uF6wtY1C/wAL7RZTQkRk/cBm1AiYjeSYOwAEZfhI10 D+iTgoM0jXj2+vsXrRU+O75MDPcxOi2YashV2xcI73cd2TbVDK9gPeTGljq/RuDZxPhV L+/Z79/s13/D6yWSFBWm3I0S3ylq6u9eLYWEFXLVfMi1IjKDhlArwvjqxhidgg1WFXnM wGEbVRy5A4IxkTYPLKpniWLWgIg67LawXcXrDzXsPVbuaj30BS9viGGuv7RVgtFjiwkY 4yB+NohquA8ac4B5ava1vQapKu7l/7Ju29xDy3q+MmLQo8EZYIBw8aP5qcld6wLN9wyA sFjw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708008977; x=1708613777; 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=eRdb10/lfp5UXJT3tHF43SuGZ47dFW6seynzctgmvuM=; b=ZWyqcWFOrsU6RGdETIx+fomj6ucr7qLqvBfPRoVGLwXSZ9FoiXt22HEIGsuuVj8/dj xC0qbd7ijyOkUQaNVpeFLvFbrnF3CGKVLTMuhARa3UG2QjA0MAjuKWY46QC/dDwypvoB powpTiYATeyPMT9Z/vkpQ6JecipyhMduStecRk95pCiYZae1Ctp/D1JkyDw+Pbtu+KTW oIfGpinaYkiId6q76Xkg67zm5fgqSiNxCaqZF+F6fNdXE+ppiJrYs25ngY1VIE6LkPDT C9pUsUHuplA82vSTLufS7ExoxjLClZ8s5J53QajIADBLaxravTOWgrpICY1ouAn3b2Kl iIog== X-Forwarded-Encrypted: i=1; AJvYcCUKolr6pi+4UbOi63nOQIBSu/B4tX9v0xjIrbtghKGBxJ7oeHTZzGVm75g0+7/Boe6nC7a64S8DvsKKr5vh9HEtorM= X-Gm-Message-State: AOJu0YwosIPTh6DhyyrJtlAftmMRMa3+qcuLxvnAvbzlyRW7Y+eUn4Ll g5HAsvhTjW96EHeciKVXgS9rE7iorqUftJpQDAWoeUWhTV4V5plG5dHk4WJ7r0Q= X-Google-Smtp-Source: AGHT+IH0v9QIPzh4mLYGVGUXnX6SaEOib6O3Cyl6trEGIAKPjF0auWYf6zoGD9rvUxlVXqLI+vIGaA== X-Received: by 2002:a17:906:22d8:b0:a38:4f6a:4e7e with SMTP id q24-20020a17090622d800b00a384f6a4e7emr1940730eja.32.1708008976994; Thu, 15 Feb 2024 06:56:16 -0800 (PST) Received: from raven.intern.cm-ag (p200300dc6f267100023064fffe740809.dip0.t-ipconnect.de. [2003:dc:6f26:7100:230:64ff:fe74:809]) by smtp.gmail.com with ESMTPSA id s18-20020a170906169200b00a3d1897ab68sm631175ejd.113.2024.02.15.06.56.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Feb 2024 06:56:16 -0800 (PST) From: Max Kellermann To: akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: Max Kellermann Subject: [PATCH v1 06/14] linux/mm.h: move page_size() to mm/page_size.h Date: Thu, 15 Feb 2024 15:55:54 +0100 Message-Id: <20240215145602.1371274-7-max.kellermann@ionos.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240215145602.1371274-1-max.kellermann@ionos.com> References: <20240215145602.1371274-1-max.kellermann@ionos.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: 64A67C0009 X-Rspam-User: X-Rspamd-Server: rspam04 X-Stat-Signature: s6przinfqyb8edtwgi754tnuk8zcg48p X-HE-Tag: 1708008978-144076 X-HE-Meta: U2FsdGVkX181eHmsH6fZWWvQPgC2eg+vIqXMiVyeGhk77QDM/V09S4b45e8THFRs/BBmpKkpjAA61oqKtbFW76VhNjD0zSBVqFRmWulwFZg0gLGUQjI2pdl96qRmb/AVGr2x9nMTQfHo0B00JJDUggrJ5yMsRimMx0KJSfpEBdj79xYwqWP8+mPzUVcmDEXMnRQ3HqkSqFpTtXsLAZXKJvWaFZKlicGpD9UYAT76pXracanXvPAMYLNy1Yb63ajbTE/MCfLeByWlaLG3s6o+Hz7DovmnacxPF6oKf1dTLdf4CI7ykSydtoq51/gSGQVGNDbD+krsQsnHMluxqP5LYz9/OYCX2dOcQM8d95nnCtKyPiV+HtdEH1m5XKtvR7V4SA+1lYvUv3gohlUh3Tuj8/SgKRF3Zp+1SoWWMwLaBDbA0nC2pXO94yA9pn0qKZsH9ZJr7ZtLg6faK0O66iRlqJuLeK/S6T/3ZdUz7cke0RtrPQHLF42kawoxu/SuEbwYNxlwrj/yn9+KIXpBBACRYSS/fpp3vDX5ba65OC/+ozTRF+h3CPdx6iaFIxFQjBLm5rtCaa+GmwlQFX0TqGozIn6c0uZekioifbjOWtIb4S3wiOgPmllbE4I4ykBUr4M+EFQz5A/WCXKzs50dCkh5SavAZsyHdqZiWRNHnLZ4qtqm9NgPbQMBxy5E0oilH176MDJqzypp62471IEsyWfHMW5ZL5iP1AB8aRm9bKIX0w38J+Ar7JDuWfya0Qug+DQjom9kQn8jqyZd4BXS1TAwjO0Y/329XDgz77SpoYezXXjxIMjNdXklpTQP9C7FqTbTIo3l/BwQbfOjRomwc6n0ip2xnrRa09z/4RMwUTFEqtX9XUwsgaLL0Uqf03t44wOB35wFC/0zqloiNUu+eATeQf9AUWoPXhHoe01NvOBo/qW5PAVoy4WBxvRKgZftNRqKTdBivWraXaLnH2dQbI8 R5ujVG3Y M42NfPL4Ya5s5247lu7NwwR5Up59yNWhppw/DpRG19xn5qtL2aGX7zjmiQX2BdXxUSBf3EGGlHP/JemT33f1MDr+l2Jc4fUAJAtRoCR6LS/fkQ/SbxD4PY38IeijdiZ+g97dFBi5kZg987E+SFmALKx4VXzgpNV6m3v8cS1kFsWB5lc38E9/ZkkBhFJaBjZpPcZIw1WZhj7sSRNN/3l25PJWoLWywhdyhWheR8gn6Q+Vw7Cx02ylnBJvIFhMP8fX5S1pSSAj381mjpiQuYJxOGg8IJcTuo+L1tL0IOoTKAcCd0uuQBS3xN3MzhOBt3dDJ7vQ9EHUrux2di34z55Rrl9wiM+/h/o6cAcZnBAieqIYsfurT8SebjkCDi29agPkQbGvmw0U/yQzsFdQNtAFj/9SwwC5EwHFVmF6n/054VlgLDlc= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000202, 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 in linux/mm.h. Signed-off-by: Max Kellermann --- include/linux/mm.h | 140 +------------------------------- include/linux/mm/page_size.h | 150 +++++++++++++++++++++++++++++++++++ 2 files changed, 151 insertions(+), 139 deletions(-) create mode 100644 include/linux/mm/page_size.h diff --git a/include/linux/mm.h b/include/linux/mm.h index 2cc39916cf04..778f8aebb45c 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -4,6 +4,7 @@ #include #include +#include #include #include #include @@ -1049,38 +1050,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 /* @@ -1294,39 +1263,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 @@ -1966,50 +1902,6 @@ static inline void set_page_links(struct page *page, enum zone_type zone, #endif } -/** - * folio_nr_pages - The number of pages in the folio. - * @folio: The folio. - * - * Return: A positive power of two. - */ -static inline long folio_nr_pages(struct folio *folio) -{ - if (!folio_test_large(folio)) - return 1; -#ifdef CONFIG_64BIT - return folio->_folio_nr_pages; -#else - return 1L << (folio->_flags_1 & 0xff); -#endif -} - -/* - * compound_nr() returns the number of pages in this potentially compound - * page. compound_nr() can be called on a tail page, and is defined to - * return 1 in that case. - */ -static inline unsigned long compound_nr(struct page *page) -{ - struct folio *folio = (struct folio *)page; - - if (!test_bit(PG_head, &folio->flags)) - return 1; -#ifdef CONFIG_64BIT - return folio->_folio_nr_pages; -#else - return 1L << (folio->_flags_1 & 0xff); -#endif -} - -/** - * thp_nr_pages - The number of regular pages in this huge page. - * @page: The head page of a huge page. - */ -static inline int thp_nr_pages(struct page *page) -{ - return folio_nr_pages((struct folio *)page); -} - /** * folio_next - Move to the next physical folio. * @folio: The folio we're currently operating on. @@ -2029,36 +1921,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/page_size.h b/include/linux/mm/page_size.h new file mode 100644 index 000000000000..0f8ee3dab6d0 --- /dev/null +++ b/include/linux/mm/page_size.h @@ -0,0 +1,150 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef _LINUX_MM_PAGE_SIZE_H +#define _LINUX_MM_PAGE_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_PAGE_SIZE_H */ From patchwork Thu Feb 15 14:55:55 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Max Kellermann X-Patchwork-Id: 13558587 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 266F4C48BC4 for ; Thu, 15 Feb 2024 14:56:34 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 38A138D0022; Thu, 15 Feb 2024 09:56:21 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 2C14C8D0027; Thu, 15 Feb 2024 09:56:21 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1121E8D0022; Thu, 15 Feb 2024 09:56:21 -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 EA7138D0027 for ; Thu, 15 Feb 2024 09:56:20 -0500 (EST) Received: from smtpin06.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id BB9C7C0F93 for ; Thu, 15 Feb 2024 14:56:20 +0000 (UTC) X-FDA: 81794338920.06.BD94ACB Received: from mail-ed1-f44.google.com (mail-ed1-f44.google.com [209.85.208.44]) by imf25.hostedemail.com (Postfix) with ESMTP id D40D5A000A for ; Thu, 15 Feb 2024 14:56:18 +0000 (UTC) Authentication-Results: imf25.hostedemail.com; dkim=pass header.d=ionos.com header.s=google header.b=Oqy+MZS7; dmarc=pass (policy=quarantine) header.from=ionos.com; spf=pass (imf25.hostedemail.com: domain of max.kellermann@ionos.com designates 209.85.208.44 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=1708008978; 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=HWAZLa4eGWeLLFtGDVHZ7Dmnhq8s5ecyK6HpyTUArQY=; b=R95ya/vYt3Ej22DWv8X6WUMILOAL61kxvyAnSPuAwp6Sn5qzbD4kplWDmOpNOCKcNOTa7F TLd5tnAJLKHEAQqtpdlMQZHxJTvqP6p+5KOUwrxMcs+hd9RXMZ3zZt9smkKlqJBCdTkHfA wie/xKfRif7itaKtQMdkQ8NQXc72Tok= ARC-Authentication-Results: i=1; imf25.hostedemail.com; dkim=pass header.d=ionos.com header.s=google header.b=Oqy+MZS7; dmarc=pass (policy=quarantine) header.from=ionos.com; spf=pass (imf25.hostedemail.com: domain of max.kellermann@ionos.com designates 209.85.208.44 as permitted sender) smtp.mailfrom=max.kellermann@ionos.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1708008978; a=rsa-sha256; cv=none; b=53I9OQq0IoxqDZTHPZ5WukE7YkrBBkUJJnpqy+BfBd1mzF9bVV+6At3zKyDKt/NuTd/L8n us1YA8Gw5yYr8oWt7pfnJgtUgMY1Cu+KIfT56jJw4PBFsmdC/MlOcKzLze/sJbGlc5tvYI SZVpttUknYI/CBYrwerPTXqr8nuiLG8= Received: by mail-ed1-f44.google.com with SMTP id 4fb4d7f45d1cf-563cc707c7cso429847a12.1 for ; Thu, 15 Feb 2024 06:56:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ionos.com; s=google; t=1708008977; x=1708613777; 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=HWAZLa4eGWeLLFtGDVHZ7Dmnhq8s5ecyK6HpyTUArQY=; b=Oqy+MZS7wJG5pN7UXHzBavs1i9xRpJ06DfWrj5I+tU+CK5AXov7qTqA3w5uk9oPrE1 JZVKye7aedfRSmAtbzO0rpq620+AkRi4zC024bua8l875UJ1rg0zlRVRTmNZfVemLI/R UelpJ43stjXBGptBQgHSp7tz0Rni/Sf+0VjUWAVQp4U6goLzso/9GBS3Fn/RPTGtMxQW QrrbvQyhUXUUrVhJE2gJBhdkIQji3pbz7naBCSO1ck4WFAtiSr13wDGbaaA3KT5+Rjyv 4bGUADQPjNXXDEbpRp+ZlJzCMhv9RboHkRh7+GtwoDWU6bhTxxZSd+NGXETj3LCyMk28 Gr8w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708008977; x=1708613777; 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=HWAZLa4eGWeLLFtGDVHZ7Dmnhq8s5ecyK6HpyTUArQY=; b=t1OELX95kKyD+hGV/Qj2/DNohZU0FKShlUrID8t0dVydIqoIx+WbME/6DZsZPnZgXO uX39waR63SMlyT+ofntCPNtz+DzBUtlZz8WCXVIjkarhflZiY3fOSRwe8KevNDf6tpoE DucqHGImOawgvSg0XKVK9ShubSCbH7/qSJyQiEz/rvdkP2EpTpjdw7fthx5r8+pA77nL UBviav8TFPlZ4UDG2IW6LwoNCM4d/vazy72eAlnaY4p/IJqw+VLSsqVJwdQCYDIuVu87 oJHpHLELScRDnj1p8Dy/j0zii43whOgiFHvtp3pOtAw+5azHix0L/H4neqCPuCSNp05k FvPQ== X-Forwarded-Encrypted: i=1; AJvYcCXs0FYNEtA4lj/QHekscdI7zMxwqhTYW1BemP6mDRONdv/mx3FRxZyICWVhEEp7gJBIVZEiRfV54c174JORZtD4vJo= X-Gm-Message-State: AOJu0YwdyR/rkXEcUzlELVWmDQB7eirBiNhDJqIC3s8H+zzsbhpbFdzp kAk8KbBcSoD2+TxqCaIiwg3msimQsZFiKNqIahf/dxhwxibgTfyKVR4AaJShAC4= X-Google-Smtp-Source: AGHT+IGU9TKdkFWWYn5nManyHa5Cq12HDMG824kqhWOdOLInM9eT0d+XVJcxV596UFLLPDq03Xj/kA== X-Received: by 2002:a17:906:f8cd:b0:a3c:8e78:8b59 with SMTP id lh13-20020a170906f8cd00b00a3c8e788b59mr1737035ejb.15.1708008977452; Thu, 15 Feb 2024 06:56:17 -0800 (PST) Received: from raven.intern.cm-ag (p200300dc6f267100023064fffe740809.dip0.t-ipconnect.de. [2003:dc:6f26:7100:230:64ff:fe74:809]) by smtp.gmail.com with ESMTPSA id s18-20020a170906169200b00a3d1897ab68sm631175ejd.113.2024.02.15.06.56.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Feb 2024 06:56:17 -0800 (PST) From: Max Kellermann To: akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: Max Kellermann Subject: [PATCH v1 07/14] linux/mm.h: move folio_next() to mm/folio_next.h Date: Thu, 15 Feb 2024 15:55:55 +0100 Message-Id: <20240215145602.1371274-8-max.kellermann@ionos.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240215145602.1371274-1-max.kellermann@ionos.com> References: <20240215145602.1371274-1-max.kellermann@ionos.com> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: D40D5A000A X-Stat-Signature: mfez1aixh6pkqhbgdr3jfp8z9do4nxgd X-HE-Tag: 1708008978-586785 X-HE-Meta: U2FsdGVkX19nBNXBg3alcqTkdbpMugcmAdW/BGXcglNH6pymJcyUCmKMKwZSXGnVuV0VyOqeZLfWRsQiOpekdIiHfkfTw9nIAZQPVAPLTbU/f26/0CIdadMP7Uo0sIgfA23GscSNT66O9UOZ8GWTJ7sGItD6vuqRU+T038dTxAaxiNQ3fD0VHv9yvC2tEkxeJkqZoQ3jhFD4c8YJHDd494Nd3tBzz4SBBEtiYsKsXSdIVZza2jLai0CKJ28QXLtLU3IL9SSTrsDSlupBpnIMZ5JI6wa8y/U3wZn3wb9IDTSLYN2Vnzth2p6jT02M13b84L9kaGo4BVuQQArme0XVbRRa4haxYJHHr1sfP7vSQuKwlUp0YGiU4dReEwBxpMWIXf/UZZuDcsKv+It53Wd8qiTiDuj3ZGI0Eh0Yz1pH9pD8E+k33FHUqhCFV4qAasJiZUKmWXxpoZ2uiFOvh2glQL8xfL/Yh6PHbKv+C3Yq6LhZWGX0QHfS9mzr2PSiziLNrCUTzG5wnCsZ2paoBDkI5Fwmh18nMRLKfGM9xndwnl8955mBGdCn8iEVh/o7fbp6tAL7iYBY2f5Zj+Ri1zT6ZxnJoupN/51q4ubDnsNWQ7vJ0U7qqxSp7S1URtoMamIBcx2JoekhFVSY5yl5i+PYWuzT41Z/ZoeLwxdvwGF2CUU5I+5V4QjrbCrrKB5XGVcXC9X9/xLXO6elDBhpaXAttMo/rd6DFULR98diupdGTCdhZmH1yKWI3jyzPh0VIg0d9MyoewzrshIPKqfrWg6QbVPBCC2kvD1VMvtolqs2/Q9i0QtBN8wtfmgBOYy3IOnhLUsMmM0HcneoS/uz0SSmkL5KIMspPvFD45LNDjM/RrpBfzwZvge90SZKX9z18Hhl5K0Y/r4hSTTU2jk28iV4bWrU/BjT3TiP6iClHrlzQGg7iF90ZRPo8ipuoRbr4ty07v1y4Fr7He0Ark9Sd3B Qq+/2jAE 0Ym3A9BCDk1BD6uCkhkNdDx7EEeDlMxMPARY5qAXNWRDXJbuHBcOg2aLeS27YzpRqWCc9n8rCfqHmK62vYVt0NJ4maf3qGCYHTGFvjQLdWVtsHlMtWQdFTOpoyEV0oTTYEJ/ySs5eSWyavbn3Fz+tqFnfannMTEsh44ZLyN3hftn9ouMboXohetZNCcy0ibnfSKRwN8GHY0bx5PSV8wXuF+rYv25MP+HQ8RGc50lRyZcVUR4Tvy99Hs4O4n94lzs7U/D5XtDHdRhlOvBuDV/ae71GWtS+8EmuDxfVeglUrVdUK8S08aG0IPHBAoHKd04iWtOkmqn7lf8tOERIx0u6n+s9bYXnEKjS5bGdCzYXqWbjoviG1u3ZT5Bo5w== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000331, 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 in 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 778f8aebb45c..680329ec21ba 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 @@ -1902,25 +1903,6 @@ static inline void set_page_links(struct page *page, enum zone_type zone, #endif } -/** - * folio_next - Move to the next physical folio. - * @folio: The folio we're currently operating on. - * - * If you have physically contiguous memory which may span more than - * one folio (eg a &struct bio_vec), use this function to move from one - * folio to the next. Do not use it if the memory is only virtually - * contiguous as the folios are almost certainly not adjacent to each - * other. This is the folio equivalent to writing ``page++``. - * - * Context: We assume that the folios are refcounted and/or locked at a - * higher level and do not adjust the reference counts. - * Return: The next struct folio. - */ -static inline struct folio *folio_next(struct folio *folio) -{ - return (struct folio *)folio_page(folio, folio_nr_pages(folio)); -} - /** * folio_estimated_sharers - Estimate the number of sharers of a folio. * @folio: The folio. diff --git a/include/linux/mm/folio_next.h b/include/linux/mm/folio_next.h new file mode 100644 index 000000000000..f92d649c42c6 --- /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 nth_page(), needed by folio_page() +#include // for folio_nr_pages() + +/** + * folio_next - Move to the next physical folio. + * @folio: The folio we're currently operating on. + * + * If you have physically contiguous memory which may span more than + * one folio (eg a &struct bio_vec), use this function to move from one + * folio to the next. Do not use it if the memory is only virtually + * contiguous as the folios are almost certainly not adjacent to each + * other. This is the folio equivalent to writing ``page++``. + * + * Context: We assume that the folios are refcounted and/or locked at a + * higher level and do not adjust the reference counts. + * Return: The next struct folio. + */ +static inline struct folio *folio_next(struct folio *folio) +{ + return (struct folio *)folio_page(folio, folio_nr_pages(folio)); +} + +#endif /* _LINUX_MM_FOLIO_NEXT_H */ From patchwork Thu Feb 15 14:55:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Max Kellermann X-Patchwork-Id: 13558588 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 EF611C4829E for ; Thu, 15 Feb 2024 14:56:36 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B00578D0028; Thu, 15 Feb 2024 09:56:22 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id A8A4A8D0027; Thu, 15 Feb 2024 09:56:22 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8B5688D0028; Thu, 15 Feb 2024 09:56:22 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 70E4C8D0027 for ; Thu, 15 Feb 2024 09:56:22 -0500 (EST) Received: from smtpin24.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 3A640120A39 for ; Thu, 15 Feb 2024 14:56:22 +0000 (UTC) X-FDA: 81794339004.24.5959AFB Received: from mail-ej1-f41.google.com (mail-ej1-f41.google.com [209.85.218.41]) by imf12.hostedemail.com (Postfix) with ESMTP id 5ECD540013 for ; Thu, 15 Feb 2024 14:56:20 +0000 (UTC) Authentication-Results: imf12.hostedemail.com; dkim=pass header.d=ionos.com header.s=google header.b=EsFUwL8O; dmarc=pass (policy=quarantine) header.from=ionos.com; spf=pass (imf12.hostedemail.com: domain of max.kellermann@ionos.com designates 209.85.218.41 as permitted sender) smtp.mailfrom=max.kellermann@ionos.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1708008980; 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=xRvSVsODNSSWpBrjcPj/MUDqCBoUjFcr6NI1MGfkDG8=; b=1K+9lucIEzdQu8h5vXxSXuxERQn8zRk/1oAVTSIWCTVWY4JHsomcPjFPuMZNDQlu6bHNiB XP9ksAjqIkPC7ImEgsiTM5LktXnO9EQuN/6kiCIRh9QPHeUzbgX+i2IkTg7VKJk/T0sG+M iTSmXhSAIUId3gj6DB95T16tXPDY8SQ= ARC-Authentication-Results: i=1; imf12.hostedemail.com; dkim=pass header.d=ionos.com header.s=google header.b=EsFUwL8O; dmarc=pass (policy=quarantine) header.from=ionos.com; spf=pass (imf12.hostedemail.com: domain of max.kellermann@ionos.com designates 209.85.218.41 as permitted sender) smtp.mailfrom=max.kellermann@ionos.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1708008980; a=rsa-sha256; cv=none; b=xeL40JuNYqJMtFeHKS1ZSl0pESUMBehYSUgoFz4vnnpxbEIhLdC16c5+iCYf2qEiW/vNxq roWZHkWg7zLw+lfbK+lk5v3Z0Rr7AUoEP9/fipOLksabZf5xmCxr7CMUbk203UexMPNDOw mubwihIjRDCqhc3JFUa+cPUvnWN+r8k= Received: by mail-ej1-f41.google.com with SMTP id a640c23a62f3a-a3db0b8b313so39404666b.0 for ; Thu, 15 Feb 2024 06:56:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ionos.com; s=google; t=1708008979; x=1708613779; 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=xRvSVsODNSSWpBrjcPj/MUDqCBoUjFcr6NI1MGfkDG8=; b=EsFUwL8OVaRvKO8cRn44POK/T1BSZXEpNT26sR/moYVbo7GcJvvlJTSkCsbYsPX1Jo C4W5FWs1+D+bwSf2N4PzYiFAn3EagywNmF14KCOVxesDDZ4+9+uo8zdUM8b2YJGPlpzB Uf6d86RemDj3Jd1V4TC2WQtdzg/MOiznroukWrGanfiZIMzCaDk55GzppVwySRo/U5DN ZTP3+Icm7yGvJQ0UOG3MV51VoCYaegEh8kuZ7fBYyZnl9M3HlGhQBZDYn2I8Bs6hX4ls 9imdcIlUyjwbx8LPMbeTASloCuYrTrrAshA28iy0Gk2zoo7uhGG6ATQBzdIXgjmhs29o Q+bA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708008979; x=1708613779; 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=xRvSVsODNSSWpBrjcPj/MUDqCBoUjFcr6NI1MGfkDG8=; b=jrhzlZptFJ+Ku07hB49yxxz25NUXkQ3kOmmDwIp6Ryz0na02/AQjn25GT8J6/vuRt+ rr0EeXijF1IdbfARXmV1BbC1h4ODYXnti3nkphcc9IwAM+XAig1QulK90sroAfAHhN/U 0gPcZLR6VYGCTFKn1wF5YLStiIrOrVCMw8QBZTu7yw0gkHqOqiMrCiiqwOb0zkSEwYUW lMsUQSF9G+XenQ/W+SeAueITOOp9fyxvh9V3mOEWzj2S20TNB6GrmaNm4vRVTZQlPwlG vI4DFGAOjmmq9gmAa6Gilp6YmUXugR9mr07n+lrPyUqnQFLR6kalad8m72EfXHLWHV6M HXCg== X-Forwarded-Encrypted: i=1; AJvYcCUT2hIXFpjrTE+fFUY+NCN8HDsLhiEzV2S40g3jAb+Vj8ue5fjH2lEnVIkx+/1eWZhJLyJoGCRnAM/FgOpxI3gPawA= X-Gm-Message-State: AOJu0YxIv2SozRz6HDvmwCncu1uPCaXOueq5KEOaQDVKgSQ3J8/gyjLE ueEdMPo2r24IlMlNGit8gcJrW3Ep0qa5HiFs7k4QZjPWyZ6O0pABpvc/whE58mE= X-Google-Smtp-Source: AGHT+IHa3g48edLxpLnPmjuHN2ahaJh7C1K0HVPHep8G35XAhbS9I+UMBUTxYQtrfWhuCGGHZU2OSQ== X-Received: by 2002:a17:906:bc5a:b0:a3c:875b:f378 with SMTP id s26-20020a170906bc5a00b00a3c875bf378mr1086457ejv.36.1708008978701; Thu, 15 Feb 2024 06:56:18 -0800 (PST) Received: from raven.intern.cm-ag (p200300dc6f267100023064fffe740809.dip0.t-ipconnect.de. [2003:dc:6f26:7100:230:64ff:fe74:809]) by smtp.gmail.com with ESMTPSA id s18-20020a170906169200b00a3d1897ab68sm631175ejd.113.2024.02.15.06.56.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Feb 2024 06:56:17 -0800 (PST) From: Max Kellermann To: akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: Max Kellermann Subject: [PATCH v1 08/14] linux/mm.h: move devmap-related declarations to mm/devmap_managed.h Date: Thu, 15 Feb 2024 15:55:56 +0100 Message-Id: <20240215145602.1371274-9-max.kellermann@ionos.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240215145602.1371274-1-max.kellermann@ionos.com> References: <20240215145602.1371274-1-max.kellermann@ionos.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: 5ECD540013 X-Rspam-User: X-Rspamd-Server: rspam05 X-Stat-Signature: pt3tikz6a3ppxhkbtdkxtzk5hz9xa853 X-HE-Tag: 1708008980-352950 X-HE-Meta: U2FsdGVkX1+3Wr9/sf3/P7iOSl369tn48PkNFqiiB65asxA+zp4n42EPY4Vb9le1u9fECVb+YY9MtMagAa2UV96ofhQE+nXMaUaNv94xuoGywaGZUXBMp4MBZjyifVrOrEjpQpRcX02bG3xTN31AgKXAfdf0hH+CQBGkPHpctf2GwnTNE7mL44IGCPiG5kpZF4uPfzD5kX2KJTkdJ9VstZONGIuAYQzhs49S/K5MAoTUeYNNwF6hijGuHoChm0cGYbe5oD9g5XdYaz0kIF1/mQtAuRcxn4oFzUsuopaSE7cUVdykZAUvti1kDBZJVw6vL/YsF1/vNgsJjNptScOKcIiVue3MWhOkycuo8QaZX7nKDpj+tWNgnXeOQ5+1/6CLBGolIJX4Q8Kgz3le+zXchnkb2iDrm3llJu9pOFXwUW66QYJ5yYgyrFun3e4oMefvgqZECimstCuYjhQeA3MTs6Rdmg78cj14karJhzpR7ikooOhorQhlQWLkEpQmB9iLhAhteCnqZgMfRGOkRADPo1j+0h1NMBl+GoqlwUNLUftzx8v4oC3X2v4Tw9+j0qi3yMidULzCO9C8444rmllQcNG5Ifj0rzFApDpm9Wc4g2V9G2b2KmgSViLnG2Cw6zBlmzAcU1JzcnMtrW8LcCvMPthW8Z00PY7lmuZ3qAJa/lf5YKa2uD2DWTeaGLMl5CI9x86dEP4fD+2nmLkZx6C+9Dj2bqM1L68CjDGD50tWM9vrZ3toNPM922H4KOttZk9myZv37WsF5OzrtAsR8hsGYbsPH9ZfMv6bpbT0nCla7uf+fwdipb5gopJe9TfQZzhVe65E4qrDja5LV1Z6sftnlEKAsL2HHs8gpQUzyPJrQTkXDK23uQXo8haxmu78V3KU5CX+HoqVjexU7AJNA0pN5J08+ZiYdi20xSBjs4qBTb15OQJebabZHr5UutjKB3q61pkPs0edBJ3x9FLra8c LXu/IKDD 2rDe7TQikFimq8RDdQv+rrEino6s+HlWpJ0ua8gTM09YkjMfrFFoODXZHvgBJPSaZAsJjU6NObzA2wogBFT30ZFmoRpQQ3UBBLxeeTT01foZzBEBGLPC7h6Iq9LMOSxes3ub8XBhuz32xLB//TPECLClPHEM43uepdgmAjr1WgLlCluLqb5vNCif0bzzdd2sZT1uMgaNcQBrrPxm1oHpbTXBRdoXBHNVIF4nm3ANduzlAcFzBGRMrPTr7Fd9UxJGn7TKdVrezsKVvZU2e1C1UTHgQXCsB0beOkGMvME8j7qypbzljYVDfCzrTXJmuYEmlQ13Fig756k13yExDVFLPbSyA7AKc72PkfttCR+WLzu3De05q2rz2MePqEFV6v5a8x80q/yVpbecOEZflLaK8VsuK62ksNyQJSdro9CZ18XRjuJs= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000723, 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 in linux/mm.h. Signed-off-by: Max Kellermann --- include/linux/mm.h | 24 -------------------- include/linux/mm/devmap_managed.h | 37 +++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+), 24 deletions(-) create mode 100644 include/linux/mm/devmap_managed.h diff --git a/include/linux/mm.h b/include/linux/mm.h index 680329ec21ba..cb2dd71e2940 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -1345,30 +1345,6 @@ vm_fault_t finish_fault(struct vm_fault *vmf); * back into memory. */ -#if defined(CONFIG_ZONE_DEVICE) && defined(CONFIG_FS_DAX) -DECLARE_STATIC_KEY_FALSE(devmap_managed_key); - -bool __put_devmap_managed_page_refs(struct page *page, int refs); -static inline bool put_devmap_managed_page_refs(struct page *page, int refs) -{ - if (!static_branch_unlikely(&devmap_managed_key)) - return false; - if (!is_zone_device_page(page)) - return false; - return __put_devmap_managed_page_refs(page, refs); -} -#else /* CONFIG_ZONE_DEVICE && CONFIG_FS_DAX */ -static inline bool put_devmap_managed_page_refs(struct page *page, int refs) -{ - return false; -} -#endif /* CONFIG_ZONE_DEVICE && CONFIG_FS_DAX */ - -static inline bool put_devmap_managed_page(struct page *page) -{ - return put_devmap_managed_page_refs(page, 1); -} - /* 127: arbitrary random number, small enough to assemble well */ #define folio_ref_zero_or_close_to_overflow(folio) \ ((unsigned int) folio_ref_count(folio) + 127u <= 127u) diff --git a/include/linux/mm/devmap_managed.h b/include/linux/mm/devmap_managed.h new file mode 100644 index 000000000000..0773529d80b2 --- /dev/null +++ b/include/linux/mm/devmap_managed.h @@ -0,0 +1,37 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef _LINUX_MM_DEVMAP_MANAGED_H +#define _LINUX_MM_DEVMAP_MANAGED_H + +#include // for bool + +struct page; + +#if defined(CONFIG_ZONE_DEVICE) && defined(CONFIG_FS_DAX) + +#include // for DECLARE_STATIC_KEY_FALSE(), static_branch_unlikely() +#include // is_zone_device_page() + +DECLARE_STATIC_KEY_FALSE(devmap_managed_key); + +bool __put_devmap_managed_page_refs(struct page *page, int refs); +static inline bool put_devmap_managed_page_refs(struct page *page, int refs) +{ + if (!static_branch_unlikely(&devmap_managed_key)) + return false; + if (!is_zone_device_page(page)) + return false; + return __put_devmap_managed_page_refs(page, refs); +} +#else /* CONFIG_ZONE_DEVICE && CONFIG_FS_DAX */ +static inline bool put_devmap_managed_page_refs(struct page *page, int refs) +{ + return false; +} +#endif /* CONFIG_ZONE_DEVICE && CONFIG_FS_DAX */ + +static inline bool put_devmap_managed_page(struct page *page) +{ + return put_devmap_managed_page_refs(page, 1); +} + +#endif /* _LINUX_MM_DEVMAP_MANAGED_H */ From patchwork Thu Feb 15 14:55:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Max Kellermann X-Patchwork-Id: 13558589 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 17E76C48BEB for ; Thu, 15 Feb 2024 14:56:40 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 1DC6C8D0027; Thu, 15 Feb 2024 09:56:23 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 166C78D0029; Thu, 15 Feb 2024 09:56:23 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id ED18C8D0027; Thu, 15 Feb 2024 09:56:22 -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 CF7218D0029 for ; Thu, 15 Feb 2024 09:56:22 -0500 (EST) Received: from smtpin22.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 93B2DC060F for ; Thu, 15 Feb 2024 14:56:22 +0000 (UTC) X-FDA: 81794339004.22.7FB563B Received: from mail-ej1-f48.google.com (mail-ej1-f48.google.com [209.85.218.48]) by imf27.hostedemail.com (Postfix) with ESMTP id AE7CD4001D for ; Thu, 15 Feb 2024 14:56:20 +0000 (UTC) Authentication-Results: imf27.hostedemail.com; dkim=pass header.d=ionos.com header.s=google header.b=E1lV30+T; spf=pass (imf27.hostedemail.com: domain of max.kellermann@ionos.com designates 209.85.218.48 as permitted sender) smtp.mailfrom=max.kellermann@ionos.com; dmarc=pass (policy=quarantine) header.from=ionos.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1708008980; 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=pAAfduKncyIlO7bGb0H7B4KC/vDoZlMcbrTq+YqBvns=; b=Ej9vRO6yHDplmnMM49ZHOB7rfWlrgdQ5wfg8EIc8mXMic+hKJHVafv8ZYvAb2l7c0mUfkk 7JkJW6zso7/doc2gam7qjV1oZHF4Ycv4SF8q26cMVCc00ThB+ymBfwkGXY+GHFaavs/Jet PmIbmz8S32GuELB/3SJCbv1328C25J8= ARC-Authentication-Results: i=1; imf27.hostedemail.com; dkim=pass header.d=ionos.com header.s=google header.b=E1lV30+T; spf=pass (imf27.hostedemail.com: domain of max.kellermann@ionos.com designates 209.85.218.48 as permitted sender) smtp.mailfrom=max.kellermann@ionos.com; dmarc=pass (policy=quarantine) header.from=ionos.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1708008980; a=rsa-sha256; cv=none; b=eAO4NC/0NBGuBTnKK7OocpBMueh/fPuHaTOqaDi4kmLPmMjcRDnaDxUGAdK5CmdxS8cQZP X3DmGwfpc9cAeQyFxesNIVqCaV+4X3xaJDug7PjGv+DiV9Zws/3xzzY27JFrTOlOevyang rOTIQV0ARypHU1OKHpwsQjZUpwyw/0w= Received: by mail-ej1-f48.google.com with SMTP id a640c23a62f3a-a2d7e2e7fe0so184995266b.1 for ; Thu, 15 Feb 2024 06:56:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ionos.com; s=google; t=1708008979; x=1708613779; 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=pAAfduKncyIlO7bGb0H7B4KC/vDoZlMcbrTq+YqBvns=; b=E1lV30+TlJnMPsudGKKZDLgec6+laGjTRU63f+BxdNehwDHjTcMjjulLdGYDlEFYLJ Ew24i8lNb+tslXE7vSYi8Pj8bBOwzIfVQzu5WUi1+dhNHmxiJopu7miDQTJAcWfuyRBJ wR8ard7X4rAo2hwH058OyRs2p4gps6p3f4Phf/LqIBnN5D1LcQQvvBKAdy3qu7bXcJFv d8f4AOsToapXKQSpNlxUqnhE/0CUh+IOjRS8eeTiSztstoycrhuVlhpbhLTlJ5ls7TXG qQ4b8uHpClJG1fQdUnqMk9NTWvsMihsLccRubGUDZnEyW2nrGIkVcGteHpgAJgp65eJo 2A8Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708008979; x=1708613779; 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=pAAfduKncyIlO7bGb0H7B4KC/vDoZlMcbrTq+YqBvns=; b=hW9Kx69qU3GoLIT96ruvuhuJqDVUeojXGaKWoerHyGrpGHZWa8huA5HznCqTtgKEO6 E/7uKy0U3j4pKbSE9iTAwtfRZ4tXr+luD93hklcHKw3M1Ha4iA3ETDIogO4B0mqRTcS9 DqXC+34nHGu6C7A33cRdfG2kljv5X0xtT9mx7zMTtxRWBZUJ13XQAr1oU7vrGWjxTnoz nmfy61t4bze4eBvItLClrKBTrBCOWlYVgmA6DgSvWT1mUFmkRE6ls466eAhpUKGZaVlR TfrBHRNkz5tJ5wScKNL9GCQ0lnbrlI+DeVSIapcNfVSwd6QAm/8seuawO8JHGqFjzSpp R8rg== X-Forwarded-Encrypted: i=1; AJvYcCWUrb8n2x8x3oRH0i0eR7u8QYyM2Z7BkIRoxsMUZP8KFLCH7gK5qkCKACs3DE6tz78zzOUta4veJ6wTDgsF8F+6fgE= X-Gm-Message-State: AOJu0YwnzeKYwX7hoMrW6whwo36msvQj3uacQkgVemGCLA3rOLOQ1Y8K mxRe/6hguAbTfFxp0Osb9rdyLP8YEEZT2iIzoyGeGXcKRsEXPLMs4odP5gvgJmXip0cqdXBy8ud T X-Google-Smtp-Source: AGHT+IGigQj7ZTNu10ittsrAOmrJ2ArDckgllGOZzKGW4cyupgYSflwee8ZSNNYlHtvPBt42rJjGYg== X-Received: by 2002:a17:906:3e11:b0:a3c:2c8e:9030 with SMTP id k17-20020a1709063e1100b00a3c2c8e9030mr4707897eji.6.1708008979244; Thu, 15 Feb 2024 06:56:19 -0800 (PST) Received: from raven.intern.cm-ag (p200300dc6f267100023064fffe740809.dip0.t-ipconnect.de. [2003:dc:6f26:7100:230:64ff:fe74:809]) by smtp.gmail.com with ESMTPSA id s18-20020a170906169200b00a3d1897ab68sm631175ejd.113.2024.02.15.06.56.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Feb 2024 06:56:19 -0800 (PST) From: Max Kellermann To: akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: Max Kellermann Subject: [PATCH v1 09/14] linux/mm.h: move usage count functions to mm/page_usage.h Date: Thu, 15 Feb 2024 15:55:57 +0100 Message-Id: <20240215145602.1371274-10-max.kellermann@ionos.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240215145602.1371274-1-max.kellermann@ionos.com> References: <20240215145602.1371274-1-max.kellermann@ionos.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: AE7CD4001D X-Rspam-User: X-Stat-Signature: rab6pf6jfg5zea9caoyp58b54c8qgsir X-Rspamd-Server: rspam01 X-HE-Tag: 1708008980-202860 X-HE-Meta: U2FsdGVkX1+RczGMSPYsyWZZ/KWF8gNdl6nSI8Iw9Igwk+S/24Vc4fcWi3HcLpKsL5sETGPp4eAaynAs3LmyjU4bY46x42UMgw2BN5ZhjBxL2zUADOOUcJbHo2LP1mtoF/BfvrwlLrrJC++clTZlMGhoyurkGYONlzYZ+R4Bzc+MrsU7Olr+opy5OM2uL68tYfwHxdtz+lsxYEjyljm5vlO9l7o8DxnkX4b2IsTTr7kEee7bM+1qneZv2+BLsrqY4ubhoi8JS6lqxbfNWwJ3cJ5hV0LI93D1PCk0NncyY0Obl0+3uhAWwr/BoYOlnjiD31MGOrrjkfUdJQNRxpqf3MPv/enMCFHzSwUavY1+uxG5i25AG3el0uFEaYEvqHvfRTGTbrm3HqC/LFMqLCr2t9x2Bd/veyxs+gcX84wQWR3ZeJu8mnh5OuAu7LRCzRoUsE5D9yT3d/k0PPX/34Hr9JHVkeJAL/FmG2JIt9aLxqyfy90j7T7Dtf+UTb8yVbYUdTEJMJEvGL3hF+Dh86fHMEEDJrM6exxwI6WibOQ1QInc9zQKqOxMszKX0HOtbkrIGl1ZOQi81mTcgXigB+MkFEJeNxiQ+PSOhEWx/GBt/hL4NaUROpOjqZln/HBAtPo06rzAYJknD78+Y2iV139o2MEcLhPlZslMi50st5kYFOERJFiLYhKVsGP8fvvZk+RU9mXswoAAeuqmnzhJoycmAEFlstR/QVZHTXXI/2AErFJNR3uXnAULOPErvKyf8o9ev3QIfjWR9YQoypXsqfErjU1B9ezHQuU+9OHhfMabUEvzhcmuW3bvYLC+iVhwscWLuywRK9NgdGqxdfaYYqfqAuiamUGqhOkUtW1ywWORpnnPmyY7vq8B0HSVft5cworo+TXiAYU16KHs/rbZqx7t4g9USDlIttrgIN54qvBW3MKWjv2IeWr1DE4UVrjXtgvgw9zuMY+FjjmGS6CY1W5 IPwvmHlY EHz9oi55AcIQeIrPg/a0//fcqK6LRVW2lHWAgwcnlgM1+zGI/V1u9AnQ7dVs1dmkPfnxIL0jTqrWGpDxHYKa85u+DIdLMUy6LlnepfU9PmkMD+r/NT4xTWJzTq9YLSlKgp7ffsxi9T6PqReb4kk30LISWiPk1VBkJ4mLW0eMMFY4198bCQpRs9w1vmBKmwBJo0KaRLnPHUZpAPhMfdMaR4SLO8TC727luEFz1PfnQrAxs8ao/mNSVM/0ezZMJ8bAZlHrL78MUaIu4xE+BLycZ5yKxSD9sNmatkbeuIYONG5yO5Rx3KOumKTP5t1GJMz1esKp/feuaPFVqqXTg2pB9h9O3DFv4NRPgZrz76bnX7WTfxTF5TRkCmuodSKoIGZnNw1k6j/nIfIxHT4ruRVbo6BltZvjwNxeRZg5ePutqMjuX//I= 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 in linux/mm.h. Signed-off-by: Max Kellermann --- include/linux/mm.h | 168 +------------------------------- include/linux/mm/page_usage.h | 177 ++++++++++++++++++++++++++++++++++ 2 files changed, 178 insertions(+), 167 deletions(-) create mode 100644 include/linux/mm/page_usage.h diff --git a/include/linux/mm.h b/include/linux/mm.h index cb2dd71e2940..26d506ed855f 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -6,6 +6,7 @@ #include #include #include +#include #include #include #include @@ -1053,51 +1054,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 { @@ -1253,8 +1209,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); @@ -1345,126 +1299,6 @@ vm_fault_t finish_fault(struct vm_fault *vmf); * back into memory. */ -/* 127: arbitrary random number, small enough to assemble well */ -#define folio_ref_zero_or_close_to_overflow(folio) \ - ((unsigned int) folio_ref_count(folio) + 127u <= 127u) - -/** - * folio_get - Increment the reference count on a folio. - * @folio: The folio. - * - * Context: May be called in any context, as long as you know that - * you have a refcount on the folio. If you do not already have one, - * folio_try_get() may be the right interface for you to use. - */ -static inline void folio_get(struct folio *folio) -{ - VM_BUG_ON_FOLIO(folio_ref_zero_or_close_to_overflow(folio), folio); - folio_ref_inc(folio); -} - -static inline void get_page(struct page *page) -{ - folio_get(page_folio(page)); -} - -static inline __must_check bool try_get_page(struct page *page) -{ - page = compound_head(page); - if (WARN_ON_ONCE(page_ref_count(page) <= 0)) - return false; - page_ref_inc(page); - return true; -} - -/** - * folio_put - Decrement the reference count on a folio. - * @folio: The folio. - * - * If the folio's reference count reaches zero, the memory will be - * released back to the page allocator and may be used by another - * allocation immediately. Do not access the memory or the struct folio - * after calling folio_put() unless you can be sure that it wasn't the - * last reference. - * - * Context: May be called in process or interrupt context, but not in NMI - * context. May be called while holding a spinlock. - */ -static inline void folio_put(struct folio *folio) -{ - if (folio_put_testzero(folio)) - __folio_put(folio); -} - -/** - * folio_put_refs - Reduce the reference count on a folio. - * @folio: The folio. - * @refs: The amount to subtract from the folio's reference count. - * - * If the folio's reference count reaches zero, the memory will be - * released back to the page allocator and may be used by another - * allocation immediately. Do not access the memory or the struct folio - * after calling folio_put_refs() unless you can be sure that these weren't - * the last references. - * - * Context: May be called in process or interrupt context, but not in NMI - * context. May be called while holding a spinlock. - */ -static inline void folio_put_refs(struct folio *folio, int refs) -{ - if (folio_ref_sub_and_test(folio, refs)) - __folio_put(folio); -} - -/* - * union release_pages_arg - an array of pages or folios - * - * release_pages() releases a simple array of multiple pages, and - * accepts various different forms of said page array: either - * a regular old boring array of pages, an array of folios, or - * an array of encoded page pointers. - * - * The transparent union syntax for this kind of "any of these - * argument types" is all kinds of ugly, so look away. - */ -typedef union { - struct page **pages; - struct folio **folios; - struct encoded_page **encoded_pages; -} release_pages_arg __attribute__ ((__transparent_union__)); - -void release_pages(release_pages_arg, int nr); - -/** - * folios_put - Decrement the reference count on an array of folios. - * @folios: The folios. - * @nr: How many folios there are. - * - * Like folio_put(), but for an array of folios. This is more efficient - * than writing the loop yourself as it will optimise the locks which - * need to be taken if the folios are freed. - * - * Context: May be called in process or interrupt context, but not in NMI - * context. May be called while holding a spinlock. - */ -static inline void folios_put(struct folio **folios, unsigned int nr) -{ - release_pages(folios, nr); -} - -static inline void put_page(struct page *page) -{ - struct folio *folio = page_folio(page); - - /* - * For some devmap managed pages we need to catch refcount transition - * from 2 to 1: - */ - if (put_devmap_managed_page(&folio->page)) - return; - folio_put(folio); -} - /* * GUP_PIN_COUNTING_BIAS, and the associated functions that use it, overload * the page's refcount so that two separate items are tracked: the original page diff --git a/include/linux/mm/page_usage.h b/include/linux/mm/page_usage.h new file mode 100644 index 000000000000..53015e28b5df --- /dev/null +++ b/include/linux/mm/page_usage.h @@ -0,0 +1,177 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef _LINUX_MM_PAGE_USAGE_H +#define _LINUX_MM_PAGE_USAGE_H + +#include // for put_devmap_managed_page() +#include // for VM_BUG_ON_PAGE() +#include // for struct folio +#include + +/* + * Methods to modify the page usage count. + * + * What counts for a page usage: + * - cache mapping (page->mapping) + * - private data (page->private) + * - page mapped in a task's page tables, each mapping + * is counted separately + * + * Also, many kernel routines increase the page count before a critical + * routine so they can be sure the page doesn't go away from under them. + */ + +/* + * Drop a ref, return true if the refcount fell to zero (the page has no users) + */ +static inline int put_page_testzero(struct page *page) +{ + VM_BUG_ON_PAGE(page_ref_count(page) == 0, page); + return page_ref_dec_and_test(page); +} + +static inline int folio_put_testzero(struct folio *folio) +{ + return put_page_testzero(&folio->page); +} + +/* + * Try to grab a ref unless the page has a refcount of zero, return false if + * that is the case. + * This can be called when MMU is off so it must not access + * any of the virtual mappings. + */ +static inline bool get_page_unless_zero(struct page *page) +{ + return page_ref_add_unless(page, 1, 0); +} + +static inline struct folio *folio_get_nontail_page(struct page *page) +{ + if (unlikely(!get_page_unless_zero(page))) + return NULL; + return (struct folio *)page; +} + +void __folio_put(struct folio *folio); + +/* 127: arbitrary random number, small enough to assemble well */ +#define folio_ref_zero_or_close_to_overflow(folio) \ + ((unsigned int) folio_ref_count(folio) + 127u <= 127u) + +/** + * folio_get - Increment the reference count on a folio. + * @folio: The folio. + * + * Context: May be called in any context, as long as you know that + * you have a refcount on the folio. If you do not already have one, + * folio_try_get() may be the right interface for you to use. + */ +static inline void folio_get(struct folio *folio) +{ + VM_BUG_ON_FOLIO(folio_ref_zero_or_close_to_overflow(folio), folio); + folio_ref_inc(folio); +} + +static inline void get_page(struct page *page) +{ + folio_get(page_folio(page)); +} + +static inline __must_check bool try_get_page(struct page *page) +{ + page = compound_head(page); + if (WARN_ON_ONCE(page_ref_count(page) <= 0)) + return false; + page_ref_inc(page); + return true; +} + +/** + * folio_put - Decrement the reference count on a folio. + * @folio: The folio. + * + * If the folio's reference count reaches zero, the memory will be + * released back to the page allocator and may be used by another + * allocation immediately. Do not access the memory or the struct folio + * after calling folio_put() unless you can be sure that it wasn't the + * last reference. + * + * Context: May be called in process or interrupt context, but not in NMI + * context. May be called while holding a spinlock. + */ +static inline void folio_put(struct folio *folio) +{ + if (folio_put_testzero(folio)) + __folio_put(folio); +} + +/** + * folio_put_refs - Reduce the reference count on a folio. + * @folio: The folio. + * @refs: The amount to subtract from the folio's reference count. + * + * If the folio's reference count reaches zero, the memory will be + * released back to the page allocator and may be used by another + * allocation immediately. Do not access the memory or the struct folio + * after calling folio_put_refs() unless you can be sure that these weren't + * the last references. + * + * Context: May be called in process or interrupt context, but not in NMI + * context. May be called while holding a spinlock. + */ +static inline void folio_put_refs(struct folio *folio, int refs) +{ + if (folio_ref_sub_and_test(folio, refs)) + __folio_put(folio); +} + +/* + * union release_pages_arg - an array of pages or folios + * + * release_pages() releases a simple array of multiple pages, and + * accepts various different forms of said page array: either + * a regular old boring array of pages, an array of folios, or + * an array of encoded page pointers. + * + * The transparent union syntax for this kind of "any of these + * argument types" is all kinds of ugly, so look away. + */ +typedef union { + struct page **pages; + struct folio **folios; + struct encoded_page **encoded_pages; +} release_pages_arg __attribute__ ((__transparent_union__)); + +void release_pages(release_pages_arg, int nr); + +/** + * folios_put - Decrement the reference count on an array of folios. + * @folios: The folios. + * @nr: How many folios there are. + * + * Like folio_put(), but for an array of folios. This is more efficient + * than writing the loop yourself as it will optimise the locks which + * need to be taken if the folios are freed. + * + * Context: May be called in process or interrupt context, but not in NMI + * context. May be called while holding a spinlock. + */ +static inline void folios_put(struct folio **folios, unsigned int nr) +{ + release_pages(folios, nr); +} + +static inline void put_page(struct page *page) +{ + struct folio *folio = page_folio(page); + + /* + * For some devmap managed pages we need to catch refcount transition + * from 2 to 1: + */ + if (put_devmap_managed_page(&folio->page)) + return; + folio_put(folio); +} + +#endif /* _LINUX_MM_PAGE_USAGE_H */ From patchwork Thu Feb 15 14:55:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Max Kellermann X-Patchwork-Id: 13558590 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 09E35C48BC4 for ; Thu, 15 Feb 2024 14:56:43 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B794C8D002A; Thu, 15 Feb 2024 09:56:23 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id B00F48D0029; Thu, 15 Feb 2024 09:56:23 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 901828D002A; Thu, 15 Feb 2024 09:56:23 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 77D398D0029 for ; Thu, 15 Feb 2024 09:56:23 -0500 (EST) Received: from smtpin11.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 579DEA2900 for ; Thu, 15 Feb 2024 14:56:23 +0000 (UTC) X-FDA: 81794339046.11.DF283D1 Received: from mail-ej1-f47.google.com (mail-ej1-f47.google.com [209.85.218.47]) by imf27.hostedemail.com (Postfix) with ESMTP id 7361B40024 for ; Thu, 15 Feb 2024 14:56:21 +0000 (UTC) Authentication-Results: imf27.hostedemail.com; dkim=pass header.d=ionos.com header.s=google header.b=WwFbhUK6; dmarc=pass (policy=quarantine) header.from=ionos.com; spf=pass (imf27.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=1708008981; 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=eKsp875PnvJuIa0s07e10KRuMSwJl/UB/2fWYWucGxo=; b=VhlZVdkmr1a0pmysjIR5tm7IdEgXPqMURwb7wLIsb29WG4ScEAWUjS6q4eSijSYaIMmGp+ R/Q/pl9bJ1KgU5GEUEn6oSUUKabySQhFgoeawo9ccdSrnlk7B/UcP8pOmPWw/1LJ0TjXWV Ozy//Gf40E+Abocg6TVXuU4xz3uLsO0= ARC-Authentication-Results: i=1; imf27.hostedemail.com; dkim=pass header.d=ionos.com header.s=google header.b=WwFbhUK6; dmarc=pass (policy=quarantine) header.from=ionos.com; spf=pass (imf27.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=1708008981; a=rsa-sha256; cv=none; b=DrkLoHjRVFeTmSebAVRWM6KR7Nrey+cX34ZCy3Qt9rCpgMZgDxU1JTpPwQlkpzvolniQUG A6wPT59ARSRjRns0dYt9Hnu/gMR0HlRXcS7bxtBBKsze1gz2/CEjgq3O8fgvl02NJUe80k wtAtggroBrV6bjaaChp36cjrFXaWl1A= Received: by mail-ej1-f47.google.com with SMTP id a640c23a62f3a-a3db0b8b313so39409166b.0 for ; Thu, 15 Feb 2024 06:56:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ionos.com; s=google; t=1708008980; x=1708613780; 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=eKsp875PnvJuIa0s07e10KRuMSwJl/UB/2fWYWucGxo=; b=WwFbhUK69kiUr01ZVM9VN4ZINJ+sl3GL6wFZ1qSt9FLlJLGSSSQ2VXWcqMcX/lyCDv tcSTbLuwmOsmYqtCvIgm2v2ZHkbfhL/kEIahoAxRdZ+Cig++N7ovraMvPmnZ3kWbazai yp+IZ/CyI1Ft7sEUcB2sOzrQktCYoeZnX+D7kxxQNTYgBA3LEMzwpJWnUux4QrxvDnHb th7yX5YUT1iOjbcfiY/k4De9wK75J633ZBVWnwHo4J4EFxfz8UtRtE2CypV+ZTdUI7Ke 6UWqmDBaDauJMZUODsZ6WyHK3RtvKwB6PTlEcFKNFYlgmmzIKr+fv4mHa0184z6bmEvo eFEA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708008980; x=1708613780; 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=eKsp875PnvJuIa0s07e10KRuMSwJl/UB/2fWYWucGxo=; b=i+COJXpJn/IW05HGfT+9UMj2zzD82cPSE7sKIyTEvZ2kTTqgelmzd7VfHUBYWqUU72 IYi39sbQe/vjsv51pAIDu+DtvYwup4phO3UVf5LL9C3yN6YGuJTGGsQmlufeSwMdqHVN A99zC521PyHfKo1FV7pv5xuQvPgGreCsNhoSOeqKYUYrPpS6FZaM9e8qs4lmXPboRQXL uYz8drmXAqVaJ+8PYa4k7rYTb1p2gVHFSAzpGTBUrLNqRz33u+fQLgVuQjTtpfSwt+11 amR9gZffqK9lxC2r146tDd5DPMsrQQcPJDDSOVN+SH/xGyiNe5LzasV1uy7IeZfUUaJf dJjQ== X-Forwarded-Encrypted: i=1; AJvYcCU6jEtpJ9PsSijzxjkouyiVtnGP5O5R9Kohvj9Q+7e9SUbkJkBenrLyvT4T3eMwAnXs2e4G/06LzGcJ8m44oa7xe38= X-Gm-Message-State: AOJu0YxMaWv/VV/iSBieneKC3yjjOiav+EqzlTNYHyeuSC49eWYZpvhy mfzAJgqDUV9Ry5xBqcJ7DsCAcdAG0ZRhJu19EfGbgHxjVMGvapRE0dHptGnR+ug= X-Google-Smtp-Source: AGHT+IH5yGTXkkYLGBHGfcaxHapm+uOnyxEcWP/yZTJOKq1Do5sZaLON8Um9ALDtXnu5fhpKYHSzQg== X-Received: by 2002:a17:906:34cd:b0:a3d:b317:8ac9 with SMTP id h13-20020a17090634cd00b00a3db3178ac9mr499801ejb.33.1708008980212; Thu, 15 Feb 2024 06:56:20 -0800 (PST) Received: from raven.intern.cm-ag (p200300dc6f267100023064fffe740809.dip0.t-ipconnect.de. [2003:dc:6f26:7100:230:64ff:fe74:809]) by smtp.gmail.com with ESMTPSA id s18-20020a170906169200b00a3d1897ab68sm631175ejd.113.2024.02.15.06.56.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Feb 2024 06:56:19 -0800 (PST) From: Max Kellermann To: akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: Max Kellermann Subject: [PATCH v1 10/14] linux/mm.h: move page_zone_id() and more to mm/page_zone.h Date: Thu, 15 Feb 2024 15:55:58 +0100 Message-Id: <20240215145602.1371274-11-max.kellermann@ionos.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240215145602.1371274-1-max.kellermann@ionos.com> References: <20240215145602.1371274-1-max.kellermann@ionos.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: 7361B40024 X-Rspam-User: X-Rspamd-Server: rspam05 X-Stat-Signature: mmzh9isu3dptjido831oftkrcf8hmuxs X-HE-Tag: 1708008981-2476 X-HE-Meta: U2FsdGVkX1/FRaonN7H29V3p5b5auGayAZWwmCGOgSdskHRYZMgn1NwUYFqT9sFwkVBhuWNxkSRhe+0T9gHl2Dwu/Uy705+ZA6Zy1C+FiltZuzTyl84xhVETZPer1jDHBu5mkxP2I1UY5kjAh/Beaml/tpLGAm0/ULI++ffrp3mDdGrwq2gzhs4/2dwrUbFnayr0oAjtnXdKL7v4YXh/rajFpzlzOx8SC+4tyY05cxs/nycOg5Xmhwe5Smiotr5wrlPguVsc0xhoP/5B/10d1QneeVBO282tOqIhoN3XiiFP567+Yi7J9YiQO/5ZIkfjU+mUl8WRuB20H8dNAxu9kmKshtQCMayGl63pOozmBzbTINX7YcTPsi3LQtKHAwxVuT1fdwvR5zG+r+kHJu0Cr1s7lKFi7+bx/3wIuTf++cimY1/FfXBMJDZfI+sKP4AYv5KJqI/tQlNwEbrwmY4GFgiTlv3YnijJ/mYDvlGvHfcpGV9bihGYm7Z7dtS8ZKQWwcc27hZfd0dkoJ2S9QmLkaHhn9i1ZrGdJRzc1QDQk3s0SHKGU8TAGhO2kCF+Of4GerprGlwPwHgjTHl8uWgGDFS/5iAT+Nj4cc2+SFB2o1JDgoaKNUS2+63OStbPTowuYOTavn3IldLgyoWPSc6Pi1f3XBJDLnMGiEnCd0aPcr0NH5dCKP6BPhZcl2LyO9FKpvPIZnHQYe42pFHQ3iij7TTbgu61Wyb967ieE/JbAfyhxp0y6iMYY4NzdXiQTV7tpr1BZk+q/ABjCCZDz4erDPLawsXh2vbdG4ijU1/sxgfgQGr+v/xWVVJazUMZHV2iDDJrH5SG/bYs4WTg4SHG2WSrW3i0Xzu6xYpcxtXCFzAh6ZS00t56khq5R1XmJFoHQbpr59wlDObfT7cghjL0iD7F4Az3FsuA09XYBV7pmeA5d5FZD9nUE+8r0bhgNmhSMyiP5XWmS7t9sQYAWPA z3lf3uBJ 51TGvh2mJoJzcuKaNdBnd5+qUIZNq7dDOqF8s5Jg+vXSe7JTjKM/4wKirnvhqT05DKoAfVRAwH0DHu0OFtaC367J/RSl9cgReuLu5iBCzGqD6esB+YGFUe3WIACK2WixkNxb4ApTUg6YL3FiIC4pSqXVLiR1YsJ8IVChb7ABWNJ3wtS8oQRF2w2AoOE/xkNZh8sV8yboB2UfUzgl3AA/QP2S+iHq6EXgO/THFaTe5hIKEv7e2oNOasRz+2WJV6CFAHzw1nh3GynE41X2KdNZuf8iMny7GD8W+cRSefTJfNwF/P1SoyLF+xAsG8jmWLF1S1P41Ci5UPxixrSosq37FlEn41TrZwNxm5ZK6doRrggjgOvVukYeNqWVntp5IscPeQpAHyEAhzNOAeo8qFK8NaUsMDeM9zsjlF1dhbYrk3Mq1IVXsRXTkVGS4LWnXtECGNgqCTKCbWs72H7z2yEpzSNiUVA== X-Bogosity: Ham, tests=bogofilter, spamicity=0.001372, 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 in linux/mm.h. Signed-off-by: Max Kellermann --- include/linux/mm.h | 30 +--------------------------- include/linux/mm/page_zone.h | 38 ++++++++++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+), 29 deletions(-) create mode 100644 include/linux/mm/page_zone.h diff --git a/include/linux/mm.h b/include/linux/mm.h index 26d506ed855f..aa24e6fed9b6 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -7,6 +7,7 @@ #include #include #include +#include #include #include #include @@ -1358,35 +1359,6 @@ static inline bool is_nommu_shared_mapping(vm_flags_t flags) } #endif -/* - * The identification function is mainly used by the buddy allocator for - * determining if two pages could be buddies. We are not really identifying - * the zone since we could be using the section number id if we do not have - * node id available in page flags. - * We only guarantee that it will return the same value for two combinable - * pages in a zone. - */ -static inline int page_zone_id(struct page *page) -{ - return (page->flags >> ZONEID_PGSHIFT) & ZONEID_MASK; -} - -#ifdef NODE_NOT_IN_PAGE_FLAGS -extern int page_to_nid(const struct page *page); -#else -static inline int page_to_nid(const struct page *page) -{ - struct page *p = (struct page *)page; - - return (PF_POISONED_CHECK(p)->flags >> NODES_PGSHIFT) & NODES_MASK; -} -#endif - -static inline int folio_nid(const struct folio *folio) -{ - return page_to_nid(&folio->page); -} - #ifdef CONFIG_NUMA_BALANCING /* page access time bits needs to hold at least 4 seconds */ #define PAGE_ACCESS_TIME_MIN_BITS 12 diff --git a/include/linux/mm/page_zone.h b/include/linux/mm/page_zone.h new file mode 100644 index 000000000000..6bbd46743aeb --- /dev/null +++ b/include/linux/mm/page_zone.h @@ -0,0 +1,38 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef _LINUX_MM_PAGE_ZONE_H +#define _LINUX_MM_PAGE_ZONE_H + +#include // for struct page, struct folio +#include // for ZONEID_*, NODES_* +#include // for PF_POISONED_CHECK() + +/* + * The identification function is mainly used by the buddy allocator for + * determining if two pages could be buddies. We are not really identifying + * the zone since we could be using the section number id if we do not have + * node id available in page flags. + * We only guarantee that it will return the same value for two combinable + * pages in a zone. + */ +static inline int page_zone_id(struct page *page) +{ + return (page->flags >> ZONEID_PGSHIFT) & ZONEID_MASK; +} + +#ifdef NODE_NOT_IN_PAGE_FLAGS +extern int page_to_nid(const struct page *page); +#else +static inline int page_to_nid(const struct page *page) +{ + struct page *p = (struct page *)page; + + return (PF_POISONED_CHECK(p)->flags >> NODES_PGSHIFT) & NODES_MASK; +} +#endif + +static inline int folio_nid(const struct folio *folio) +{ + return page_to_nid(&folio->page); +} + +#endif /* _LINUX_MM_PAGE_ZONE_H */ From patchwork Thu Feb 15 14:55:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Max Kellermann X-Patchwork-Id: 13558592 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 AA622C4829E for ; Thu, 15 Feb 2024 14:56:48 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E0D926B0082; Thu, 15 Feb 2024 09:56:26 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id D961F6B0098; Thu, 15 Feb 2024 09:56:26 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9EB486B0082; Thu, 15 Feb 2024 09:56:26 -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 7ACB56B0082 for ; Thu, 15 Feb 2024 09:56:26 -0500 (EST) Received: from smtpin20.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 461311402BF for ; Thu, 15 Feb 2024 14:56:26 +0000 (UTC) X-FDA: 81794339172.20.28646C1 Received: from mail-ej1-f50.google.com (mail-ej1-f50.google.com [209.85.218.50]) by imf10.hostedemail.com (Postfix) with ESMTP id 4FD97C0021 for ; Thu, 15 Feb 2024 14:56:23 +0000 (UTC) Authentication-Results: imf10.hostedemail.com; dkim=pass header.d=ionos.com header.s=google header.b=f7E3Q8mF; spf=pass (imf10.hostedemail.com: domain of max.kellermann@ionos.com designates 209.85.218.50 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=1708008983; 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=Ui87eR1N8KdYrsRAWgwlBy5zGHV5S5KAP6ANHsd3+6c=; b=erudhZjsyCeGek7rcySP79/dK6FOW6RjZhBZpdRFA/IJMwNVeIst6Wg9YbisfjUe8spCmr jCgy3Y5G/lJsjXdpiOAozCrdIZpM0ShFiJxDVPO6cf3m/XvDaqn6TC7q5CDt/N8KoVSFZf aa3TR1ERCCJM8UOS+Uy042teZUVKlGs= ARC-Authentication-Results: i=1; imf10.hostedemail.com; dkim=pass header.d=ionos.com header.s=google header.b=f7E3Q8mF; spf=pass (imf10.hostedemail.com: domain of max.kellermann@ionos.com designates 209.85.218.50 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=1708008983; a=rsa-sha256; cv=none; b=ZP1yCHg+JGABKAmo0xxn8Q4EYlyfaaotg695mZV7pYvlH/T7HoFZILudRxvGiosyr/1ILd A3flJODBPS9i8rp/fAMKUEnIjXcNW6kg6FPpQPhEdSreCWozu9EJ+bD/bM8hkUpHBieTNw S6U6fMlCq+f6/SFElNa99XOFP1RNVbE= Received: by mail-ej1-f50.google.com with SMTP id a640c23a62f3a-a3d5e77cfbeso177505966b.0 for ; Thu, 15 Feb 2024 06:56:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ionos.com; s=google; t=1708008982; x=1708613782; 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=Ui87eR1N8KdYrsRAWgwlBy5zGHV5S5KAP6ANHsd3+6c=; b=f7E3Q8mFDswnDfM7jY1aFgn3rzGcm0cvlDX4MYRyeK/1lR2ikpFIItp7i00GahyeLN 1HFklD5Jh1TKLv2pQNNOVBtyHq+7FLwZudwAXtWETpQoCKkiQ+rp6YY/fmfArSahUk/j 5dvFlc0/AFvTuyM3rnVscIayfKxdZUgQo86Q7TEtw1faUFLKy4SpH2jiRFOfd8QXGso+ VEsYjeoMBC1h0c5KZryf/fssXoYWLEjFJOf3bLTnWShcO5CK27LkuMCtQCsNu3T3YBSI L91bG3/fETPGLrFSn3GHlnYQdYC+kGg1CWs1ubWCa1fX9IPPKUm9bGEEZLZ7OZzAw9qv KnpA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708008982; x=1708613782; 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=Ui87eR1N8KdYrsRAWgwlBy5zGHV5S5KAP6ANHsd3+6c=; b=OFR1TN5d12p6gA05l0ujPLR7i2JQbHvWUWGWPUj9Afq1PSyadI+qlcWLyrh4qkJFE8 a69WmuqbnO8txNNsdM/4FLZw0zK0beCHgt3r8Bh9NMMeQcJiSIyhvsPGGS9//FdHwU6K Sc56LpAX38j/ruDl7ZO/oP3rPKkgGebMn6d1RHq/gIqm0Cs2xI5W0pHurZKGRty3ciiD o18s9lu/d7jco154vB7dsHMbuhOzINafXolGbf/AQI3znYHiGs5ih6eYyIC/eu/Y6Y/x 5z40yoJ1OVWba/M2r9rosiz3/0vQtJ2jbl0fKA3YZAGtUgyMnhuqm6k1NBGXJRHUT5+d qFRw== X-Forwarded-Encrypted: i=1; AJvYcCVkM0ETSEWS9rBR3wBIhgYj2uiHrEiCLXSy2Tm8osjKIHq/s948uI8jDHUEjOg/hLVUAXaj1mQIDGDgE3693gnRDYI= X-Gm-Message-State: AOJu0Yyvt+NOkbMVWkNUr9PVTSOkIWRGZqC22XbivMBum4T//tb3ZHKm nWerQGOVrv5QX9NNNEfroNvQdaGetRqGnOzF6xjZLyXAaSvv/JMN3UMKDVZx5TLwTRh8qr6q43i h X-Google-Smtp-Source: AGHT+IHJPjSHl7B3baS+ulCtYjH6fSBlPEEmxM5P3E0Kdh/Ma+gFX7l5Bh2omHP9cArRkMUptWYd9w== X-Received: by 2002:a17:907:b0a:b0:a3c:ce90:bf4 with SMTP id h10-20020a1709070b0a00b00a3cce900bf4mr4128460ejl.14.1708008981990; Thu, 15 Feb 2024 06:56:21 -0800 (PST) Received: from raven.intern.cm-ag (p200300dc6f267100023064fffe740809.dip0.t-ipconnect.de. [2003:dc:6f26:7100:230:64ff:fe74:809]) by smtp.gmail.com with ESMTPSA id s18-20020a170906169200b00a3d1897ab68sm631175ejd.113.2024.02.15.06.56.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Feb 2024 06:56:20 -0800 (PST) From: Max Kellermann To: akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: Max Kellermann Subject: [PATCH v1 11/14] linux/mm.h: move pfmemalloc-related functions to pfmemalloc.h Date: Thu, 15 Feb 2024 15:55:59 +0100 Message-Id: <20240215145602.1371274-12-max.kellermann@ionos.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240215145602.1371274-1-max.kellermann@ionos.com> References: <20240215145602.1371274-1-max.kellermann@ionos.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: 4FD97C0021 X-Rspam-User: X-Stat-Signature: f66mwf4ea5h93din5nmfcuoqbknzmsjm X-Rspamd-Server: rspam01 X-HE-Tag: 1708008983-6707 X-HE-Meta: U2FsdGVkX1/jK6XPJG0jaCQAk+aLVk26jq7AQpvmFOeEWBvjJWoNUGT2ihDqfr+W2e5QFJEJZHCPrLNtn0JtA4PA7I40zImW2tMSsEkkx4LTRf5XLAq3TxgeOrx0EONre56Qwc+bKQOeZsXRIIP3vuxTC2xvBdZcIaIQEjr8LLpQqimJ0daLH8OFrSuIqoVgVQv/GSKWUPwkUSz24NBvVzS1KYpJUQm3MFyxDdYk9POApKFqgJMorH8HQxqipZaoj6rxniaAK3yAd7voojhwXYFJaSnUTSuD+JGCgaAEgsS2l3g2NT2Gv5KZL3wtl3TaYg8G9SwBebZJIRdFFfHapEQdIwz+FJavq8FuNvrxg4N0vFy3VKB5XHHfkKW+HWM1KlIY5vHZGzSG54ihDY/SmpTqbUkWwyFo56CvTKxLdCBJhyRxfY/yRbRUMrhiscmbFPXGEb9MZ8hIf0bCeawoPwiRrVeGZkUXpYpapO3yihnK+kep6w7mO5jrOerr7FSX5sK9SM8SYDQawkIr/zAyPiVB+5zs7qMJEocTZnGeUSd2yWg8aJ8Cutcn3r2BK7UUki5Z1pSNI0qQszAAYqpF2aGySszRfmWJ7bVQkRBBJ3UuuL5sKCCTZxfXSjT+hwi9ktmmfkP2XnkzQkE9lk64Doqq8H7fkJmSsz2MMaVTogsthweravXM36AjDrmAf9FLqvkUjmZzTfft7Y++HoIDUdpSSF677Yma4UdKf0LXo+9/Oau+9GUx3uktRQaoHH86g/UJWo3UsHTxiaJpzZdnbL4gr8XgjGzUeaYIbZD7eNEof25OkfdC+Zlh7fUXjtGcwjkCgTh+7GMeKXBcYppvllortckDam32zshoAeN4knHH1L6gAYmik6+cAW+SRpDv2TmtOmJ+9WLeZmDlEdAbjWo1F7vetaoRKxbuZTRgfVJNDWRGikK11DFHmR7o1sorAHnh/MoFoZtquASlWsb sJCGHWKG sv+09Gr+r48DD6iZ/+aVngc3t1+Gf16ZNogb5twFwgZ8Njo3iW31Usv4mU8LLOL4upFQpzKD7ZSY5phCK9Xgpt5wcTp9RHJMw5cpqx1HfwQYn+78Vjjh+KdPfUOlnhAM1EsF499TtNxG6IAPBYbHvvY3F6b1lw8G22QFT0NOJ7JNbypMcM2/UQRKPBNTO51TSzAb1B3L5n3ZcmvyxAcpxoCaMdrklsQsSZNhut9fgRyuU7MBuGqKNqfp7yjcW0iQvpwq7+01nsrQkY6D8vJ6POjFoKkUfxpBhyhpVBWNV0rbS4e6/cfxkgSGW1nO1cqiR8qYvttcBGnbWwqqh9thY98j19Scw3gjKPeJmKchBgsnzrNsTt2IUAJAXEl4+BgP5Wq55XVdG4wQK35fPa5ws4kq1cjTTbDr7tv7k X-Bogosity: Ham, tests=bogofilter, spamicity=0.000563, 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 in 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 aa24e6fed9b6..c7e53cd0cdd0 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -8,6 +8,7 @@ #include #include #include +#include #include #include #include @@ -1744,50 +1745,6 @@ static inline pgoff_t page_index(struct page *page) return page->index; } -/* - * Return true only if the page has been allocated with - * ALLOC_NO_WATERMARKS and the low watermark was not - * met implying that the system is under some pressure. - */ -static inline bool page_is_pfmemalloc(const struct page *page) -{ - /* - * lru.next has bit 1 set if the page is allocated from the - * pfmemalloc reserves. Callers may simply overwrite it if - * they do not need to preserve that information. - */ - return (uintptr_t)page->lru.next & BIT(1); -} - -/* - * Return true only if the folio has been allocated with - * ALLOC_NO_WATERMARKS and the low watermark was not - * met implying that the system is under some pressure. - */ -static inline bool folio_is_pfmemalloc(const struct folio *folio) -{ - /* - * lru.next has bit 1 set if the page is allocated from the - * pfmemalloc reserves. Callers may simply overwrite it if - * they do not need to preserve that information. - */ - return (uintptr_t)folio->lru.next & BIT(1); -} - -/* - * Only to be called by the page allocator on a freshly allocated - * page. - */ -static inline void set_page_pfmemalloc(struct page *page) -{ - page->lru.next = (void *)BIT(1); -} - -static inline void clear_page_pfmemalloc(struct page *page) -{ - page->lru.next = NULL; -} - /* * Can be called by the pagefault handler when it gets a VM_FAULT_OOM. */ diff --git a/include/linux/mm/pfmemalloc.h b/include/linux/mm/pfmemalloc.h new file mode 100644 index 000000000000..345b215a3566 --- /dev/null +++ b/include/linux/mm/pfmemalloc.h @@ -0,0 +1,52 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef _LINUX_MM_PFMEMALLOC_H +#define _LINUX_MM_PFMEMALLOC_H + +#include // for BIT() +#include // for struct page + +/* + * Return true only if the page has been allocated with + * ALLOC_NO_WATERMARKS and the low watermark was not + * met implying that the system is under some pressure. + */ +static inline bool page_is_pfmemalloc(const struct page *page) +{ + /* + * lru.next has bit 1 set if the page is allocated from the + * pfmemalloc reserves. Callers may simply overwrite it if + * they do not need to preserve that information. + */ + return (uintptr_t)page->lru.next & BIT(1); +} + +/* + * Return true only if the folio has been allocated with + * ALLOC_NO_WATERMARKS and the low watermark was not + * met implying that the system is under some pressure. + */ +static inline bool folio_is_pfmemalloc(const struct folio *folio) +{ + /* + * lru.next has bit 1 set if the page is allocated from the + * pfmemalloc reserves. Callers may simply overwrite it if + * they do not need to preserve that information. + */ + return (uintptr_t)folio->lru.next & BIT(1); +} + +/* + * Only to be called by the page allocator on a freshly allocated + * page. + */ +static inline void set_page_pfmemalloc(struct page *page) +{ + page->lru.next = (void *)BIT(1); +} + +static inline void clear_page_pfmemalloc(struct page *page) +{ + page->lru.next = NULL; +} + +#endif /* _LINUX_MM_PFMEMALLOC_H */ From patchwork Thu Feb 15 14:56:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Max Kellermann X-Patchwork-Id: 13558591 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 C6F54C48BEB for ; Thu, 15 Feb 2024 14:56:45 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 9EEA56B0096; Thu, 15 Feb 2024 09:56:26 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 976F18D0029; Thu, 15 Feb 2024 09:56:26 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 66BD16B0096; Thu, 15 Feb 2024 09:56:26 -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 49A346B0082 for ; Thu, 15 Feb 2024 09:56:26 -0500 (EST) Received: from smtpin16.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id EB08881129 for ; Thu, 15 Feb 2024 14:56:25 +0000 (UTC) X-FDA: 81794339130.16.ECFE4AD Received: from mail-ed1-f51.google.com (mail-ed1-f51.google.com [209.85.208.51]) by imf07.hostedemail.com (Postfix) with ESMTP id 0BEB340004 for ; Thu, 15 Feb 2024 14:56:23 +0000 (UTC) Authentication-Results: imf07.hostedemail.com; dkim=pass header.d=ionos.com header.s=google header.b=CTSGDkLc; spf=pass (imf07.hostedemail.com: domain of max.kellermann@ionos.com designates 209.85.208.51 as permitted sender) smtp.mailfrom=max.kellermann@ionos.com; dmarc=pass (policy=quarantine) header.from=ionos.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1708008984; 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=hDi3zk+Z/SLj4QVGPle17xDH/MSBW8emaxfc34uAZG8=; b=34dTzrhjhTx7rYooKG5lvTAODT6ZaM2ljnjN/E+CXcI6BPcVIJwZv7EPyvxboHXVPH+CQX OpvMe3JaikVY8Y+43mNdzsul/4avaqSBJpile9sXTMbARHdTNJ4ZC/+HHqCILNUJxvzQIl AxlbhNU7mzslkSy5XJY8LeSdKkkE4Bw= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1708008984; a=rsa-sha256; cv=none; b=o61tTn6Xyv9WhXPoTis2ta2cxjHiYpcRLSEA36KS5YGW8zRal4vEjvnFD7giWvmHWcFDl7 /41FEuY9LzZaBDasiMr/fyAHXr+4XVz4DO91tFgDnn+Sk+uo9z0c41tGYz4RuysW/6yMcR 3D3oH4vj1kmIX38+hbp6dv+P2UCLIyk= ARC-Authentication-Results: i=1; imf07.hostedemail.com; dkim=pass header.d=ionos.com header.s=google header.b=CTSGDkLc; spf=pass (imf07.hostedemail.com: domain of max.kellermann@ionos.com designates 209.85.208.51 as permitted sender) smtp.mailfrom=max.kellermann@ionos.com; dmarc=pass (policy=quarantine) header.from=ionos.com Received: by mail-ed1-f51.google.com with SMTP id 4fb4d7f45d1cf-55f50cf2021so1332245a12.1 for ; Thu, 15 Feb 2024 06:56:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ionos.com; s=google; t=1708008982; x=1708613782; 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=hDi3zk+Z/SLj4QVGPle17xDH/MSBW8emaxfc34uAZG8=; b=CTSGDkLcvZ6XSVVuXE7wPV4EpPs8xRN3xe3vLkdOAqOVldPqZD1nqt3XOWrPwWpoTx gqMph0V3xjXwF7qTVLUZMnvfUS0I83PP5nuQJU981n9CLDymbxpoqAM7izyANa8A8QmK SOBSxYq6P1+NA9n+V+lqJyQJMOgbPbR+ho3O6Sp+FJZAVt1DfVy44BywDv26AU+6tT0d 9lhIAWPEX84+fQPZIDwgWXqpvnjuQ0yjGKeO1a57Khp66ZWJtiGesQbCsSP4tf6R/m/q Q2cCLgNza8PHyAEkqf4Y/itBP3JYePFKQHCggr6r26L/yG4fvOKslASDH2Ypztlw28gP X4hA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708008982; x=1708613782; 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=hDi3zk+Z/SLj4QVGPle17xDH/MSBW8emaxfc34uAZG8=; b=RBl0mCkxVCAQUA149xo+SSrnl8nfj2mzTv6KC2TKq2mcQCS92RVji29IhksOoRVjdf Xtan1gow4L5llLRQr6jITZ3JO643ZL0tEBx26BlHhH3HG7Kz/UWEnMX++S1FTrj1AqbQ hZ+4OZzmYryFqAOsrLSWCAmdH3E+QGV04ykzQbgR9DlhKE78JxC3ZG5L94P49yT/e9sR ycDy2lwi9ZyXXCaIEy2OIpB4cwiLj0rHsNvjr9mLi2ZhhEjht55uSYHzq/ga+1B4Jz5a pZe+xVqCsgroD6Z+KM+bbvW1UZJofPLuaMgh43CsBkA7Z33iGS6w9NzQ5XUywLUZ1jqa QbaA== X-Forwarded-Encrypted: i=1; AJvYcCWJEqcIfTTk1vfshErMG9rdj9odPXa1H2TY3oYWrp3Dj+ocARXZzoP+5FvTXAILci7/FOvotmGg6XZiJpNIe+QABUE= X-Gm-Message-State: AOJu0YwaoSuGbkBudYuw4qZbUm3QvsiOlkZWVZStd3iNNdpBtcjfHGRG E9Y24YkY/J5hZyzHLc5dTDb7T3P4y2XLIlDchG/T8auMkf/WG56/RK6RVKlPkIigkKVl+QYCR5I a X-Google-Smtp-Source: AGHT+IHAlb4e+8QuGD96pMPeJzYEcSH4nQAFxO/d65uRfxVdzSpHyuiO6MW/gGgKn4n/0BbF5ikJnw== X-Received: by 2002:a17:906:5fc5:b0:a38:7171:e832 with SMTP id k5-20020a1709065fc500b00a387171e832mr1267787ejv.32.1708008982697; Thu, 15 Feb 2024 06:56:22 -0800 (PST) Received: from raven.intern.cm-ag (p200300dc6f267100023064fffe740809.dip0.t-ipconnect.de. [2003:dc:6f26:7100:230:64ff:fe74:809]) by smtp.gmail.com with ESMTPSA id s18-20020a170906169200b00a3d1897ab68sm631175ejd.113.2024.02.15.06.56.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Feb 2024 06:56:22 -0800 (PST) From: Max Kellermann To: akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: Max Kellermann Subject: [PATCH v1 12/14] linux/mm.h: move is_vmalloc_addr() to mm/vmalloc_addr.h Date: Thu, 15 Feb 2024 15:56:00 +0100 Message-Id: <20240215145602.1371274-13-max.kellermann@ionos.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240215145602.1371274-1-max.kellermann@ionos.com> References: <20240215145602.1371274-1-max.kellermann@ionos.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: 0BEB340004 X-Rspam-User: X-Stat-Signature: pkgae8zh9oo3pjemgo93ycro69kryspm X-Rspamd-Server: rspam03 X-HE-Tag: 1708008983-855924 X-HE-Meta: U2FsdGVkX1+zmb6Qx6b8OtjShJn85hkQvspipNNUd3r9L92AcRw3Xddq3j2uQUzcOBhMIBSCllB0ZCXxIVpCKbQN+kqaApOBZyPd3QflO/5AzXm+OdIoEz6uJBjBYa00xRY1nu+Ub3SHgrT5lb3S2pvaLwu/KON0TQNeNfKlHBQJis0oEAct1lCoA2sYniO+ycCDXBwW26R89nOcIft9QhlmbGcGzjS6A4vo5CS4eXLT/fjHRZU4K15Cv0R1+ymi0WP7VgmqGwZ9GxPe5NwGmIasRHDheYtBodxQ1vfQcK0tHLC9ZGsfGn+e4lfE0DTtJp6QSd4qexdUiB3yubuOa20NnFTbbeOFyZYRtIiSgqpXmSzK1Dtmzh/OxT2O1mh28AVtCC1otZg0CypOyRr4gNKE+TraXOWJ5ll9t6xM9q3v+I6ClWZXwYrcDpLntGpTliuvItFQfL5VkuhEb6WDPD82u7p1M5mpcJcIxnYplfO/D4cdov0/iq4qQ4BoaZilTy0JGXL5zs5afQWxMzomiwUoJJPtVLeXAftE+2dz/5OUDQXnOV5Dz0+Gk19mAntqjRs64Uv10VLpKeaYaxb/yzmJLnXv5NQMNxO/sKre54gOFAgqydhvnmgLhoX7fhdfipFM4E3lj0QvNvYYzEUak3b1XeKAv1EQELcvD9UvqRVS1l0vt6Lwab/JaiSQbJkVERoI86PMdXLAUd3B6X1v4X65vJ60pryJhJseDkJ3P3R29t0Eevo1E/eP+EqpiZhTaNnPxzvBB148MYorcXjRe4Hg+E6e6B0GUQWQaVbTYIKK0AYG0dzbsWsT7xeDKjUoBZqv9nD5x0Z5v1is7lA2OYKzfzTlInw4dM/x3ljb2ShPDUJLO1HHPprAj/LkcPA53SOgP+4Mf/U/v8pV3RB7Uj4CK8lPmKMayYojmO5jHSsZyowhno75T5OFmKLbfFhXWtCB9vZO2mXpscyzVK+ K+sjVSOo Z0wV1fUQAYJMDbGqgvyaouz0abP/BLNtDVToX1AgDmNU/BWg7RmPBEJ0gvdtPbqkH1iwYsWzJTni0hEwhFhVca94TFtEtdPZEOY44cg9/wy/iA4W6sLeoxUkvB/x7sWaSomKhWxPnpJQcRl2N56rC/g0+snT+1eivA8KkS5shP3ONg68yCHkfgfOaC3tqidZVOqlQJIVxNFLxmeHJps9qbMkSuSAVsQEpKH8w8nTlgZc95BolXlTHoPePnEmTUMoX62e7jxEg/02qvCuSAbnts0gYlX9q3q7YgiH4EFDUHZ8YD1lRAbEwuuGu/BZnQhgU/tXZYnA9OqW3BgPSU0eL9/67p28xWUQ9GNk973LdvlRvsxJNFl3i9ux2M3wW1IESC5bPwvMIFWvfdyOm6QszeZERPaqDEY4f6cXCLgGlzxx9eBSm+GRmL5wOp1hiDKhFnxDTqoKc8mk8PNWgcydy/pCkmg== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000023, 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 in 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 c7e53cd0cdd0..d4624940923f 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -9,6 +9,7 @@ #include #include #include +#include #include #include #include @@ -1067,30 +1068,6 @@ enum { int region_intersects(resource_size_t offset, size_t size, unsigned long flags, unsigned long desc); -/* Support for virtually mapped pages */ -struct page *vmalloc_to_page(const void *addr); -unsigned long vmalloc_to_pfn(const void *addr); - -/* - * Determine if an address is within the vmalloc range - * - * On nommu, vmalloc/vfree wrap through kmalloc/kfree directly, so there - * is no special casing required. - */ -#ifdef CONFIG_MMU -extern bool is_vmalloc_addr(const void *x); -extern int is_vmalloc_or_module_addr(const void *x); -#else -static inline bool is_vmalloc_addr(const void *x) -{ - return false; -} -static inline int is_vmalloc_or_module_addr(const void *x) -{ - return 0; -} -#endif - /* * How many times the entire folio is mapped as a single unit (eg by a * PMD or PUD entry). This is probably not what you want, except for diff --git a/include/linux/mm/vmalloc_addr.h b/include/linux/mm/vmalloc_addr.h new file mode 100644 index 000000000000..86ad2dc94960 --- /dev/null +++ b/include/linux/mm/vmalloc_addr.h @@ -0,0 +1,33 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef _LINUX_MM_VMALLOC_ADDR_H +#define _LINUX_MM_VMALLOC_ADDR_H + +#include // for bool + +struct page; + +/* Support for virtually mapped pages */ +struct page *vmalloc_to_page(const void *addr); +unsigned long vmalloc_to_pfn(const void *addr); + +/* + * Determine if an address is within the vmalloc range + * + * On nommu, vmalloc/vfree wrap through kmalloc/kfree directly, so there + * is no special casing required. + */ +#ifdef CONFIG_MMU +extern bool is_vmalloc_addr(const void *x); +extern int is_vmalloc_or_module_addr(const void *x); +#else +static inline bool is_vmalloc_addr(const void *x) +{ + return false; +} +static inline int is_vmalloc_or_module_addr(const void *x) +{ + return 0; +} +#endif + +#endif /* _LINUX_MM_VMALLOC_ADDR_H */ From patchwork Thu Feb 15 14:56:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Max Kellermann X-Patchwork-Id: 13558593 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 C9FC9C48BC4 for ; Thu, 15 Feb 2024 14:56:51 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 6B9976B008A; Thu, 15 Feb 2024 09:56:27 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 641D68D002B; Thu, 15 Feb 2024 09:56:27 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 495828D0029; Thu, 15 Feb 2024 09:56:27 -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 30AA06B008A for ; Thu, 15 Feb 2024 09:56:27 -0500 (EST) Received: from smtpin06.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 0E7B0C0885 for ; Thu, 15 Feb 2024 14:56:27 +0000 (UTC) X-FDA: 81794339214.06.56EAEE4 Received: from mail-lf1-f54.google.com (mail-lf1-f54.google.com [209.85.167.54]) by imf13.hostedemail.com (Postfix) with ESMTP id 48FD220019 for ; Thu, 15 Feb 2024 14:56:24 +0000 (UTC) Authentication-Results: imf13.hostedemail.com; dkim=pass header.d=ionos.com header.s=google header.b=jAt54UuE; dmarc=pass (policy=quarantine) header.from=ionos.com; spf=pass (imf13.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=1708008985; 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=UMOhGrGj8ZKb8QpbixTkN6L6ZFBU6wOv0Z5Y6TlRvLQ=; b=zyW2IFijGZ5Dlu+dpsHWKnhGb2vTCNfbef9NpaVQOL72zZvqzo9fJ672sShtpZHbxiDltO dRrmrbSLkDnc5EO1dYiMiZb4c+QE4MRkzzNL0M+ilt+pXxnnuAtnSVbNA2b6f2uYvIi49r ZG7lv8GTf4ZhCGPyiKkMNTYKM14HQek= ARC-Authentication-Results: i=1; imf13.hostedemail.com; dkim=pass header.d=ionos.com header.s=google header.b=jAt54UuE; dmarc=pass (policy=quarantine) header.from=ionos.com; spf=pass (imf13.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=1708008985; a=rsa-sha256; cv=none; b=zMW4Yq971DshT3LeTcBazBrit5YbG5OtXsxoiuK4liCckJQTckUCSIM7/S+kbm3D7eCC66 g4yijPHOPb3X4O32qem5Z7EV3dJtMh0VoyAea3RnQ6phSL4nTiW/l0XdMycNzrxbffGJfl NIpWhOHm+H02bRZ+hRwvbZ3kYHMKiCY= Received: by mail-lf1-f54.google.com with SMTP id 2adb3069b0e04-511acd26c2bso1352107e87.2 for ; Thu, 15 Feb 2024 06:56:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ionos.com; s=google; t=1708008983; x=1708613783; 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=UMOhGrGj8ZKb8QpbixTkN6L6ZFBU6wOv0Z5Y6TlRvLQ=; b=jAt54UuE8NuqoXysbN/bg6MxUS7lNsH2pqDykXYI3VtI/6zsnGeUelN9XOiEhqu3iH agGUC2lqmliivGfDWE+Fz2thd5fJEWjwceYSQDZNm4OZmNPsKHmaTJEPmJKOXP1b8xwD y7ngi8m5x3byJcM52hmzPJaWOOAHEk2uXbw+0gBuOce8wbBsWquF+s7U5xjoHLIw1j3A VdCiynBStoRi+xr0OyzJrU7zQ2sEzaAwEgooDcGAM2ox823LpHERGF1J+XyVfYFv2EYx F5AXbVDAZEMhFaGNPIbiET+5w7tMlI8VYbb/DvBlBMVuQhaVxIyONW9EoEaRRTFOXW80 hEzg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708008983; x=1708613783; 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=UMOhGrGj8ZKb8QpbixTkN6L6ZFBU6wOv0Z5Y6TlRvLQ=; b=ijda4TLxQOfw48aHkGSA5BgMV8vi9t/fkOJcX6SrHFAxTz6+4SMWEM6HYvouNDgCDp cBT6ynKqSEscAIaMw88pDgEvbngjxq0dDLHGDt8n6NXWmmBQRVZ6PNjOkXTAWBV7Upbj JSbDLenwsVmozRlm7EVotb5BrW0gbmioVEE6C+WXZIAQQ7WGWPlKK/A0okJwRq92S/9B urePppGGOpqXJugErI3jP5zgcIulEYPoFtp1coEUGs5ofrGjbyUGVgIzBTOb/xI1Ih9o lmNkAF9QNU2OArkwWShxwcbR8DASKVa6yYFakQrJqzDIJpHCBPT2hFwWQUUc6b7osTG9 7/og== X-Forwarded-Encrypted: i=1; AJvYcCVwKtVJ5A47IyWMBs57DX8u+g6l1EmrysDimXDU6oVQoPP1ha9ajvBMwRU6b80Qypx3gIGbC2djSS+MP/9b1EmPftI= X-Gm-Message-State: AOJu0Yz5PU/ow73cY9ETOmKSZLvaQ/LNvZwMeZV6VUy9yVLjioASwOrc E2xOZOBdAig4YjIg2nZvlmMw/80UrSmQMvcD99ylwdUwx9Ne9bsixBbDDb28TkU= X-Google-Smtp-Source: AGHT+IGssagBUW9WG3R8udwSe8E59JAyI3n0tWwsK5KvLhyaYjenK+BbQ5sQbNFHE9hVJClBWwkozA== X-Received: by 2002:a19:5e12:0:b0:511:7746:5687 with SMTP id s18-20020a195e12000000b0051177465687mr1519101lfb.24.1708008983414; Thu, 15 Feb 2024 06:56:23 -0800 (PST) Received: from raven.intern.cm-ag (p200300dc6f267100023064fffe740809.dip0.t-ipconnect.de. [2003:dc:6f26:7100:230:64ff:fe74:809]) by smtp.gmail.com with ESMTPSA id s18-20020a170906169200b00a3d1897ab68sm631175ejd.113.2024.02.15.06.56.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Feb 2024 06:56:23 -0800 (PST) From: Max Kellermann To: akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: Max Kellermann Subject: [PATCH v1 13/14] linux/mm.h: move high_memory to mm/high_memory.h Date: Thu, 15 Feb 2024 15:56:01 +0100 Message-Id: <20240215145602.1371274-14-max.kellermann@ionos.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240215145602.1371274-1-max.kellermann@ionos.com> References: <20240215145602.1371274-1-max.kellermann@ionos.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: 48FD220019 X-Rspam-User: X-Rspamd-Server: rspam05 X-Stat-Signature: grpo5b4ixskgnt9y1mipuatxqegrwiin X-HE-Tag: 1708008984-425086 X-HE-Meta: U2FsdGVkX19v2nkN6Ct4/mSVbIV9D9ywcz6QT0DwYTaFBTalGQO03Fdz6nyTKetb93PYUUS2VkGgGCh4DIjMu8l4Tg/Sn4/LSEIDPXzUmKhBP2JJXLwHcJawTTaAzoj6HGlQkfrOJNKNrgaCHYUsJcRdUgRF18D9z09VwQ1AIPonJNM0CdI9Uo1d3ZkDopkY81sWlZlI8WdU4nIpJlKoo1RcYSr+WD0o5C95jzchgcXSc6AgzoTSPIJtZiMJMUuLkyd2GGd9HUA5uiqUQ+za9FSXn9oHS758yYNDP7CtQa/3Dl6XzSuVrEFbEX4TcvQFl3znn//sTT27N/CK3CaXJXOz3yAQ0qK8AvabUZVFSDP4Wh0nOJsSz5wJK8bt4kib5tn3Yr0AcMPRbUCsNB53Pj5753gCtOKDg8clwkfImj6Dbi/pzW3RrZ+u+U5WKBs2BLTmwIybA5VKPVKo/YvT758s0xQfn7Grs03UUkYKfbdpK4ocG4siBvoVafVxciVxtEbviEb9L9dIVKyuT/de8rH5M5utzSyk83dUM1dCxDqguNv/5kezVNrUIk1CJhVOOCaBqsq/Y6d13ijK++xGGiSMEv0bCMz6/MYzWnFu+Y6Q4tkONANKGOyW/8j+bLNPuKseN8Lu/kZA3xw7XifNEIwc5c0i3POZZSqQ/Fs6GEvtcZjrA+Trmi3z1FtdxJwvPPu+L8Se95V/4zYJeOllpZwBKUh6NMqsvqlBXoOZz4ng41qd+lH7hP/YZxmKfZyF0FGsjGDxTYm+SQUEYEv2gWGyu508OZR3Og0VQEkeYPtOJXLlkjYUE1BdXzOmCO3jhbXhz90P2s0fHfBaE70YDEmai3GhNh/2eqjt6V9LOCbqKPGReKvnIlRLOndyltdzmaetGAg02QYZY07Nd6Lrsc9jYelCrabGXh95IIIKEgHY70/eTFg1fBfi5Qlg2iQskBbo5xV0q7JvjwhdlL8 66bNfwDY faAMu2vWnyVK/5E85QKZvVQIRAvVskqdJ3LOgG4SyXoSgtXhZH5c71IHqWEUSQZLZsGZO/y0cY6/CrgkOA2X9yAeJBkg8gP6YF54mDmY1YfUm4WflC6+z8r9mhvHE6z/ARrJHgm0H9fZHAfBatyQdvTRnae8sEDXEyoS2 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 ++++ include/linux/mm.h | 2 +- include/linux/mm/high_memory.h | 7 +++++++ 14 files changed, 33 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/include/linux/mm.h b/include/linux/mm.h index d4624940923f..75ab0144656c 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -3,6 +3,7 @@ #define _LINUX_MM_H #include +#include #include #include #include @@ -81,7 +82,6 @@ static inline void totalram_pages_add(long count) atomic_long_add(count, &_totalram_pages); } -extern void * high_memory; extern int page_cluster; extern const int page_cluster_max; diff --git a/include/linux/mm/high_memory.h b/include/linux/mm/high_memory.h new file mode 100644 index 000000000000..e504aafd0d48 --- /dev/null +++ b/include/linux/mm/high_memory.h @@ -0,0 +1,7 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef _LINUX_MM_HIGH_MEMORY_H +#define _LINUX_MM_HIGH_MEMORY_H + +extern void * high_memory; + +#endif /* _LINUX_MM_HIGH_MEMORY_H */ From patchwork Thu Feb 15 14:56:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Max Kellermann X-Patchwork-Id: 13558594 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 D2DE4C4829E for ; Thu, 15 Feb 2024 14:56:54 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 1192C8D0029; Thu, 15 Feb 2024 09:56:29 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 076316B009C; Thu, 15 Feb 2024 09:56:28 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id DC97B8D0029; Thu, 15 Feb 2024 09:56:28 -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 BDE916B009B for ; Thu, 15 Feb 2024 09:56:28 -0500 (EST) Received: from smtpin04.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id AA7B9140959 for ; Thu, 15 Feb 2024 14:56:27 +0000 (UTC) X-FDA: 81794339214.04.296FE4E Received: from mail-lj1-f171.google.com (mail-lj1-f171.google.com [209.85.208.171]) by imf25.hostedemail.com (Postfix) with ESMTP id 9F051A001C for ; Thu, 15 Feb 2024 14:56:25 +0000 (UTC) Authentication-Results: imf25.hostedemail.com; dkim=pass header.d=ionos.com header.s=google header.b="Uzkmgt/s"; dmarc=pass (policy=quarantine) header.from=ionos.com; spf=pass (imf25.hostedemail.com: domain of max.kellermann@ionos.com designates 209.85.208.171 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=1708008985; 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=k5bNFuP+26n2WAnHi+toNNvLtJ00uY1JoGlCS6SUUmE=; b=2p5fLllkF5XUIVzraQUo6yWBBoPbj4aSmJG62qptoTC2BzztnCbedGsuKjM9dZdxXzgIY7 tuPKgc+T0ZYeEMFwpvIk1UHspHuCRyufoQpwb73O8r3IenbxIDTVRPYrwgvXouZ6lkTiug nDQPZ33MSz3ch32heG7rIqIofFeuyzU= ARC-Authentication-Results: i=1; imf25.hostedemail.com; dkim=pass header.d=ionos.com header.s=google header.b="Uzkmgt/s"; dmarc=pass (policy=quarantine) header.from=ionos.com; spf=pass (imf25.hostedemail.com: domain of max.kellermann@ionos.com designates 209.85.208.171 as permitted sender) smtp.mailfrom=max.kellermann@ionos.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1708008985; a=rsa-sha256; cv=none; b=m8RTLyG7ne1BFoChYJcJxgpKAtYHKhJlJ8RIdQxYcmU5CZWMoWyKmJhjdvqkp8J0228Wpa CZ1youQmh4umdN/cpKUM0zNjUBEDCdsSqkoRRYpCW7pSwCbtnGXUg2i4viPOaFBDvXDM2V yKrLxXEUWnsOEyOVYihM7shZPGcUdm0= Received: by mail-lj1-f171.google.com with SMTP id 38308e7fff4ca-2d0aabed735so12340161fa.0 for ; Thu, 15 Feb 2024 06:56:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ionos.com; s=google; t=1708008984; x=1708613784; 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=k5bNFuP+26n2WAnHi+toNNvLtJ00uY1JoGlCS6SUUmE=; b=Uzkmgt/sVXIFudypCsxLe61GueKB5wrk5Q7cYgZ5H51JWH77pniYoKDL8c3+1msNnm 7NrnDdfogb5aMCEqDrTWfn0jyf3Fdy8dLt+VrRCOOS/+8lNWrvrMf0Jlk/9+gxVNGyaI 89mfzSzsiwaVV7OEFQxC+IdDmKdSpo3ig70StS1Hf+CdVZeMirx0Ge7RgshcsKt3dGqH 7SBPmQ3g58YC+oiBe/wtNH+8qwXFdA3p9+rJUSzVZBE7DMM64czPeDaFR/uqhUDyhyKM BRYpjcIyf8juQRoax/7hMdrx4DK1DPSnNcB6C+3nSH6K2YHS07EWDnN+NI9MalCMbx15 6AMg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708008984; x=1708613784; 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=k5bNFuP+26n2WAnHi+toNNvLtJ00uY1JoGlCS6SUUmE=; b=gDRTnHbUy+uNE75qJq17KCfWYhEdVZBwkNhYWi+hGKNQARSAD6FesOvr4ybaRNj962 MNitGMAOWwaWB783kavyHF1g1gOaN/s4TojsUTZqMdVohzMcDe7bfgpOyWLORmgDLs5T qwub2DAG9zU49/e5+P1VoZqww07vPrwRF/Bi2B70EuthR8zJFjN86V88RkzgghPA0dLD 5Pt64Cvz60SRMHpy9/SZBhcAIsdTNZz538+2+1Gnd/tqFzy6vmQxFDflNm8xkoiMrtVU XRgaycumqnEr4kGcYqqD6nYYVro8hD1gwwTGuBQ83ETFJlIDZ9r0VwTmiCKg5BgNcU5Z DnBQ== X-Forwarded-Encrypted: i=1; AJvYcCX8c0GRczME5400Tm7sxz72unGQnA+uFp16v4kG4qSNiELj9giEZ5H4hakgX6eN0c5o3QYns2VUSt65T5TZvhvDjC0= X-Gm-Message-State: AOJu0YyvvY5iRrFTPvtQlCJz2avcq9j9X6FbMQakQBNXKPJ3SCwwu42b r4md1TyRdnU3Rq4BDa8IXjKqa95EFtSNxfZbf7FlQSi0wcecIG/nTUCv0xmDoY4= X-Google-Smtp-Source: AGHT+IGTejOtFQSkxWlTe5pM1Jt/3IY1ChHH3rRQyQWLJsBYWozwuVRPQn/QL5Lsca+6dY2PXq0OmA== X-Received: by 2002:ac2:58f3:0:b0:511:986e:671e with SMTP id v19-20020ac258f3000000b00511986e671emr1726945lfo.10.1708008984131; Thu, 15 Feb 2024 06:56:24 -0800 (PST) Received: from raven.intern.cm-ag (p200300dc6f267100023064fffe740809.dip0.t-ipconnect.de. [2003:dc:6f26:7100:230:64ff:fe74:809]) by smtp.gmail.com with ESMTPSA id s18-20020a170906169200b00a3d1897ab68sm631175ejd.113.2024.02.15.06.56.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Feb 2024 06:56:23 -0800 (PST) From: Max Kellermann To: akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: Max Kellermann Subject: [PATCH v1 14/14] include: reduce dependencies on linux/mm.h Date: Thu, 15 Feb 2024 15:56:02 +0100 Message-Id: <20240215145602.1371274-15-max.kellermann@ionos.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240215145602.1371274-1-max.kellermann@ionos.com> References: <20240215145602.1371274-1-max.kellermann@ionos.com> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: 9F051A001C X-Stat-Signature: hprmuk63d519ik8z8wka6ieyucowzo8s X-HE-Tag: 1708008985-569358 X-HE-Meta: U2FsdGVkX19cRzEy/MM1/WoGfSOcRmGOg0XLyCKyJnF3tUojLz5JmFwLdXbw02C29JQUIXg0BZeMLu4wW+ae2b/uQ5Vadd9ChZ5PHHhZWxOygkC//7IX+QgARBAQXc6u+/28wsWPjLYmB9uhSkxRHBA0o4vs68xaHN0K1wDfOa4gU9JDgYJSzLAAzpSCY3yXGzJGp9P67DoyCmzXJhMN2V92dOEydfltz3g80DJjwLpRNjn0Afz389xPU88pz1mz3uaTavGZMP4dM788tnvbcgM78+hFzY1VXdso/ecwghqjPHoZQdwPKbCpTPIr/jMsRL+X6ZStOQdD2l3R06eq1AcLmhLiavRewmywbhmd0k034hw3E4uq16SPTxPTRQOxWuml+f3F9sr9IbhgitUjQjMUY5a4gqP+tKgqenrF6qfC8AOoy6s0zaaPOHpEoeUcA2+28br5StYjkMKGsotAhH9yuFHyJ0K8a7qV6X34wIEQ8wJ9Fdt6/nBqesUGZpy7Dn8OU4OQudxIAJtCuuuqgDu4Qgi8oRoHhx+TfqgUEkwSeGAYweoSR9om1iETvqE/MmlJdDF0UmqhvI5qOE3RDvPPtnlTQnfae0At+5N+3BUI898FOvW2CSVT3jcygpXejufVtsP3Bt520R6S+H4hnc2UFFZq0TE5NOjiYkweB04FjkM0loPatrh1V9yWRvCeQ0MDSI0vXG4j8Fx6lnGUufmITqlD8l+vb8W7gZ+YaPDKPBtgXYDVezHCGZR/Uy+lvsPfjRH/uMJE9NrUlpWO2BGkqjsfB9N0eZ8iVg8/DOgSMcLNXjR7kGPLdJlUkFyZM1vdJ9fa/DC2sLr99sfu0YnTnZ7FdQkimiPa9jcPpVAeoUtOlXb6EV7ZDRZXS5+q7eSH+Ep1OChlYpeav3oqs6RrKaX6fWol7uEU7Ewcvf4tCfJj7NdbXEzvSyCOvzgkfaIPVC8bHIZK0wXhRTk T0h4e2d5 XWACNH+OnmQ32I+pPs2WN9jqIxpDjm9J++YQyYso/7ugLfcHwHZjvka2HtusPzbzwTluixxkKH+CZMDs7H3Uhz6IJeX6eE151vuaOfGhPAoe491B0/kjb9FD7INLVmK6ltRFDtMZ76N8YoRyWYOzsKA25AMJ/po7FoZnN0/XhZwAI8i9XHHue0cGTdlz/hS09CyGhugCa7Txx4yEahrXKWr9stgMNwpPIxhqH7uriwHHLVDaWyi3iJrnyUwBG/RX70H0WLqEodO7OTni9+cn7KAsHDYV9csr6oSaqyR0nh+b+xB+WJeE/1SUTuJVCkokb/64SsxUX3DANVsSC0XlDf8ioe61ZNrsEK/i66UK0MTepd4eHPM1tY3ryJiGdcRx2TpHA 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 ++++ 6 files changed, 13 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..b9dd5dd915c3 100644 --- a/include/linux/highmem.h +++ b/include/linux/highmem.h @@ -7,7 +7,9 @@ #include #include #include -#include +#include +#include +#include // for folio_put() #include #include diff --git a/include/linux/scatterlist.h b/include/linux/scatterlist.h index 77df3d7b18a6..d55cfcde1b09 100644 --- a/include/linux/scatterlist.h +++ b/include/linux/scatterlist.h @@ -5,7 +5,7 @@ #include #include #include -#include +#include #include struct scatterlist { diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index 696e7680656f..5bd89f0f7e7e 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