Fast kernel headers: split linux/mm.h
Subsystems (42)
cover Fast kernel headers: split linux/mm.h
This patch set aims to clean up the linux/mm.h header and reduce dependencies on it by moving parts out.
The goal was to eliminate dependencies on linux/mm.h from other popular headers such as highmem.h and dma-mapping.h, and I started by checking which symbols were really used and moved those declarations to separate slim headers.
Max Kellermann (14):
drivers: add missing includes on linux/mm.h (and others) include/drm/drm_gem.h: add poll_table_struct forward declaration linux/mm.h: move page_kasan_tag() to mm/page_kasan_tag.h linux/mm.h: move section functions to mm/page_section.h linux/mm.h: move page_address() and others to mm/page_address.h linux/mm.h: move page_size() to mm/page_size.h linux/mm.h: move folio_next() to mm/folio_next.h linux/mm.h: move devmap-related declarations to mm/devmap_managed.h linux/mm.h: move usage count functions to mm/page_usage.h linux/mm.h: move page_zone_id() and more to mm/page_zone.h linux/mm.h: move pfmemalloc-related functions to pfmemalloc.h linux/mm.h: move is_vmalloc_addr() to mm/vmalloc_addr.h linux/mm.h: move high_memory to mm/high_memory.h
include: reduce dependencies on linux/mm.h
MAINTAINERS | 1 + arch/arm/include/asm/memory.h | 4 + arch/arm/include/asm/pgtable.h | 2 + arch/arm/mm/iomap.c | 3 + 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 + .../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/drm/drm_file.h | 1 + include/linux/bio.h | 2 + include/linux/dma-mapping.h | 1 + include/linux/highmem-internal.h | 2 + include/linux/highmem.h | 4 +- include/linux/iommu.h | 1 + include/linux/mm.h | 582 +----------------- include/linux/mm/devmap_managed.h | 37 ++ include/linux/mm/folio_next.h | 27 + include/linux/mm/high_memory.h | 7 + include/linux/mm/page_address.h | 71 +++ include/linux/mm/page_kasan_tag.h | 66 ++ include/linux/mm/page_section.h | 23 + include/linux/mm/page_size.h | 150 +++++ include/linux/mm/page_usage.h | 177 ++++++ include/linux/mm/page_zone.h | 38 ++ include/linux/mm/pfmemalloc.h | 52 ++ include/linux/mm/vmalloc_addr.h | 33 + include/linux/nvme-keyring.h | 2 + include/linux/scatterlist.h | 2 +- include/linux/skbuff.h | 4 + kernel/dma/ops_helpers.c | 1 + kernel/dma/remap.c | 1 + mm/dmapool.c | 1 + 59 files changed, 761 insertions(+), 575 deletions(-) create mode 100644 include/linux/mm/devmap_managed.h create mode 100644 include/linux/mm/folio_next.h create mode 100644 include/linux/mm/high_memory.h create mode 100644 include/linux/mm/page_address.h create mode 100644 include/linux/mm/page_kasan_tag.h create mode 100644 include/linux/mm/page_section.h create mode 100644 include/linux/mm/page_size.h create mode 100644 include/linux/mm/page_usage.h create mode 100644 include/linux/mm/page_zone.h create mode 100644 include/linux/mm/pfmemalloc.h create mode 100644 include/linux/mm/vmalloc_addr.h
Signature · 1 line
2.39.2
PATCH 1/14 drivers: add missing includes on linux/mm.h (and others)
After developing the other patches in this series, I had lots of build failures because "#include <linux/mm.h>" was missing. This patch fixes those build failures by adding the missing "#include" lines. To allow bisects, it is ordered before the others.
--- 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(+)
arch/arm/mm/iomap.c +3 -0
@@ -29,6 +29,9 @@ EXPORT_SYMBOL(ioport_unmap);#endif #ifdef CONFIG_PCI + +#include <asm/pgtable.h> // for VMALLOC_* +unsigned long pcibios_min_io =0x1000 ;EXPORT_SYMBOL (pcibios_min_io);
drivers/crypto/intel/qat/qat_common/adf_gen4_pm_debugfs.c +1 -0
@@ -1,6 +1,7 @@// SPDX-License-Identifier: GPL-2.0-only /* Copyright(c) 2023 Intel Corporation */ #include <linux/dma-mapping.h> +#include <linux/fs.h> // for simple_read_from_buffer() #include <linux/kernel.h> #include <linux/string_helpers.h> #include <linux/stringify.h>
drivers/dma/dma-axi-dmac.c +1 -0
@@ -15,6 +15,7 @@#include <linux/interrupt.h> #include <linux/io.h> #include <linux/kernel.h> +#include <linux/mm.h> // for PAGE_ALIGN() #include <linux/module.h> #include <linux/of.h> #include <linux/of_dma.h>
drivers/dma/sh/rcar-dmac.c +1 -0
@@ -12,6 +12,7 @@#include <linux/dmaengine.h> #include <linux/interrupt.h> #include <linux/list.h> +#include <linux/mm.h> // for PAGE_ALIGN() #include <linux/module.h> #include <linux/mutex.h> #include <linux/of.h>
drivers/firmware/qcom/qcom_scm-legacy.c +1 -0
@@ -5,6 +5,7 @@#include <linux/slab.h> #include <linux/io.h> +#include <linux/mm.h> // for PAGE_ALIGN() #include <linux/module.h> #include <linux/mutex.h> #include <linux/errno.h>
drivers/firmware/qcom/qcom_scm-smc.c +1 -0
@@ -5,6 +5,7 @@#include <linux/io.h> #include <linux/errno.h> #include <linux/delay.h> +#include <linux/mm.h> // for PAGE_ALIGN() #include <linux/mutex.h> #include <linux/slab.h> #include <linux/types.h>
drivers/firmware/raspberrypi.c +1 -0
@@ -9,6 +9,7 @@#include <linux/dma-mapping.h> #include <linux/kref.h> #include <linux/mailbox_client.h> +#include <linux/mm.h> // for PAGE_ALIGN() #include <linux/module.h> #include <linux/of.h> #include <linux/of_platform.h>
drivers/iio/buffer/industrialio-buffer-dma.c +1 -0
@@ -6,6 +6,7 @@#include <linux/slab.h> #include <linux/kernel.h> +#include <linux/mm.h> // for PAGE_ALIGN() #include <linux/module.h> #include <linux/device.h> #include <linux/workqueue.h>
drivers/iommu/iommufd/selftest.c +1 -0
@@ -5,6 +5,7 @@*/ #include <linux/slab.h> #include <linux/iommu.h> +#include <linux/mm.h> // for GUP_PIN_COUNTING_BIAS #include <linux/xarray.h> #include <linux/file.h> #include <linux/anon_inodes.h>
drivers/media/platform/mediatek/vpu/mtk_vpu.c +1 -0
@@ -8,6 +8,7 @@#include <linux/firmware.h> #include <linux/interrupt.h> #include <linux/iommu.h> +#include <linux/mm.h> // for totalram_pages() #include <linux/module.h> #include <linux/of.h> #include <linux/of_platform.h>
drivers/media/platform/ti/omap/omap_voutlib.c +1 -0
@@ -18,6 +18,7 @@* */ +#include <linux/mm.h> // for PAGE_ALIGN() #include <linux/module.h> #include <linux/errno.h> #include <linux/kernel.h>
drivers/misc/bcm-vk/bcm_vk_dev.c +1 -0
@@ -11,6 +11,7 @@#include <linux/interrupt.h> #include <linux/panic_notifier.h> #include <linux/kref.h> +#include <linux/mm.h> // for io_remap_pfn_range() #include <linux/module.h> #include <linux/mutex.h> #include <linux/pci.h>
drivers/misc/fastrpc.c +1 -0
@@ -10,6 +10,7 @@#include <linux/idr.h> #include <linux/list.h> #include <linux/miscdevice.h> +#include <linux/mm.h> // for find_vma() #include <linux/module.h> #include <linux/of_address.h> #include <linux/of.h>
drivers/misc/genwqe/card_dev.c +1 -0
@@ -17,6 +17,7 @@#include <linux/kernel.h> #include <linux/types.h> +#include <linux/mm.h> // for struct vm_operations_struct #include <linux/module.h> #include <linux/pci.h> #include <linux/string.h>
drivers/misc/uacce/uacce.c +1 -0
@@ -2,6 +2,7 @@#include <linux/compat.h> #include <linux/dma-mapping.h> #include <linux/iommu.h> +#include <linux/mm.h> // for struct vm_operations_struct #include <linux/module.h> #include <linux/poll.h> #include <linux/slab.h>
drivers/pci/p2pdma.c +1 -0
@@ -16,6 +16,7 @@#include <linux/slab.h> #include <linux/genalloc.h> #include <linux/memremap.h> +#include <linux/mm.h> // for VM_MAYSHARE #include <linux/percpu-refcount.h> #include <linux/random.h> #include <linux/seq_buf.h>
drivers/pci/pci.c +1 -0
@@ -25,6 +25,7 @@#include <linux/logic_pio.h> #include <linux/pm_wakeup.h> #include <linux/device.h> +#include <linux/pgtable.h> // for pgprot_device() #include <linux/pm_runtime.h> #include <linux/pci_hotplug.h> #include <linux/vmalloc.h>
drivers/remoteproc/remoteproc_core.c +1 -0
@@ -18,6 +18,7 @@#include <linux/delay.h> #include <linux/kernel.h> +#include <linux/mm.h> // for PAGE_ALIGN() #include <linux/module.h> #include <linux/device.h> #include <linux/panic_notifier.h>
drivers/soc/qcom/rmtfs_mem.c +1 -0
@@ -6,6 +6,7 @@#include <linux/kernel.h> #include <linux/cdev.h> #include <linux/err.h> +#include <linux/mm.h> // for remap_pfn_range() #include <linux/module.h> #include <linux/platform_device.h> #include <linux/of.h>
drivers/spi/spi-bcm2835.c +2 -0
@@ -33,6 +33,8 @@#include <linux/slab.h> #include <linux/spi/spi.h> +#include <asm/pgtable.h> // for ZERO_PAGE() +/* SPI register offsets */ #define BCM2835_SPI_CS 0x00#define BCM2835_SPI_FIFO 0x04
drivers/spi/spi-intel.c +1 -0
@@ -8,6 +8,7 @@#include <linux/iopoll.h> #include <linux/module.h> +#include <linux/sizes.h> // for SZ_* #include <linux/mtd/partitions.h> #include <linux/mtd/spi-nor.h>
drivers/virtio/virtio_ring.c +1 -0
@@ -12,6 +12,7 @@#include <linux/hrtimer.h> #include <linux/dma-mapping.h> #include <linux/kmsan.h> +#include <linux/mm.h> // for PAGE_ALIGN() #include <linux/spinlock.h> #include <xen/xen.h>
include/linux/iommu.h +1 -0
@@ -14,6 +14,7 @@#include <linux/err.h> #include <linux/of.h> #include <linux/iova_bitmap.h> +#include <linux/uaccess.h> // for copy_struct_from_user() #include <uapi/linux/iommu.h> #define IOMMU_READ (1 << 0)
include/linux/nvme-keyring.h +2 -0
@@ -6,6 +6,8 @@#ifndef _NVME_KEYRING_H#define _NVME_KEYRING_H +#include <linux/key.h> +#if IS_ENABLED (CONFIG_NVME_KEYRING ) key_serial_t nvme_tls_psk_default(struct key *keyring,
kernel/dma/ops_helpers.c +1 -0
@@ -4,6 +4,7 @@* the allocated memory contains normal pages in the direct kernel mapping. */ #include <linux/dma-map-ops.h> +#include <linux/mm.h> // for PAGE_ALIGN() static struct page *dma_common_vaddr_to_page (void *cpu_addr) {
kernel/dma/remap.c +1 -0
@@ -3,6 +3,7 @@* Copyright (c) 2014 The Linux Foundation */ #include <linux/dma-map-ops.h> +#include <linux/mm.h> // for vmap(), PAGE_ALIGN() #include <linux/slab.h> #include <linux/vmalloc.h>
mm/dmapool.c +1 -0
@@ -25,6 +25,7 @@#include <linux/kernel.h> #include <linux/list.h> #include <linux/export.h> +#include <linux/mm.h> // for want_init_on_alloc() #include <linux/mutex.h> #include <linux/poison.h> #include <linux/sched.h>
Signature · 1 line
2.39.2
PATCH 2/14 include/drm/drm_gem.h: add poll_table_struct forward declaration
In reply to Max KellermannAfter 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.
--- include/drm/drm_file.h | 1 + 1 file changed, 1 insertion(+)
include/drm/drm_file.h +1 -0
@@ -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
Signature · 1 line
2.39.2
PATCH 3/14 linux/mm.h: move page_kasan_tag() to mm/page_kasan_tag.h
In reply to Max KellermannPrepare to reduce dependencies in linux/mm.h.
A side effect of this patch is that the <linux/kasan.h> include line is moved inside the "#ifdef CONFIG_KASAN..." block, i.e. it is not included at all if KASAN is disabled.
--- 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
MAINTAINERS +1 -0
@@ -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
include/linux/mm.h +1 -55
74 lines not on this page · raw message
include/linux/mm/page_kasan_tag.h new file +66 -0
66 lines not on this page · raw message
Signature · 1 line
2.39.2
PATCH 4/14 linux/mm.h: move section functions to mm/page_section.h
In reply to Max KellermannPrepare to reduce dependencies in linux/mm.h.
--- 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
include/linux/mm.h +1 -17
@@ -3,6 +3,7 @@#define _LINUX_MM_H#include <linux/mm/page_kasan_tag.h> +#include <linux/mm/page_section.h> #include <linux/errno.h> #include <linux/mmdebug.h> #include <linux/gfp.h>
@@ -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.
include/linux/mm/page_section.h new file +23 -0
@@ -0,0 +1,23 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef _LINUX_MM_PAGE_SECTION_H +#define _LINUX_MM_PAGE_SECTION_H + +#include <linux/mm_types.h> // for struct page +#include <linux/mmzone.h> // 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 */
Signature · 1 line
2.39.2
PATCH 5/14 linux/mm.h: move page_address() and others to mm/page_address.h
In reply to Max KellermannPrepare to reduce dependencies in linux/mm.h.
--- 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
include/linux/mm.h +1 -55
@@ -2,7 +2,7 @@#ifndef _LINUX_MM_H#define _LINUX_MM_H -#include <linux/mm/page_kasan_tag.h> +#include <linux/mm/page_address.h> #include <linux/mm/page_section.h> #include <linux/errno.h> #include <linux/mmdebug.h>
@@ -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 <linux/vmstat.h> -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. */
include/linux/mm/page_address.h new file +71 -0
71 lines not on this page · raw message
Signature · 1 line
2.39.2
PATCH 6/14 linux/mm.h: move page_size() to mm/page_size.h
In reply to Max KellermannPrepare to reduce dependencies in linux/mm.h.
--- 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
include/linux/mm.h +1 -139
@@ -4,6 +4,7 @@#include <linux/mm/page_address.h> #include <linux/mm/page_section.h> +#include <linux/mm/page_size.h> #include <linux/errno.h> #include <linux/mmdebug.h> #include <linux/gfp.h>
@@ -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 <linux/huge_mm.h> /*
@@ -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.
include/linux/mm/page_size.h new file +150 -0
150 lines not on this page · raw message
Signature · 1 line
2.39.2
Re: [PATCH v1 06/14] linux/mm.h: move page_size() to mm/page_size.h
Quoted 1 line · Max Kellermann
Prepare to reduce dependencies in
linux/mm.h.
We're really close to eliminating page_size(). Just 23 callers left. As such, it would be a mistake to name the header after it. I don't particularly like how you're splitting up mm.h; I think the real problem is all the code that says "Oh, I'm allocating memory, I should include mm.h" instead of including gfp.h or slab.h.
But if you must split it like this, at least call it folio_size.h
Re: [PATCH v1 06/14] linux/mm.h: move page_size() to mm/page_size.h
Quoted 5 lines · Matthew Wilcox
We're really close to eliminating
page_size(). Just 23 callers left. As such, it would be a mistake to name the header after it. I don't particularly like how you're splitting upmm.h; I think the real problem is all the code that says "Oh, I'm allocating memory, I should includemm.h" instead of includinggfp.horslab.h.
Yes, a lot of source files do that, but that mistake is not something I'm addressing in this patch series; another patch series I posted two weeks ago is about that.
This series is only about making sources lighter which currently indeed need mm.h.
Quoted 1 line
But if you must split it like this, at least call it
folio_size.h
Okay, I will rename it for v2.
PATCH 7/14 linux/mm.h: move folio_next() to mm/folio_next.h
In reply to Max KellermannPrepare to reduce dependencies in linux/mm.h.
--- 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
include/linux/mm.h +1 -19
@@ -2,6 +2,7 @@#ifndef _LINUX_MM_H#define _LINUX_MM_H +#include <linux/mm/folio_next.h> #include <linux/mm/page_address.h> #include <linux/mm/page_section.h> #include <linux/mm/page_size.h>
@@ -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.
include/linux/mm/folio_next.h new file +27 -0
@@ -0,0 +1,27 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef _LINUX_MM_FOLIO_NEXT_H +#define _LINUX_MM_FOLIO_NEXT_H + +#include <linux/mm/page_address.h> // for nth_page(), needed by folio_page() +#include <linux/mm/page_size.h> // 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 */
Signature · 1 line
2.39.2
Re: [PATCH v1 07/14] linux/mm.h: move folio_next() to mm/folio_next.h
Quoted 1 line · Max Kellermann
Prepare to reduce dependencies in
linux/mm.h.
I feel there's a lot more you could say here. Like "There are N files which only include mm.h in order to use folio_next()". Otherwise ... why is this more than churn?
Re: [PATCH v1 07/14] linux/mm.h: move folio_next() to mm/folio_next.h
Quoted 2 lines · Matthew Wilcox
I feel there's a lot more you could say here. Like "There are N files which only include
mm.hin order to usefolio_next()".
You can see this detail in the last patch (14/14), but if you prefer to have this spelled out here, I'll amend the patch description.
Though I only worked on the headers, not the thousands of sources which might also be able to reduce their header dependencies. Getting the exact number of those is a huge effort, and it's worth it, but not today. Once this patch series is merged, we can incrementally start this, but these patches are the precondition.
Quoted 2 lines
Otherwise ...
why is this more than churn?
This is about code correctness and faster compile times. You may or may not value that, much of this is really just opinion. Similar efforts have been merged recently, which is why I thought this goal was consensus among kernel people.
PATCH 8/14 linux/mm.h: move devmap-related declarations to mm/devmap_managed.h
In reply to Max KellermannPrepare to reduce dependencies in linux/mm.h.
--- 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
include/linux/mm.h +0 -24
@@ -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)
include/linux/mm/devmap_managed.h new file +37 -0
@@ -0,0 +1,37 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef _LINUX_MM_DEVMAP_MANAGED_H +#define _LINUX_MM_DEVMAP_MANAGED_H + +#include <linux/types.h> // for bool + +struct page ; + +#if defined(CONFIG_ZONE_DEVICE ) && defined(CONFIG_FS_DAX ) + +#include <linux/jump_label.h> // for DECLARE_STATIC_KEY_FALSE(), static_branch_unlikely() +#include <linux/mmzone.h> // 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 */
Signature · 1 line
2.39.2
PATCH 9/14 linux/mm.h: move usage count functions to mm/page_usage.h
In reply to Max KellermannPrepare to reduce dependencies in linux/mm.h.
--- 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
include/linux/mm.h +1 -167
@@ -6,6 +6,7 @@#include <linux/mm/page_address.h> #include <linux/mm/page_section.h> #include <linux/mm/page_size.h> +#include <linux/mm/page_usage.h> #include <linux/errno.h> #include <linux/mmdebug.h> #include <linux/gfp.h>
@@ -1053,51 +1054,6 @@ struct inode;#include <linux/huge_mm.h> -/* -* 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
include/linux/mm/page_usage.h new file +177 -0
177 lines not on this page · raw message
Signature · 1 line
2.39.2
Re: [PATCH v1 09/14] linux/mm.h: move usage count functions to mm/page_usage.h
Quoted 1 line · Max Kellermann
Prepare to reduce dependencies in
linux/mm.h.
Why does this want to be its own header instead of being part of page_ref.h?
Re: [PATCH v1 09/14] linux/mm.h: move usage count functions to mm/page_usage.h
Quoted 2 lines · Matthew Wilcox
Why does this want to be its own header instead of being part of
page_ref.h?
Because I thought page_ref.h was a low-level header and the new one would be higher-level with (slightly) heavier dependencies. Keeping different layers of code in separate headers helps keeping dependencies lean. I used the term "usage" from the explanatory comment at the top. I'll amend the patch description to explain that detail.
PATCH 10/14 linux/mm.h: move page_zone_id() and more to mm/page_zone.h
In reply to Max KellermannPrepare to reduce dependencies in linux/mm.h.
--- 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
include/linux/mm.h +1 -29
@@ -7,6 +7,7 @@#include <linux/mm/page_section.h> #include <linux/mm/page_size.h> #include <linux/mm/page_usage.h> +#include <linux/mm/page_zone.h> #include <linux/errno.h> #include <linux/mmdebug.h> #include <linux/gfp.h>
@@ -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
include/linux/mm/page_zone.h new file +38 -0
@@ -0,0 +1,38 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef _LINUX_MM_PAGE_ZONE_H +#define _LINUX_MM_PAGE_ZONE_H + +#include <linux/mm_types.h> // for struct page, struct folio +#include <linux/mmzone.h> // for ZONEID_*, NODES_* +#include <linux/page-flags.h> // 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 */
Signature · 1 line
2.39.2
PATCH 11/14 linux/mm.h: move pfmemalloc-related functions to pfmemalloc.h
In reply to Max KellermannPrepare to reduce dependencies in linux/mm.h.
--- 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
include/linux/mm.h +1 -44
@@ -8,6 +8,7 @@#include <linux/mm/page_size.h> #include <linux/mm/page_usage.h> #include <linux/mm/page_zone.h> +#include <linux/mm/pfmemalloc.h> #include <linux/errno.h> #include <linux/mmdebug.h> #include <linux/gfp.h>
@@ -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. */
include/linux/mm/pfmemalloc.h new file +52 -0
52 lines not on this page · raw message
Signature · 1 line
2.39.2
PATCH 12/14 linux/mm.h: move is_vmalloc_addr() to mm/vmalloc_addr.h
In reply to Max KellermannPrepare to reduce dependencies in linux/mm.h.
--- 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
include/linux/mm.h +1 -24
@@ -9,6 +9,7 @@#include <linux/mm/page_usage.h> #include <linux/mm/page_zone.h> #include <linux/mm/pfmemalloc.h> +#include <linux/mm/vmalloc_addr.h> #include <linux/errno.h> #include <linux/mmdebug.h> #include <linux/gfp.h>
@@ -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
include/linux/mm/vmalloc_addr.h new file +33 -0
@@ -0,0 +1,33 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef _LINUX_MM_VMALLOC_ADDR_H +#define _LINUX_MM_VMALLOC_ADDR_H + +#include <linux/types.h> // 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 */
Signature · 1 line
2.39.2
PATCH 13/14 linux/mm.h: move high_memory to mm/high_memory.h
In reply to Max KellermannThis 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/.
--- 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
arch/arm/include/asm/memory.h +4 -0
@@ -387,6 +387,10 @@ static inline unsigned long __virt_to_idmap(unsigned long x)*/ #define ARCH_PFN_OFFSET PHYS_PFN_OFFSET +#ifndef __ASSEMBLY__ +#include <linux/mm/high_memory.h> +#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)))
arch/arm/include/asm/pgtable.h +2 -0
@@ -11,6 +11,8 @@#include <asm/proc-fns.h> #ifndef __ASSEMBLY__ +#include <linux/mm/high_memory.h> +/* * ZERO_PAGE is a global shared page that is always zero: used * for zero-mapped memory areas etc..
arch/csky/include/asm/page.h +1 -0
@@ -32,6 +32,7 @@#ifndef __ASSEMBLY__ +#include <linux/mm/high_memory.h> #include <linux/pfn.h> #define virt_addr_valid (kaddr) ((void *)(kaddr) >= (void *)PAGE_OFFSET && \
arch/hexagon/include/asm/mem-layout.h +4 -0
@@ -10,6 +10,10 @@#include <linux/const.h> +#ifndef __ASSEMBLY__ +#include <linux/mm/high_memory.h> +#endif +/* * Have to do this for ginormous numbers, else they get printed as * negative numbers, which the linker no likey when you try to
arch/m68k/include/asm/page_mm.h +1 -0
@@ -5,6 +5,7 @@#ifndef __ASSEMBLY__#include <linux/compiler.h> +#include <linux/mm/high_memory.h> #include <asm/module.h> /*
arch/m68k/include/asm/pgtable_mm.h +1 -0
@@ -13,6 +13,7 @@#ifndef __ASSEMBLY__#include <asm/processor.h> +#include <linux/mm/high_memory.h> #include <linux/sched.h> #include <linux/threads.h>
arch/parisc/include/asm/floppy.h +1 -0
@@ -8,6 +8,7 @@#ifndef __ASM_PARISC_FLOPPY_H#define __ASM_PARISC_FLOPPY_H +#include <linux/mm/high_memory.h> #include <linux/vmalloc.h>
arch/powerpc/include/asm/book3s/32/pgtable.h +4 -0
@@ -4,6 +4,10 @@#include <asm-generic/pgtable-nopmd.h> +#ifndef __ASSEMBLY__ +#include <linux/mm/high_memory.h> +#endif +/* * The "classic" 32-bit implementation of the PowerPC MMU uses a hash * table containing PTEs, together with a set of 16 segment registers,
arch/powerpc/include/asm/nohash/32/pgtable.h +1 -0
@@ -5,6 +5,7 @@#include <asm-generic/pgtable-nopmd.h> #ifndef __ASSEMBLY__ +#include <linux/mm/high_memory.h> #include <linux/sched.h> #include <linux/threads.h> #include <asm/mmu.h> /* For sub-arch specific PPC_PIN_SIZE */
arch/powerpc/include/asm/page.h +1 -0
@@ -7,6 +7,7 @@*/ #ifndef __ASSEMBLY__ +#include <linux/mm/high_memory.h> #include <linux/types.h> #include <linux/kernel.h> #include <linux/bug.h>
arch/x86/include/asm/floppy.h +1 -0
@@ -10,6 +10,7 @@#ifndef _ASM_X86_FLOPPY_H#define _ASM_X86_FLOPPY_H +#include <linux/mm/high_memory.h> #include <linux/vmalloc.h> /*
arch/x86/include/asm/pgtable_32_areas.h +4 -0
@@ -3,6 +3,10 @@#include <asm/cpu_entry_area.h> +#ifndef __ASSEMBLY__ +#include <linux/mm/high_memory.h> +#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
include/linux/mm.h +1 -1
@@ -3,6 +3,7 @@#define _LINUX_MM_H#include <linux/mm/folio_next.h> +#include <linux/mm/high_memory.h> #include <linux/mm/page_address.h> #include <linux/mm/page_section.h> #include <linux/mm/page_size.h>
@@ -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;
include/linux/mm/high_memory.h new file +7 -0
@@ -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 */
Signature · 1 line
2.39.2
PATCH 14/14 include: reduce dependencies on linux/mm.h
In reply to Max KellermannReplace <linux/mm.h> 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 <linux/mm.h> header.
For this, several missing includes need to be added because they are no longer indirectly included, e.g. <linux/fs.h>.
--- 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(-)
include/linux/bio.h +2 -0
@@ -5,7 +5,9 @@#ifndef __LINUX_BIO_H#define __LINUX_BIO_H +#include <linux/fs.h> // for struct kiocb, IOCB_NOWAIT #include <linux/mempool.h> +#include <linux/mm/folio_next.h> /* struct bio, bio_vec and BIO_* flags are defined in blk_types.h */ #include <linux/blk_types.h> #include <linux/uio.h>
include/linux/dma-mapping.h +1 -0
@@ -11,6 +11,7 @@#include <linux/scatterlist.h> #include <linux/bug.h> #include <linux/mem_encrypt.h> +#include <linux/mm/vmalloc_addr.h> /** * List of possible attributes associated with a DMA mapping. The semantics
include/linux/highmem-internal.h +2 -0
@@ -2,6 +2,8 @@#ifndef _LINUX_HIGHMEM_INTERNAL_H#define _LINUX_HIGHMEM_INTERNAL_H +#include <linux/mm/page_address.h> +/* * Outside of CONFIG_HIGHMEM to support X86 32bit iomap_atomic() cruft. */
include/linux/highmem.h +3 -1
@@ -7,7 +7,9 @@#include <linux/bug.h> #include <linux/cacheflush.h> #include <linux/kmsan.h> -#include <linux/mm.h> +#include <linux/mm/page_address.h> +#include <linux/mm/page_size.h> +#include <linux/mm/page_usage.h> // for folio_put() #include <linux/uaccess.h> #include <linux/hardirq.h>
include/linux/scatterlist.h +1 -1
@@ -5,7 +5,7 @@#include <linux/string.h> #include <linux/types.h> #include <linux/bug.h> -#include <linux/mm.h> +#include <linux/mm/page_address.h> #include <asm/io.h> struct scatterlist {
include/linux/skbuff.h +4 -0
@@ -16,6 +16,10 @@#include <linux/bug.h> #include <linux/bvec.h> #include <linux/cache.h> +#include <linux/gfp.h> // for alloc_pages_node() +#include <linux/mm/page_usage.h> // for get_page(), put_page() +#include <linux/mm/page_zone.h> // for page_to_nid() +#include <linux/mm/pfmemalloc.h> // for page_is_pfmemalloc() #include <linux/rbtree.h> #include <linux/socket.h> #include <linux/refcount.h>
Signature · 1 line
2.39.2
kernel test robot
build botRe: [PATCH v1 14/14] include: reduce dependencies on linux/mm.h
kernel test robot noticed the following build errors:
Hi Max,
kernel test robot noticed the following build errors:
[auto build test ERROR on next-20240215]
[cannot apply to akpm-mm/mm-everything char-misc/char-misc-testing char-misc/char-misc-next char-misc/char-misc-linus powerpc/next powerpc/fixes linus/master v6.8-rc4 v6.8-rc3 v6.8-rc2 v6.8-rc4] [If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Max-Kellermann/drivers-add-missing-includes-on-linux-mm-h-and-others/20240215-225853 base: next-20240215 patch link: https://lore.kernel.org/r/20240215145602.1371274-15-max.kellermann%40ionos.com patch subject: [PATCH v1 14/14] include: reduce dependencies on linux/mm.h config: nios2-allnoconfig (https://download.01.org/0day-ci/archive/20240217/[email protected]/config) compiler: nios2-linux-gcc (GCC) 13.2.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240217/[email protected]/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
All error/warnings (new ones prefixed by >>):
lib/scatterlist.c: In function 'sg_page_count':
>> lib/scatterlist.c:739:16: error: implicit declaration of function 'PAGE_ALIGN'; did you mean 'PTR_ALIGN'? [-Werror=implicit-function-declaration]
739 | return PAGE_ALIGN(sg->offset + sg->length) >> PAGE_SHIFT;
| ^~~~~~~~~~
| PTR_ALIGN
lib/scatterlist.c: In function 'extract_user_to_sg':
>> lib/scatterlist.c:1153:17: error: implicit declaration of function 'unpin_user_page'; did you mean 'copy_user_page'? [-Werror=implicit-function-declaration]
1153 | unpin_user_page(sg_page(&sgtable->sgl[--sgtable->nents]));
| ^~~~~~~~~~~~~~~
| copy_user_page
lib/scatterlist.c: In function 'extract_kvec_to_sg':
>> lib/scatterlist.c:1239:29: error: implicit declaration of function 'is_vmalloc_or_module_addr' [-Werror=implicit-function-declaration]
1239 | if (is_vmalloc_or_module_addr((void *)kaddr))
| ^~~~~~~~~~~~~~~~~~~~~~~~~
>> lib/scatterlist.c:1240:40: error: implicit declaration of function 'vmalloc_to_page'; did you mean 'vmalloc_nr_pages'? [-Werror=implicit-function-declaration]
1240 | page = vmalloc_to_page((void *)kaddr);
| ^~~~~~~~~~~~~~~
| vmalloc_nr_pages
>> lib/scatterlist.c:1240:38: warning: assignment to 'struct page *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
1240 | page = vmalloc_to_page((void *)kaddr);
| ^
cc1: some warnings being treated as errors
--
In file included from include/linux/mm_inline.h:6,
from mm/mmu_gather.c:6:
>> include/linux/huge_mm.h:12:19: error: unknown type name 'pmd_t'; did you mean 'pgd_t'?
12 | pmd_t *dst_pmd, pmd_t *src_pmd, unsigned long addr,
| ^~~~~
| pgd_t
include/linux/huge_mm.h:12:35: error: unknown type name 'pmd_t'; did you mean 'pgd_t'?
12 | pmd_t *dst_pmd, pmd_t *src_pmd, unsigned long addr,
| ^~~~~
| pgd_t
>> include/linux/huge_mm.h:16:19: error: unknown type name 'pud_t'; did you mean 'pgd_t'?
16 | pud_t *dst_pud, pud_t *src_pud, unsigned long addr,
| ^~~~~
| pgd_t
include/linux/huge_mm.h:16:35: error: unknown type name 'pud_t'; did you mean 'pgd_t'?
16 | pud_t *dst_pud, pud_t *src_pud, unsigned long addr,
| ^~~~~
| pgd_t
include/linux/huge_mm.h:22:64: error: unknown type name 'pud_t'; did you mean 'pgd_t'?
22 | static inline void huge_pud_set_accessed(struct vm_fault *vmf, pud_t orig_pud)
| ^~~~~
| pgd_t
include/linux/huge_mm.h:29:28: error: unknown type name 'pmd_t'; did you mean 'pgd_t'?
29 | pmd_t *pmd, unsigned long addr, unsigned long next);
| ^~~~~
| pgd_t
include/linux/huge_mm.h:30:70: error: unknown type name 'pmd_t'; did you mean 'pgd_t'?
30 | int zap_huge_pmd(struct mmu_gather *tlb, struct vm_area_struct *vma, pmd_t *pmd,
| ^~~~~
| pgd_t
include/linux/huge_mm.h:32:70: error: unknown type name 'pud_t'; did you mean 'pgd_t'?
32 | int zap_huge_pud(struct mmu_gather *tlb, struct vm_area_struct *vma, pud_t *pud,
| ^~~~~
| pgd_t
include/linux/huge_mm.h:35:44: error: unknown type name 'pmd_t'; did you mean 'pgd_t'?
35 | unsigned long new_addr, pmd_t *old_pmd, pmd_t *new_pmd);
| ^~~~~
| pgd_t
include/linux/huge_mm.h:35:60: error: unknown type name 'pmd_t'; did you mean 'pgd_t'?
35 | unsigned long new_addr, pmd_t *old_pmd, pmd_t *new_pmd);
| ^~~~~
| pgd_t
include/linux/huge_mm.h:37:21: error: unknown type name 'pmd_t'; did you mean 'pgd_t'?
37 | pmd_t *pmd, unsigned long addr, pgprot_t newprot,
| ^~~~~
| pgd_t
include/linux/huge_mm.h:437:65: error: unknown type name 'pmd_t'; did you mean 'pgd_t'?
437 | static inline void __split_huge_pmd(struct vm_area_struct *vma, pmd_t *pmd,
| ^~~~~
| pgd_t
include/linux/huge_mm.h:464:31: error: unknown type name 'pmd_t'; did you mean 'pgd_t'?
464 | static inline int is_swap_pmd(pmd_t pmd)
| ^~~~~
| pgd_t
include/linux/huge_mm.h:468:47: error: unknown type name 'pmd_t'; did you mean 'pgd_t'?
468 | static inline spinlock_t *pmd_trans_huge_lock(pmd_t *pmd,
| ^~~~~
| pgd_t
include/linux/huge_mm.h:473:47: error: unknown type name 'pud_t'; did you mean 'pgd_t'?
473 | static inline spinlock_t *pud_trans_huge_lock(pud_t *pud,
| ^~~~~
| pgd_t
include/linux/huge_mm.h:489:37: error: unknown type name 'pmd_t'; did you mean 'pgd_t'?
489 | static inline bool is_huge_zero_pmd(pmd_t pmd)
| ^~~~~
| pgd_t
include/linux/huge_mm.h:494:37: error: unknown type name 'pud_t'; did you mean 'pgd_t'?
494 | static inline bool is_huge_zero_pud(pud_t pud)
| ^~~~~
| pgd_t
include/linux/huge_mm.h:505:29: error: unknown type name 'pmd_t'; did you mean 'pgd_t'?
505 | unsigned long addr, pmd_t *pmd, int flags, struct dev_pagemap **pgmap)
| ^~~~~
| pgd_t
include/linux/huge_mm.h:511:29: error: unknown type name 'pud_t'; did you mean 'pgd_t'?
511 | unsigned long addr, pud_t *pud, int flags, struct dev_pagemap **pgmap)
| ^~~~~
| pgd_tvim +739 lib/scatterlist.c
a321e91b6d73ed Imre Deak 2013-02-27 736
a321e91b6d73ed Imre Deak 2013-02-27 737 static int sg_page_count(struct scatterlist *sg)
a321e91b6d73ed Imre Deak 2013-02-27 738 {a321e91b6d73ed Imre Deak 2013-02-27 @739 return PAGE_ALIGN(sg->offset + sg->length) >> PAGE_SHIFT;a321e91b6d73ed Imre Deak 2013-02-27 740 }a321e91b6d73ed Imre Deak 2013-02-27 741
Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
kernel test robot
build botRe: [PATCH v1 14/14] include: reduce dependencies on linux/mm.h
In reply to Max Kellermannkernel test robot noticed the following build errors:
Hi Max,
kernel test robot noticed the following build errors:
[auto build test ERROR on next-20240215]
[cannot apply to akpm-mm/mm-everything char-misc/char-misc-testing char-misc/char-misc-next char-misc/char-misc-linus powerpc/next powerpc/fixes linus/master v6.8-rc4 v6.8-rc3 v6.8-rc2 v6.8-rc4] [If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Max-Kellermann/drivers-add-missing-includes-on-linux-mm-h-and-others/20240215-225853 base: next-20240215 patch link: https://lore.kernel.org/r/20240215145602.1371274-15-max.kellermann%40ionos.com patch subject: [PATCH v1 14/14] include: reduce dependencies on linux/mm.h config: hexagon-allnoconfig (https://download.01.org/0day-ci/archive/20240218/[email protected]/config) compiler: clang version 19.0.0git (https://github.com/llvm/llvm-project 36adfec155de366d722f2bac8ff9162289dcf06c) reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240218/[email protected]/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
All errors (new ones prefixed by >>):
In file included from lib/scatterlist.c:9:
In file included from include/linux/scatterlist.h:9:
In file included from arch/hexagon/include/asm/io.h:328:
include/asm-generic/io.h:547:31: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
547 | val = __raw_readb(PCI_IOBASE + addr);
| ~~~~~~~~~~ ^
include/asm-generic/io.h:560:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
560 | val = __le16_to_cpu((__le16 __force)__raw_readw(PCI_IOBASE + addr));
| ~~~~~~~~~~ ^
include/uapi/linux/byteorder/little_endian.h:37:51: note: expanded from macro '__le16_to_cpu'
37 | #define __le16_to_cpu(x) ((__force __u16)(__le16)(x))
| ^
In file included from lib/scatterlist.c:9:
In file included from include/linux/scatterlist.h:9:
In file included from arch/hexagon/include/asm/io.h:328:
include/asm-generic/io.h:573:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
573 | val = __le32_to_cpu((__le32 __force)__raw_readl(PCI_IOBASE + addr));
| ~~~~~~~~~~ ^
include/uapi/linux/byteorder/little_endian.h:35:51: note: expanded from macro '__le32_to_cpu'
35 | #define __le32_to_cpu(x) ((__force __u32)(__le32)(x))
| ^
In file included from lib/scatterlist.c:9:
In file included from include/linux/scatterlist.h:9:
In file included from arch/hexagon/include/asm/io.h:328:
include/asm-generic/io.h:584:33: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
584 | __raw_writeb(value, PCI_IOBASE + addr);
| ~~~~~~~~~~ ^
include/asm-generic/io.h:594:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
594 | __raw_writew((u16 __force)cpu_to_le16(value), PCI_IOBASE + addr);
| ~~~~~~~~~~ ^
include/asm-generic/io.h:604:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
604 | __raw_writel((u32 __force)cpu_to_le32(value), PCI_IOBASE + addr);
| ~~~~~~~~~~ ^
>> lib/scatterlist.c:739:9: error: call to undeclared function 'PAGE_ALIGN'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
739 | return PAGE_ALIGN(sg->offset + sg->length) >> PAGE_SHIFT;
| ^
lib/scatterlist.c:763:9: error: call to undeclared function 'PAGE_ALIGN'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
763 | return PAGE_ALIGN(sg->offset + sg_dma_len(sg)) >> PAGE_SHIFT;
| ^
>> lib/scatterlist.c:1153:3: error: call to undeclared function 'unpin_user_page'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
1153 | unpin_user_page(sg_page(&sgtable->sgl[--sgtable->nents]));
| ^
>> lib/scatterlist.c:1239:8: error: call to undeclared function 'is_vmalloc_or_module_addr'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
1239 | if (is_vmalloc_or_module_addr((void *)kaddr))
| ^
>> lib/scatterlist.c:1240:12: error: call to undeclared function 'vmalloc_to_page'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
1240 | page = vmalloc_to_page((void *)kaddr);
| ^
lib/scatterlist.c:1240:12: note: did you mean 'vmalloc_nr_pages'?
include/linux/vmalloc.h:135:22: note: 'vmalloc_nr_pages' declared here
135 | extern unsigned long vmalloc_nr_pages(void);
| ^
>> lib/scatterlist.c:1240:10: error: incompatible integer to pointer conversion assigning to 'struct page *' from 'int' [-Wint-conversion]
1240 | page = vmalloc_to_page((void *)kaddr);
| ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~6 warnings and 6 errors generated.
vim +/PAGE_ALIGN +739 lib/scatterlist.c
a321e91b6d73ed Imre Deak 2013-02-27 736
a321e91b6d73ed Imre Deak 2013-02-27 737 static int sg_page_count(struct scatterlist *sg)
a321e91b6d73ed Imre Deak 2013-02-27 738 {a321e91b6d73ed Imre Deak 2013-02-27 @739 return PAGE_ALIGN(sg->offset + sg->length) >> PAGE_SHIFT;a321e91b6d73ed Imre Deak 2013-02-27 740 }a321e91b6d73ed Imre Deak 2013-02-27 741
Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
kernel test robot
build botRe: [PATCH v1 14/14] include: reduce dependencies on linux/mm.h
In reply to Max Kellermannkernel test robot noticed the following build warnings:
Hi Max,
kernel test robot noticed the following build warnings:
[auto build test WARNING on next-20240215]
[cannot apply to akpm-mm/mm-everything char-misc/char-misc-testing char-misc/char-misc-next char-misc/char-misc-linus powerpc/next powerpc/fixes linus/master v6.8-rc4 v6.8-rc3 v6.8-rc2 v6.8-rc4] [If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Max-Kellermann/drivers-add-missing-includes-on-linux-mm-h-and-others/20240215-225853 base: next-20240215 patch link: https://lore.kernel.org/r/20240215145602.1371274-15-max.kellermann%40ionos.com patch subject: [PATCH v1 14/14] include: reduce dependencies on linux/mm.h config: um-allyesconfig (https://download.01.org/0day-ci/archive/20240218/[email protected]/config) compiler: gcc-12 (Debian 12.2.0-14) 12.2.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240218/[email protected]/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
All warnings (new ones prefixed by >>):
In file included from include/linux/kfifo.h:42,
from include/linux/tty_port.h:5,
from include/linux/tty.h:12,
from lib/bust_spinlocks.c:15:
include/linux/scatterlist.h: In function 'sg_set_buf':
include/linux/scatterlist.h:189:25: error: implicit declaration of function 'virt_to_page'; did you mean 'virt_to_phys'? [-Werror=implicit-function-declaration]
189 | sg_set_page(sg, virt_to_page(buf), buflen, offset_in_page(buf));
| ^~~~~~~~~~~~
| virt_to_phys
>> include/linux/scatterlist.h:189:25: warning: passing argument 2 of 'sg_set_page' makes pointer from integer without a cast [-Wint-conversion]
189 | sg_set_page(sg, virt_to_page(buf), buflen, offset_in_page(buf));
| ^~~~~~~~~~~~~~~~~
| |
| int
include/linux/scatterlist.h:136:69: note: expected 'struct page *' but argument is of type 'int'
136 | static inline void sg_set_page(struct scatterlist *sg, struct page *page,
| ~~~~~~~~~~~~~^~~~
include/linux/scatterlist.h: In function 'sg_phys':
include/linux/scatterlist.h:389:16: error: implicit declaration of function 'page_to_phys'; did you mean 'page_to_pfn'? [-Werror=implicit-function-declaration]
389 | return page_to_phys(sg_page(sg)) + sg->offset;
| ^~~~~~~~~~~~
| page_to_pfn
cc1: some warnings being treated as errors
--
In file included from include/linux/kfifo.h:42,
from lib/kfifo.c:14:
include/linux/scatterlist.h: In function 'sg_set_buf':
include/linux/scatterlist.h:189:25: error: implicit declaration of function 'virt_to_page'; did you mean 'virt_to_phys'? [-Werror=implicit-function-declaration]
189 | sg_set_page(sg, virt_to_page(buf), buflen, offset_in_page(buf));
| ^~~~~~~~~~~~
| virt_to_phys
>> include/linux/scatterlist.h:189:25: warning: passing argument 2 of 'sg_set_page' makes pointer from integer without a cast [-Wint-conversion]
189 | sg_set_page(sg, virt_to_page(buf), buflen, offset_in_page(buf));
| ^~~~~~~~~~~~~~~~~
| |
| int
include/linux/scatterlist.h:136:69: note: expected 'struct page *' but argument is of type 'int'
136 | static inline void sg_set_page(struct scatterlist *sg, struct page *page,
| ~~~~~~~~~~~~~^~~~
include/linux/scatterlist.h: In function 'sg_phys':
include/linux/scatterlist.h:389:16: error: implicit declaration of function 'page_to_phys'; did you mean 'page_to_pfn'? [-Werror=implicit-function-declaration]
389 | return page_to_phys(sg_page(sg)) + sg->offset;
| ^~~~~~~~~~~~
| page_to_pfn
lib/kfifo.c: In function 'setup_sgl_buf':
>> lib/kfifo.c:310:14: warning: assignment to 'struct page *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
310 | page = virt_to_page(buf);
| ^
lib/kfifo.c:319:23: warning: assignment to 'struct page *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
319 | npage = virt_to_page(buf);
| ^
cc1: some warnings being treated as errors
--
In file included from include/linux/dmapool.h:14,
from include/linux/pci.h:1654,
from lib/iomap.c:7:
include/linux/scatterlist.h: In function 'sg_set_buf':
include/linux/scatterlist.h:189:25: error: implicit declaration of function 'virt_to_page'; did you mean 'virt_to_phys'? [-Werror=implicit-function-declaration]
189 | sg_set_page(sg, virt_to_page(buf), buflen, offset_in_page(buf));
| ^~~~~~~~~~~~
| virt_to_phys
>> include/linux/scatterlist.h:189:25: warning: passing argument 2 of 'sg_set_page' makes pointer from integer without a cast [-Wint-conversion]
189 | sg_set_page(sg, virt_to_page(buf), buflen, offset_in_page(buf));
| ^~~~~~~~~~~~~~~~~
| |
| int
include/linux/scatterlist.h:136:69: note: expected 'struct page *' but argument is of type 'int'
136 | static inline void sg_set_page(struct scatterlist *sg, struct page *page,
| ~~~~~~~~~~~~~^~~~
include/linux/scatterlist.h: In function 'sg_phys':
include/linux/scatterlist.h:389:16: error: implicit declaration of function 'page_to_phys'; did you mean 'page_to_pfn'? [-Werror=implicit-function-declaration]
389 | return page_to_phys(sg_page(sg)) + sg->offset;
| ^~~~~~~~~~~~
| page_to_pfn
In file included from include/linux/pci.h:2688:
include/linux/dma-mapping.h: In function 'dma_free_noncoherent':
>> include/linux/dma-mapping.h:331:35: warning: passing argument 3 of 'dma_free_pages' makes pointer from integer without a cast [-Wint-conversion]
331 | dma_free_pages(dev, size, virt_to_page(vaddr), dma_handle, dir);
| ^~~~~~~~~~~~~~~~~~~
| |
| int
include/linux/dma-mapping.h:316:67: note: expected 'struct page *' but argument is of type 'int'
316 | void dma_free_pages(struct device *dev, size_t size, struct page *page,
| ~~~~~~~~~~~~~^~~~
include/linux/dma-mapping.h: In function 'dma_map_single_attrs':
>> include/linux/dma-mapping.h:342:40: warning: passing argument 2 of 'dma_map_page_attrs' makes pointer from integer without a cast [-Wint-conversion]
342 | return dma_map_page_attrs(dev, virt_to_page(ptr), offset_in_page(ptr),
| ^~~~~~~~~~~~~~~~~
| |
| int
include/linux/dma-mapping.h:105:64: note: expected 'struct page *' but argument is of type 'int'
105 | dma_addr_t dma_map_page_attrs(struct device *dev, struct page *page,
| ~~~~~~~~~~~~~^~~~
lib/iomap.c: At top level:
lib/iomap.c:156:5: warning: no previous prototype for 'ioread64_lo_hi' [-Wmissing-prototypes]
156 | u64 ioread64_lo_hi(const void __iomem *addr)
| ^~~~~~~~~~~~~~
lib/iomap.c:163:5: warning: no previous prototype for 'ioread64_hi_lo' [-Wmissing-prototypes]
163 | u64 ioread64_hi_lo(const void __iomem *addr)
| ^~~~~~~~~~~~~~
lib/iomap.c:170:5: warning: no previous prototype for 'ioread64be_lo_hi' [-Wmissing-prototypes]
170 | u64 ioread64be_lo_hi(const void __iomem *addr)
| ^~~~~~~~~~~~~~~~
lib/iomap.c:178:5: warning: no previous prototype for 'ioread64be_hi_lo' [-Wmissing-prototypes]
178 | u64 ioread64be_hi_lo(const void __iomem *addr)
| ^~~~~~~~~~~~~~~~
lib/iomap.c:264:6: warning: no previous prototype for 'iowrite64_lo_hi' [-Wmissing-prototypes]
264 | void iowrite64_lo_hi(u64 val, void __iomem *addr)
| ^~~~~~~~~~~~~~~
lib/iomap.c:272:6: warning: no previous prototype for 'iowrite64_hi_lo' [-Wmissing-prototypes]
272 | void iowrite64_hi_lo(u64 val, void __iomem *addr)
| ^~~~~~~~~~~~~~~
lib/iomap.c:280:6: warning: no previous prototype for 'iowrite64be_lo_hi' [-Wmissing-prototypes]
280 | void iowrite64be_lo_hi(u64 val, void __iomem *addr)
| ^~~~~~~~~~~~~~~~~
lib/iomap.c:288:6: warning: no previous prototype for 'iowrite64be_hi_lo' [-Wmissing-prototypes]
288 | void iowrite64be_hi_lo(u64 val, void __iomem *addr)
| ^~~~~~~~~~~~~~~~~ cc1: some warnings being treated as errors
--
In file included from include/linux/virtio.h:7,
from arch/um/drivers/virtio_uml.c:27:
include/linux/scatterlist.h: In function 'sg_set_buf':
include/linux/scatterlist.h:189:25: error: implicit declaration of function 'virt_to_page'; did you mean 'virt_to_phys'? [-Werror=implicit-function-declaration]
189 | sg_set_page(sg, virt_to_page(buf), buflen, offset_in_page(buf));
| ^~~~~~~~~~~~
| virt_to_phys
>> include/linux/scatterlist.h:189:25: warning: passing argument 2 of 'sg_set_page' makes pointer from integer without a cast [-Wint-conversion]
189 | sg_set_page(sg, virt_to_page(buf), buflen, offset_in_page(buf));
| ^~~~~~~~~~~~~~~~~
| |
| int
include/linux/scatterlist.h:136:69: note: expected 'struct page *' but argument is of type 'int'
136 | static inline void sg_set_page(struct scatterlist *sg, struct page *page,
| ~~~~~~~~~~~~~^~~~
include/linux/scatterlist.h: In function 'sg_phys':
include/linux/scatterlist.h:389:16: error: implicit declaration of function 'page_to_phys'; did you mean 'page_to_pfn'? [-Werror=implicit-function-declaration]
389 | return page_to_phys(sg_page(sg)) + sg->offset;
| ^~~~~~~~~~~~
| page_to_pfn
In file included from include/linux/virtio.h:12:
include/linux/dma-mapping.h: In function 'dma_free_noncoherent':
>> include/linux/dma-mapping.h:331:35: warning: passing argument 3 of 'dma_free_pages' makes pointer from integer without a cast [-Wint-conversion]
331 | dma_free_pages(dev, size, virt_to_page(vaddr), dma_handle, dir);
| ^~~~~~~~~~~~~~~~~~~
| |
| int
include/linux/dma-mapping.h:316:67: note: expected 'struct page *' but argument is of type 'int'
316 | void dma_free_pages(struct device *dev, size_t size, struct page *page,
| ~~~~~~~~~~~~~^~~~
include/linux/dma-mapping.h: In function 'dma_map_single_attrs':
>> include/linux/dma-mapping.h:342:40: warning: passing argument 2 of 'dma_map_page_attrs' makes pointer from integer without a cast [-Wint-conversion]
342 | return dma_map_page_attrs(dev, virt_to_page(ptr), offset_in_page(ptr),
| ^~~~~~~~~~~~~~~~~
| |
| int
include/linux/dma-mapping.h:105:64: note: expected 'struct page *' but argument is of type 'int'
105 | dma_addr_t dma_map_page_attrs(struct device *dev, struct page *page,
| ~~~~~~~~~~~~~^~~~
In file included from arch/um/include/asm/thread_info.h:15,
from include/linux/thread_info.h:60,
from include/asm-generic/preempt.h:5,
from ./arch/um/include/generated/asm/preempt.h:1,
from include/linux/preempt.h:79,
from include/linux/spinlock.h:56,
from include/linux/mmzone.h:8,
from include/linux/gfp.h:7,
from include/linux/umh.h:4,
from include/linux/kmod.h:9,
from include/linux/module.h:17,
from arch/um/drivers/virtio_uml.c:23:
arch/um/drivers/virtio_uml.c: In function 'vhost_user_set_mem_table':
arch/um/drivers/virtio_uml.c:678:54: error: 'end_iomem' undeclared (first use in this function)
678 | rc = vhost_user_init_mem_region(__pa(end_iomem), highmem,
| ^~~~~~~~~
arch/um/include/asm/page.h:105:58: note: in definition of macro '__pa'
105 | #define __pa(virt) uml_to_phys((void *) (unsigned long) (virt))
| ^~~~
arch/um/drivers/virtio_uml.c:678:54: note: each undeclared identifier is reported only once for each function it appears in
678 | rc = vhost_user_init_mem_region(__pa(end_iomem), highmem,
| ^~~~~~~~~
arch/um/include/asm/page.h:105:58: note: in definition of macro '__pa'
105 | #define __pa(virt) uml_to_phys((void *) (unsigned long) (virt))
| ^~~~
cc1: some warnings being treated as errors
--
In file included from include/linux/dmapool.h:14,
from include/linux/pci.h:1654,
from arch/um/drivers/virt-pci.c:7:
include/linux/scatterlist.h: In function 'sg_set_buf':
include/linux/scatterlist.h:189:25: error: implicit declaration of function 'virt_to_page'; did you mean 'virt_to_phys'? [-Werror=implicit-function-declaration]
189 | sg_set_page(sg, virt_to_page(buf), buflen, offset_in_page(buf));
| ^~~~~~~~~~~~
| virt_to_phys
>> include/linux/scatterlist.h:189:25: warning: passing argument 2 of 'sg_set_page' makes pointer from integer without a cast [-Wint-conversion]
189 | sg_set_page(sg, virt_to_page(buf), buflen, offset_in_page(buf));
| ^~~~~~~~~~~~~~~~~
| |
| int
include/linux/scatterlist.h:136:69: note: expected 'struct page *' but argument is of type 'int'
136 | static inline void sg_set_page(struct scatterlist *sg, struct page *page,
| ~~~~~~~~~~~~~^~~~
include/linux/scatterlist.h: In function 'sg_phys':
include/linux/scatterlist.h:389:16: error: implicit declaration of function 'page_to_phys'; did you mean 'page_to_pfn'? [-Werror=implicit-function-declaration]
389 | return page_to_phys(sg_page(sg)) + sg->offset;
| ^~~~~~~~~~~~
| page_to_pfn
In file included from include/linux/pci.h:2688:
include/linux/dma-mapping.h: In function 'dma_free_noncoherent':
>> include/linux/dma-mapping.h:331:35: warning: passing argument 3 of 'dma_free_pages' makes pointer from integer without a cast [-Wint-conversion]
331 | dma_free_pages(dev, size, virt_to_page(vaddr), dma_handle, dir);
| ^~~~~~~~~~~~~~~~~~~
| |
| int
include/linux/dma-mapping.h:316:67: note: expected 'struct page *' but argument is of type 'int'
316 | void dma_free_pages(struct device *dev, size_t size, struct page *page,
| ~~~~~~~~~~~~~^~~~
include/linux/dma-mapping.h: In function 'dma_map_single_attrs':
>> include/linux/dma-mapping.h:342:40: warning: passing argument 2 of 'dma_map_page_attrs' makes pointer from integer without a cast [-Wint-conversion]
342 | return dma_map_page_attrs(dev, virt_to_page(ptr), offset_in_page(ptr),
| ^~~~~~~~~~~~~~~~~
| |
| int include/linux/dma-mapping.h:105:64: note: expected 'struct page *' but argument is of type 'int'
105 | dma_addr_t dma_map_page_attrs(struct device *dev, struct page *page,
| ~~~~~~~~~~~~~^~~~
cc1: some warnings being treated as errors
--
In file included from include/linux/dma-mapping.h:11,
from include/linux/comedi/comedidev.h:13,
from drivers/comedi/comedi_buf.c:12:
include/linux/scatterlist.h: In function 'sg_set_buf':
include/linux/scatterlist.h:189:25: error: implicit declaration of function 'virt_to_page'; did you mean 'virt_to_phys'? [-Werror=implicit-function-declaration]
189 | sg_set_page(sg, virt_to_page(buf), buflen, offset_in_page(buf));
| ^~~~~~~~~~~~
| virt_to_phys
>> include/linux/scatterlist.h:189:25: warning: passing argument 2 of 'sg_set_page' makes pointer from integer without a cast [-Wint-conversion]
189 | sg_set_page(sg, virt_to_page(buf), buflen, offset_in_page(buf));
| ^~~~~~~~~~~~~~~~~
| |
| int
include/linux/scatterlist.h:136:69: note: expected 'struct page *' but argument is of type 'int'
136 | static inline void sg_set_page(struct scatterlist *sg, struct page *page,
| ~~~~~~~~~~~~~^~~~
include/linux/scatterlist.h: In function 'sg_phys':
include/linux/scatterlist.h:389:16: error: implicit declaration of function 'page_to_phys'; did you mean 'page_to_pfn'? [-Werror=implicit-function-declaration]
389 | return page_to_phys(sg_page(sg)) + sg->offset;
| ^~~~~~~~~~~~
| page_to_pfn
include/linux/dma-mapping.h: In function 'dma_free_noncoherent':
>> include/linux/dma-mapping.h:331:35: warning: passing argument 3 of 'dma_free_pages' makes pointer from integer without a cast [-Wint-conversion]
331 | dma_free_pages(dev, size, virt_to_page(vaddr), dma_handle, dir);
| ^~~~~~~~~~~~~~~~~~~
| |
| int
include/linux/dma-mapping.h:316:67: note: expected 'struct page *' but argument is of type 'int'
316 | void dma_free_pages(struct device *dev, size_t size, struct page *page,
| ~~~~~~~~~~~~~^~~~
include/linux/dma-mapping.h: In function 'dma_map_single_attrs':
>> include/linux/dma-mapping.h:342:40: warning: passing argument 2 of 'dma_map_page_attrs' makes pointer from integer without a cast [-Wint-conversion]
342 | return dma_map_page_attrs(dev, virt_to_page(ptr), offset_in_page(ptr),
| ^~~~~~~~~~~~~~~~~
| |
| int
include/linux/dma-mapping.h:105:64: note: expected 'struct page *' but argument is of type 'int'
105 | dma_addr_t dma_map_page_attrs(struct device *dev, struct page *page,
| ~~~~~~~~~~~~~^~~~
drivers/comedi/comedi_buf.c: In function 'comedi_buf_map_kref_release':
>> drivers/comedi/comedi_buf.c:41:51: warning: passing argument 1 of 'ClearPageReserved' makes pointer from integer without a cast [-Wint-conversion]
41 | ClearPageReserved(virt_to_page(buf->virt_addr));
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
| |
| int
In file included from include/linux/mmzone.h:23,
from include/linux/gfp.h:7,
from include/linux/slab.h:16,
from drivers/comedi/comedi_buf.c:11:
include/linux/page-flags.h:390:59: note: expected 'struct page *' but argument is of type 'int'
390 | static __always_inline void ClearPage##uname(struct page *page) \
| ~~~~~~~~~~~~~^~~~
include/linux/page-flags.h:424:9: note: in expansion of macro 'CLEARPAGEFLAG'
424 | CLEARPAGEFLAG(uname, lname, policy)
| ^~~~~~~~~~~~~
include/linux/page-flags.h:492:1: note: in expansion of macro 'PAGEFLAG'
492 | PAGEFLAG(Reserved, reserved, PF_NO_COMPOUND)
| ^~~~~~~~
drivers/comedi/comedi_buf.c: In function 'comedi_buf_map_alloc':
>> drivers/comedi/comedi_buf.c:124:41: warning: passing argument 1 of 'SetPageReserved' makes pointer from integer without a cast [-Wint-conversion]
124 | SetPageReserved(virt_to_page(buf->virt_addr));
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
| |
| int
include/linux/page-flags.h:383:57: note: expected 'struct page *' but argument is of type 'int'
383 | static __always_inline void SetPage##uname(struct page *page) \
| ~~~~~~~~~~~~~^~~~
include/linux/page-flags.h:423:9: note: in expansion of macro 'SETPAGEFLAG'
423 | SETPAGEFLAG(uname, lname, policy) \
| ^~~~~~~~~~~
include/linux/page-flags.h:492:1: note: in expansion of macro 'PAGEFLAG'
492 | PAGEFLAG(Reserved, reserved, PF_NO_COMPOUND)
| ^~~~~~~~
drivers/comedi/comedi_buf.c: In function '__comedi_buf_alloc':
>> drivers/comedi/comedi_buf.c:178:34: warning: assignment to 'struct page *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
178 | pages[i] = virt_to_page(buf->virt_addr);
| ^
drivers/comedi/comedi_buf.c:18:41: error: 'PAGE_KERNEL' undeclared (first use in this function)
18 | #define COMEDI_PAGE_PROTECTION PAGE_KERNEL
| ^~~~~~~~~~~
drivers/comedi/comedi_buf.c:183:44: note: in expansion of macro 'COMEDI_PAGE_PROTECTION'
183 | COMEDI_PAGE_PROTECTION);
| ^~~~~~~~~~~~~~~~~~~~~~
drivers/comedi/comedi_buf.c:18:41: note: each undeclared identifier is reported only once for each function it appears in
18 | #define COMEDI_PAGE_PROTECTION PAGE_KERNEL
| ^~~~~~~~~~~
drivers/comedi/comedi_buf.c:183:44: note: in expansion of macro 'COMEDI_PAGE_PROTECTION'
183 | COMEDI_PAGE_PROTECTION);
| ^~~~~~~~~~~~~~~~~~~~~~ cc1: some warnings being treated as errors
..
vim +/sg_set_page +189 include/linux/scatterlist.h
82f66fbef58de4 Jens Axboe 2007-10-22 175
18dabf473e1585 Jens Axboe 2007-10-22 176 /**
18dabf473e1585 Jens Axboe 2007-10-22 177 * sg_set_buf - Set sg entry to point at given data
18dabf473e1585 Jens Axboe 2007-10-22 178 * @sg: SG entry
18dabf473e1585 Jens Axboe 2007-10-22 179 * @buf: Data
18dabf473e1585 Jens Axboe 2007-10-22 180 * @buflen: Data length
18dabf473e1585 Jens Axboe 2007-10-22 181 *
18dabf473e1585 Jens Axboe 2007-10-22 182 **/
82f66fbef58de4 Jens Axboe 2007-10-22 183 static inline void sg_set_buf(struct scatterlist *sg, const void *buf,
d32311fed70d12 Herbert Xu 2005-09-17 184 unsigned int buflen)
d32311fed70d12 Herbert Xu 2005-09-17 185 {
ac4e97abce9b80 Rusty Russell 2013-05-30 186 #ifdef CONFIG_DEBUG_SG
ac4e97abce9b80 Rusty Russell 2013-05-30 187 BUG_ON(!virt_addr_valid(buf));
ac4e97abce9b80 Rusty Russell 2013-05-30 188 #endif
642f149031d704 Jens Axboe 2007-10-24 @189 sg_set_page(sg, virt_to_page(buf), buflen, offset_in_page(buf));
d32311fed70d12 Herbert Xu 2005-09-17 190 }
d32311fed70d12 Herbert Xu 2005-09-17 191 Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki