From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm2-f12.google.com (mail-wm2-f12.google.com [74.125.225.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E179C375F95 for ; Fri, 11 Sep 2026 14:42:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.225.140 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789137776; cv=none; b=EMw0pE87TkizVF6b/fDyT5N9x1OsRxJrWZiZiHLZDqEWbYZ++3sdGmOHRID4K2HUgTxwjYrPFZ6DOmn+MPqEKrQIl+jkZIZAQYSBpyU8zqqNBkh/fX/CknxldxB+SlsDcLcoJHtooz5v6yY2jpjXCQ1G+7pmPPOG6Fctgtcj5Lc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789137776; c=relaxed/simple; bh=Pxyy7SkaZki3YINbcV9JeBRCrEvwZclMHy2R8pz6HCY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=il4riSpemJ9AV2EyZPmq5TrZN3EjM43p65NkXn22+uKxsr7UAgUjW3p0IqBViHHzI1wTIe7IME5khI8g2DQK7YK9dOnSQzOz3EGgDlAPEj2YlzYfvd3fIAsjauwpuwKQCz95xj101mlX44So7ZdIoj1QHY9oyuZe4UX1tvs7TUg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com; spf=pass smtp.mailfrom=suse.com; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b=ZL0VJDNM; arc=none smtp.client-ip=74.125.225.140 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b="ZL0VJDNM" Received: by mail-wm2-f12.google.com with SMTP id 5b1f17b1804b1-49cd38e0f79so6055845e9.3 for ; Fri, 11 Sep 2026 07:42:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1789137771; x=1789742571; darn=vger.kernel.org; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from:from:to:cc:subject :date:message-id:reply-to:content-type; bh=hTOm27yE703mDClupAq0Z6AjkqEMN3v+AI9a1WnvGB0=; b=ZL0VJDNMASO1DSxTC+o2xJcHbmibbqqYvPu56dHYyLbXUbfWsxcAmqW5sX/GjIlTdu 4sSpWar5cV7eWlzFuO7/jYOpCMF9Li4vt2Dx+0oWaTCqL5rN5eQ7yIUDTa3Fb2upDT21 MRt9vvsB5l/PagSu0XAgVUMnzX9nEDszYc47tAqiIOXYORfvsbF/t74S1xOsRX4W9AWi tlYt57KeCqawvkXVDIMAu20DIH/DHhSlwlTsIQiL4Z9Xj795L8s8AFMCSBqrFBrleU/h HHctZDhoQDFOeGoZSxJg3BIZtZirNKo8DiSBkoDowWBFFOewMxBxoFH/cdPnQg6vJHxm QZZA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1789137771; x=1789742571; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=hTOm27yE703mDClupAq0Z6AjkqEMN3v+AI9a1WnvGB0=; b=Guk7W+/5bFiTBrROTZP6lGkgv04C6k+UzXfXNpzo0soeKAi2Fi0kkxS1b+y8vvHjO5 RJkCiUdEQF+XciqCehUX+z4F1+OWufBwL1OUXb1Jgj00qpfA48IYFanhxKrOEvnWrqgd MU63m6TULeGdjJAEE/XvOQTOphpanhdE7f0ssaEu5GVZ9XAa5dn+s9KqehPCdHHCSMC4 ylOUfsY9ReLtioSGlIMWYIuLyUQRiDeKvLWZLGRiG5nkXsSQSiHVQdAXecrx7YRvcFfg dctbW5CBrIvJxsNDEYr4WdrrWEC5YP6DpceuS934WI/rsxBp/ciSq6fEpdEXeF/rgcZj I+pg== X-Forwarded-Encrypted: i=1; AKwUvBynnpC6JHbOd5VgnnJd71gXd5+7CXLAluIKz4xCIhc0haHSoTe+i6x5SV8dtk04TgkVg9Cqr7el0DVhmWY=@vger.kernel.org X-Gm-Message-State: AFuF++nXNzG8hsD5G7SCeDDqtfy76HfTbQv5wN7Nzt1ozqS8si7xF1qV Aa3nzMEEMvpkaCKyqi+JA8L5vbcI8qBhvKDy+lGELkxHXtvz/16SPlml6Q18p9HC6aA= X-Gm-Gg: AYBFou1MbJXcSolyAUauJtmU6ig8n2yhcWwQ3Zzvv1bCzmMLaKSqlO37A4mkq3rc4ol shJjZCqLI9RfUhlHEOT1McwQ1QJtwpr1sCNOJ2GxYLNzTvwgGwnPuqr9yh/TQu24bXkzz1wQUpq y77jOI73nTdoA4QXUtMByxRaZ5O4ei14YMcWSAj17B2WK9PYFRHo5oc+uJ+zZka06sdagyDj0eB GOUuNRUSq+pCnxVnd80Sv8RP2bHPkHGPRw3vPUYXZSMReaYd1aNmlp6hMjBxHw8QlYK70jx5WPG 0aDLdvy1siMZbV2UhTmV8BKCvroA97vvKJEixx2u+yhWjOV5dwrJa6129RjyBe3K6bsSIgUT2XN rpfMmsLnGpk6oA9dHWC/havMWpBw8PVL1AcQeg0SMI67kz1LbV8H6IB1Zgu4me8E88QVcIxITA3 lJC0S7N9Si24PFCgB5x5ERmelxVURfEOxJgg5F0NLuz9kRWcOOIO63QvKLi3aVChA5qbvcZ8cX9 LhpgVA= X-Received: by 2002:a05:600c:a0b:b0:49c:e1f1:3dd5 with SMTP id 5b1f17b1804b1-49e618863bcmr93280275e9.4.1789137771393; Fri, 11 Sep 2026 07:42:51 -0700 (PDT) Received: from localhost.localdomain ([2001:af0:8000:1409:193:86:92:181]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-49e60ababd5sm107038405e9.4.2026.09.11.07.42.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Sep 2026 07:42:50 -0700 (PDT) From: Petr Pavlu To: Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, Heiko Carstens , Vasily Gorbik , Alexander Gordeev , Peter Huewe , Jarkko Sakkinen , Luis Chamberlain , Petr Pavlu , Daniel Gomez , Sami Tolvanen Cc: Xin Li , "H. Peter Anvin" , Andy Lutomirski , Christian Borntraeger , Sven Schnelle , Janosch Frank , Claudio Imbrenda , David Hildenbrand , Jason Gunthorpe , Aaron Tomlin , linux-s390@vger.kernel.org, kvm@vger.kernel.org, linux-integrity@vger.kernel.org, linux-modules@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 6/6] module: Limit ELF includes in linux/module.h to uapi/linux/elf.h Date: Fri, 11 Sep 2026 16:40:36 +0200 Message-ID: <20260911-module-include-elf-v2-6-954c732975fb@suse.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260911-module-include-elf-v2-0-954c732975fb@suse.com> References: <20260911-module-include-elf-v2-0-954c732975fb@suse.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit linux/module.h appears in roughly 15k #include directives across the kernel. This makes it a "hot" header, so it should avoid pulling in unnecessary definitions. The header currently includes linux/elf.h but this is largely unnecessary because it requires only the base ELF structures, such as Elf_Ehdr and Elf_Sym, which are declared in uapi/linux/elf.h. Replace the linux/elf.h include with uapi/linux/elf.h. On x86_64_defconfig, including linux/module.h alone results in 2.2 MB of preprocessed data. This change reduces that to 1.5 MB. Signed-off-by: Petr Pavlu Reviewed-by: Aaron Tomlin --- include/linux/module.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/linux/module.h b/include/linux/module.h index 96cc98568eea..1ec9e121a24b 100644 --- a/include/linux/module.h +++ b/include/linux/module.h @@ -17,7 +17,6 @@ #include #include #include -#include #include #include #include @@ -29,8 +28,9 @@ #include #include #include - #include + +#include #include #define MODULE_NAME_LEN __MODULE_NAME_LEN -- 2.55.0