From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) (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 D2C7C3B101C for ; Sat, 22 Aug 2026 13:54:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.70 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787406850; cv=none; b=OFrMuHBc+HT93esvOU5YpkwnGkF5BW1z5Fk72VBg+TEN+9YrKxuQQTPtSdSZQlrdcV4Wtv3skR81ckyHl6FV20s/WZ0juhOP1n/+soW2CTSo5bFYXIPhXnkhKS4SwSlz3P76UKTIn3/kj9LnQwfV1tl7pPmL/CAccasz+l0yOA4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787406850; c=relaxed/simple; bh=AinIhOYRxdY9RQ11Fott/8QSuWqVe/WuXNQsPZeV7zM=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=TJz3mCfXjrNfYb3lZQXru2x1cPx9OPF7ynYnUP93N9z3E/k3UfHxOhrkO+VB1MOubqDRm4+mjlmr9IHY6XNGAC3V7YQwLU1CUODtg7i4vnZTQDzqlV30w49H0eXIug5+sLUbkxW7ku0x8PblstJ9hrVBrFeyS0uD2qHURFJ/ZYg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--ardb.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=Q+F6MFYP; arc=none smtp.client-ip=209.85.128.70 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--ardb.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="Q+F6MFYP" Received: by mail-wm1-f70.google.com with SMTP id 5b1f17b1804b1-4994d67d0e3so12756775e9.2 for ; Sat, 22 Aug 2026 06:54:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1787406847; x=1788011647; darn=vger.kernel.org; h=content-type:cc:to:from:subject:message-id:references:mime-version :in-reply-to:date:from:to:cc:subject:date:message-id:reply-to :content-type; bh=Ei9aAhCyyRq9nczFsrb/oQ6US+9hvk5Rs5Wuqs8mBgQ=; b=Q+F6MFYPnjjZXTQBjiiGUuu8ifKu+d2kjpTf8wEmN9T/27lQ3bX+8jFbm/lSV26u/8 Y7rLXnkEqXCKBOYXRtXhWbaBYqN9kB1kTDgS27DvF0KMlCq5LZqFt3NK41HTgdAEuZmB hD/zt3G4STNdV23XqM+GJ+VyL+ku3fai32Cxft1XBdWtgL9O5jqtzFKBSVCdTpAMXEYr 93lVOgx0QwUXbZSutMimuDsVPNzwAa0i+whuL9+RsTIsNUNn4ElIMjzxz9T2Msid+zGn 3CSb5ym2iWljxZE6uFz/DGKJu1xa6uJUheAsiBWej9qgi/FRRj7ZSSUrac8a7AMUxbv5 zXxA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1787406847; x=1788011647; h=content-type:cc:to:from:subject:message-id:references:mime-version :in-reply-to:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=Ei9aAhCyyRq9nczFsrb/oQ6US+9hvk5Rs5Wuqs8mBgQ=; b=bK5+c5PescPXa3eXYFKafJCvKX/ojRQWJ6iQtuldsinGONGigcqL03K9XsbHo1IPFJ 8aZTP3SWwzl/jn+CSWdIGu5MEYHDw/kOlXj92xahbxZ1sHSvK3lkmbZ0hbq8sypVD3AM llOXnqMSByT93P7XVciGONomcxN8393krtztMzsiEmfVT8qlkniaZzdEoEt57cPnhX0S 1a7frjjR/vrFTX5Xk2bTMmlJGiTr/Ze9rLkNbUcFKWKLjoiEbJaZUP/hec+BWEhpZQNr NdGxsn4breRMzPra55LXJ3prBuD40q80JiFmaTSJwUL9cmAP2Earity9XV16Jja0uAP1 rbuw== X-Gm-Message-State: AFuF++leT3j3o2Yau07erBwuHdtfsZRzLdFVy93QCT1xYubK60n9kUcI B7ijWfptSlg42liznDWCGQe3r5xiHvSLFMli3OiAA8X2cuwgRwMCRirvZn96IovsJ/KHWvbtXCg B41MkcDKMK3PVztaCl4Sbm/H1P9IwqInh7JgZrwv23/cXR3JmyUOBMuMyZGUjOItuyn512Dae2B VnCOegRCDmKkwY1LExGlw0xOZprtxnQ36MVA== X-Received: from wmcu3.prod.google.com ([2002:a7b:c043:0:b0:499:8f0d:36d6]) (user=ardb job=prod-delivery.src-stubby-dispatcher) by 2002:a05:600c:8b77:b0:499:48bb:417e with SMTP id 5b1f17b1804b1-499b82f4163mr187118595e9.2.1787406846628; Sat, 22 Aug 2026 06:54:06 -0700 (PDT) Date: Sat, 22 Aug 2026 15:53:25 +0200 In-Reply-To: <20260822135323.795946-11-ardb+git@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20260822135323.795946-11-ardb+git@google.com> X-Developer-Key: i=ardb@kernel.org; a=openpgp; fpr=F43D03328115A198C90016883D200E9CA6329909 X-Developer-Signature: v=1; a=openpgp-sha256; l=1141; i=ardb@kernel.org; h=from:subject; bh=LLSSaN9rhZ2F3aT4P4AsB5UNc3JBgAb9PUajizskM3Y=; b=owGbwMvMwCVmkMcZplerG8N4Wi2JIatz5Y0AZ4svS9ISbTaf6Vvbffb640AuEdFH514lyFxeu vB339++jlIWBjEuBlkxRRaB2X/f7Tw9UarWeZYszBxWJpAhDFycAjCREiuG3+xHy5/ozft6vo39 a++HnWc27J26lnlODVv1x/cTz/MfferGyHBrod6fpd6OR87MNvD91aMtcLL+0Su90/UXLE4ohsc 1yXMBAA== X-Mailer: git-send-email 2.55.0.860.g4b6b3295ed-goog Message-ID: <20260822135323.795946-14-ardb+git@google.com> Subject: [RFC PATCH 3/9] module: Place MOD_TEXT before MOD_INIT_TEXT in enumeration From: Ard Biesheuvel To: linux-kernel@vger.kernel.org Cc: Ard Biesheuvel , Catalin Marinas , Will Deacon , Steven Rostedt , Masami Hiramatsu , Mark Rutland , Andrew Morton , Mike Rapoport , Luis Chamberlain , Petr Pavlu , Daniel Gomez , Sami Tolvanen , Aaron Tomlin , "=?UTF-8?q?Adrian=20Barna=C5=9B?=" , Ryan Roberts , Kevin Brodsky , linux-arm-kernel@lists.infradead.org, linux-trace-kernel@vger.kernel.org, linux-mm@kvack.org, linux-modules@vger.kernel.org Content-Type: text/plain; charset="UTF-8" From: Ard Biesheuvel Reorder enum mod_mem_type so that MOD_TEXT appears right before MOD_INIT_TEXT. This will result in MOD_INIT_TEXT being allocated right after MOD_TEXT when the allocation logic iterates over the memory types in enum declaration order. In a subsequent patch, this will be taken advantage of, by allocating .text and .init.text together, and freeing .init.text by truncating the allocation. Doing so without this reordering would likely result in more fragmentation, as the truncated .text allocation would be followed by .rodata and .data/.bss of the same module. Signed-off-by: Ard Biesheuvel --- 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 7566815fabbe..0336a46733dd 100644 --- a/include/linux/module.h +++ b/include/linux/module.h @@ -316,10 +316,10 @@ struct mod_tree_node { }; enum mod_mem_type { - MOD_TEXT = 0, - MOD_DATA, + MOD_DATA = 0, MOD_RODATA, MOD_RO_AFTER_INIT, + MOD_TEXT, MOD_INIT_TEXT, MOD_INIT_DATA, MOD_INIT_RODATA, -- 2.55.0.860.g4b6b3295ed-goog