[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240604090845.2182265-1-max.kellermann@ionos.com>
Date: Tue, 4 Jun 2024 11:08:30 +0200
From: Max Kellermann <max.kellermann@...os.com>
To: akpm@...ux-foundation.org,
linux-mm@...ck.org,
linux-kernel@...r.kernel.org
Cc: willy@...radead.org,
sfr@...b.auug.org.au,
david@...hat.com,
Max Kellermann <max.kellermann@...os.com>
Subject: [PATCH v6 00/15] 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.
This patch set borrows the name "fast kernel headers" from Ingo
Molnar's effort a few years ago. While this kind of refactoring does
indeed improve build times because the amount of code that has to be
processed in each compilation unit is reduced, build speed is the
least important advantage.
Much more important is that this gives us greater confidence that the
code is correct: if we forget to include a header, it might (or might
not) already be included indirectly by some other header somewhere
down the large impenetrable include tree. Chances are almost 100%
that linux/kernel.h or linux/mm.h gets included somewhere, which then
in turn includes everything else. Now if this indirect include just
happens to be changed eventually, the build may suddenly fail at
remote places. Worse, an #ifdef may silently produce different code.
Therefore, at each source file, all the includes that are needed
should be included directly (but not more). This is only possible if
headers are small, and linux/mm.h and linux/kernel.h are large
offenders resisting the cleanup.
Therefore, splitting those is the first step towards leaner header
dependencies. This patch set starts with linux/mm.h, and I am already
preparing another patch set addressing linux/kernel.h.
Some of these changes were part of a previous, bigger patch set
(https://lore.kernel.org/lkml/20240131145008.1345531-1-max.kellermann@ionos.com/)
but this patch set grew so large, it could not be reviewed. This is
an attempt to break the patch set into smaller pieces.
---
v1 -> v2: added more explanations to commit messages; renamed several
new headers from page_*.h to folio_*.h as suggested by Matthew
Wilcox; rebase on linux-next; fix build failures on architectures
um,nios2,hexagon by adding more missing includes
v2 -> v3: rebase on linux-next
v3 -> v4: rebase on linux-next; fix build failure on loongarch64
(reported by kernel test robot); add missing includes to
drivers/dma/bcm2835-dma.c and include/scsi/scsicam.h
v4 -> v5: rebase on linux-next; more text in cover letter as suggested
by David Hildenbrand
v5 -> v6: rebase on linux-next d04466706db5...d97496ca23a2
Max Kellermann (15):
drivers: add missing includes on linux/mm.h (and others)
include/drm/drm_gem.h: add poll_table_struct forward declaration
include/scsi/scsicam.h: forward-declare struct block_device
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 folio_size(), ... to mm/folio_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/folio_usage.h
linux/mm.h: move page_zone_id() and more to mm/folio_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 +
drivers/comedi/comedi_buf.c | 1 +
.../qat/qat_common/adf_gen4_pm_debugfs.c | 1 +
drivers/dma/bcm2835-dma.c | 1 +
drivers/dma/dma-axi-dmac.c | 1 +
drivers/dma/sh/rcar-dmac.c | 1 +
drivers/firmware/qcom/qcom_scm-legacy.c | 1 +
drivers/firmware/qcom/qcom_scm-smc.c | 1 +
drivers/firmware/raspberrypi.c | 1 +
drivers/iio/buffer/industrialio-buffer-dma.c | 1 +
drivers/iommu/iommufd/ioas.c | 2 +
drivers/iommu/iommufd/selftest.c | 1 +
drivers/media/platform/mediatek/vpu/mtk_vpu.c | 1 +
drivers/media/platform/ti/omap/omap_voutlib.c | 1 +
drivers/misc/bcm-vk/bcm_vk_dev.c | 1 +
drivers/misc/fastrpc.c | 1 +
drivers/misc/genwqe/card_dev.c | 1 +
drivers/misc/uacce/uacce.c | 1 +
drivers/mtd/nand/onenand/onenand_samsung.c | 1 +
drivers/mtd/spi-nor/core.h | 2 +
drivers/pci/p2pdma.c | 1 +
drivers/pci/pci.c | 1 +
drivers/remoteproc/mtk_scp.c | 1 +
drivers/remoteproc/remoteproc_core.c | 1 +
drivers/soc/qcom/rmtfs_mem.c | 1 +
drivers/spi/spi-aspeed-smc.c | 1 +
drivers/spi/spi-bcm2835.c | 2 +
drivers/spi/spi-intel.c | 1 +
drivers/virtio/virtio_ring.c | 1 +
include/drm/drm_file.h | 1 +
include/linux/bio.h | 2 +
include/linux/bpfptr.h | 1 -
include/linux/dma-mapping.h | 1 +
include/linux/highmem-internal.h | 2 +
include/linux/highmem.h | 4 +-
include/linux/huge_mm.h | 2 +
include/linux/iommu.h | 1 +
include/linux/mm.h | 598 +-----------------
include/linux/mm/devmap_managed.h | 32 +
include/linux/mm/folio_next.h | 27 +
include/linux/mm/folio_size.h | 150 +++++
include/linux/mm/folio_usage.h | 182 ++++++
include/linux/mm/folio_zone.h | 56 ++
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/pfmemalloc.h | 52 ++
include/linux/mm/vmalloc_addr.h | 33 +
include/linux/net.h | 2 +-
include/linux/nvme-keyring.h | 2 +
include/linux/oom.h | 2 +-
include/linux/page-flags.h | 3 +
include/linux/pagemap.h | 2 +-
include/linux/scatterlist.h | 8 +-
include/linux/skbuff.h | 4 +
include/linux/vmstat.h | 2 +
include/scsi/scsicam.h | 5 +
kernel/dma/ops_helpers.c | 1 +
kernel/dma/remap.c | 1 +
kernel/rcu/rcutorture.c | 1 +
lib/scatterlist.c | 1 +
mm/dmapool.c | 1 +
76 files changed, 811 insertions(+), 595 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/folio_size.h
create mode 100644 include/linux/mm/folio_usage.h
create mode 100644 include/linux/mm/folio_zone.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/pfmemalloc.h
create mode 100644 include/linux/mm/vmalloc_addr.h
--
2.39.2
Powered by blists - more mailing lists