From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 30D55C4345F for ; Tue, 30 Apr 2024 15:29:51 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id BC8026B0093; Tue, 30 Apr 2024 11:29:50 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B51726B0095; Tue, 30 Apr 2024 11:29:50 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9CA6F6B0096; Tue, 30 Apr 2024 11:29:50 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 7A0FF6B0093 for ; Tue, 30 Apr 2024 11:29:50 -0400 (EDT) Received: from smtpin02.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 28B58140861 for ; Tue, 30 Apr 2024 15:29:50 +0000 (UTC) X-FDA: 82066583340.02.5621706 Received: from mail-ed1-f52.google.com (mail-ed1-f52.google.com [209.85.208.52]) by imf06.hostedemail.com (Postfix) with ESMTP id 178ED180006 for ; Tue, 30 Apr 2024 15:29:47 +0000 (UTC) Authentication-Results: imf06.hostedemail.com; dkim=pass header.d=ionos.com header.s=google header.b=JvooK5mM; spf=pass (imf06.hostedemail.com: domain of max.kellermann@ionos.com designates 209.85.208.52 as permitted sender) smtp.mailfrom=max.kellermann@ionos.com; dmarc=pass (policy=quarantine) header.from=ionos.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1714490988; a=rsa-sha256; cv=none; b=b7GHRBf+LHTa9NXjrK88LHXrdbi9UTrMSsmznzo/60YKryLnkuVT6Gfiw8QZ39eIvwZRRQ 6nNPsMEE357igaLBN7/j7F+IRSFumcRuH+y9BwikDRHY711JaizaXUwn/MBGqBfE2RdIdg 1glzHcqs3RPPj6CRgQP/I6CGbiztO1c= ARC-Authentication-Results: i=1; imf06.hostedemail.com; dkim=pass header.d=ionos.com header.s=google header.b=JvooK5mM; spf=pass (imf06.hostedemail.com: domain of max.kellermann@ionos.com designates 209.85.208.52 as permitted sender) smtp.mailfrom=max.kellermann@ionos.com; dmarc=pass (policy=quarantine) header.from=ionos.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1714490988; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:in-reply-to: references:dkim-signature; bh=R9DoQMK9q9pSbyMynIt4ms7bIdooJ2qc4sLnkNXJptA=; b=fb2SAwA0DqWDIcLUqM5m6QRVvBJPgWEVeycJB3ww4krPOTT1uoWSVx1oB8F9t7wNRBNkIz ucXg9b23Qo7SeOQNmHBTgS3Bmv8qXLlv1AKyX+FS4kTXk6W+AOewHk2D71uYrsQILlAM// kAEDHxUiFQE2KDQJITcbOwZ85Hh6ies= Received: by mail-ed1-f52.google.com with SMTP id 4fb4d7f45d1cf-5724f26b8c9so8257611a12.1 for ; Tue, 30 Apr 2024 08:29:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ionos.com; s=google; t=1714490986; x=1715095786; darn=kvack.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=R9DoQMK9q9pSbyMynIt4ms7bIdooJ2qc4sLnkNXJptA=; b=JvooK5mMRIwCUaUgVtU+MTTKCzmRso+B6nTuuOcEIvqtQeMrOn1I2v18Rk4hxUBIj1 ia0D2MTWBZxE4OLNzxkf4xpA8l61DyolqSXorhefPlLoe1cAKNzV+iLMZmIeW1Z3H35r Q+L+wY5WbiWMPZb/xwG+bSkuQ3H2aD7mH70brzmQ0VaNXTbJkI7aiAxInU7aXsPGLF99 WKhU0JcRjBrKLMdEWaGQCk8R856nCbr7PWLpHkIaChOuFUmslydrOL+2dfVjbPJ3m5Bu 3VsVI8TeeF8nDshrY/QsDKwIDNaumQSlgm+j+lX30pHp5DW3E6Ovbfh8JwbrUHAngtWw xwVg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714490986; x=1715095786; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=R9DoQMK9q9pSbyMynIt4ms7bIdooJ2qc4sLnkNXJptA=; b=pTVX4ZFNVeFYKKGLW4EAA4ofMUKhBmeGrjD8p1d+C0WEAyfUlin7RarDuM1ual/pu1 O6b7JLuPhW43g/mGcH8zRglnekgViuUN7UMw/+tIHe+7dTR4Ay5wegjllYpH/L6F4VFy ZWjsdFJTXOFSSNWntQN+X0PU5VKcs3o+P3gE4q6DV39GrTfQL7Q8wRoMKXrt5OULkxwL nsIu65N3y7nTDUcyuzL7DUNJikICSsQzZyiRVEO3CHV/viNaPXf/Nb4Z2n2K4VZdZXgE GXdcIoIz6NO8SzSAey6sarKKbfFfrxuy45DHaGfPjCXRTrLIi+0epJP2EaZJO1nvQ610 WVHw== X-Forwarded-Encrypted: i=1; AJvYcCWBTw1F71fkNaAdC58YNdbcmgLTUFus+pLidHgN2RZx5+Y0JkFta8Ju4R7sieUAQ/fIGC/0db0ATIR7IIAmhwBdV4A= X-Gm-Message-State: AOJu0YwGzaWwTDcu9adFw8AWqqomB5LsffL46U4DPIbwyGjWQph1+mhA mRrX7ds7Z5rW9ef8WeVSM2wuTlQdL015RzsfDsbWIJUzoDTk6IvxLKaf+TkzqfQ= X-Google-Smtp-Source: AGHT+IEfVsU4G6WPSdAEqHAEtBXu3BdO32Tb63+YZg+Op6JnqM528UxRdG8qYgDnfHJUc3CSaFON6A== X-Received: by 2002:a17:906:f6d9:b0:a55:5958:cb00 with SMTP id jo25-20020a170906f6d900b00a555958cb00mr2524314ejb.38.1714490986392; Tue, 30 Apr 2024 08:29:46 -0700 (PDT) Received: from raven.intern.cm-ag (p200300dc6f06e100023064fffe740809.dip0.t-ipconnect.de. [2003:dc:6f06:e100:230:64ff:fe74:809]) by smtp.gmail.com with ESMTPSA id a10-20020a1709066d4a00b00a52567ca1b6sm15278137ejt.94.2024.04.30.08.29.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Apr 2024 08:29:45 -0700 (PDT) From: Max Kellermann To: akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: willy@infradead.org, sfr@canb.auug.org, david@redhat.com.au, Max Kellermann Subject: [PATCH v5 00/15] Fast kernel headers: split linux/mm.h Date: Tue, 30 Apr 2024 17:29:16 +0200 Message-Id: <20240430152931.1137975-1-max.kellermann@ionos.com> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Stat-Signature: 1jbs6963ht4tn6qkcwx53rzcskz6j45a X-Rspam-User: X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: 178ED180006 X-HE-Tag: 1714490987-837166 X-HE-Meta: U2FsdGVkX1+oCwXmOnIY94dtxdl6lP0S+L4Yf4DUD2LE3HJ+Aul4aOp2ozQ3OBpcXXfd6cQ+BUC5Ejp5DQgXlzkNFt1ElqLC0N9SxNnQP5mQX6EUwlNcdxd4yUbXgbGDRDcsqD16YsIXBsabuZu0J5xczANE9K6v/LNsZmIxWRAdZDiwddsRVQyQt7k84LqblLDEu1NFpyoa75qFP4GUic5hyfeUSKqm/MNEtTLLE0N4uzQDEx/xQuHxPjcJCO04Ksy7RyX+kGj2iqNbZ4vSIvL3PD4gsoAmVJGvXYADh1xdxMIsKW0gV3xfqkD7nBTEv/UkT5BNHciOIkFg8QJZfG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5PFxozL5iah2INs2lSil9xY/36/Aw= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: This 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 Hildrenbrand 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/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 + 75 files changed, 810 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