[RFC PATCH v2 10/13] dm: Initialise swap_bios from the runtime PAGE_SIZE

From: Eric Curtin

Date: Tue Dec 01 2026 - 22:17:53 EST


From: Ryan Roberts <ryan.roberts@xxxxxxx>

DEFAULT_SWAP_BIOS is computed from PAGE_SIZE, so with arm64 boot-time
page size selection it is not a compile-time constant and cannot be used
as a static initialiser for swap_bios.

Define swap_bios with DEFINE_GLOBAL_PAGE_SIZE_VAR(), which keeps a
plain initialiser for a fixed page size and otherwise assigns the
default once the page size is known at boot.

Signed-off-by: Ryan Roberts <ryan.roberts@xxxxxxx>
Signed-off-by: Eric Curtin <eric.curtin@xxxxxxxxxx>
---
drivers/md/dm.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/md/dm.c b/drivers/md/dm.c
index 38eaae8ac9b4..d47412e0b957 100644
--- a/drivers/md/dm.c
+++ b/drivers/md/dm.c
@@ -126,7 +126,7 @@ EXPORT_SYMBOL_GPL(dm_bio_get_target_bio_nr);
static int dm_numa_node = DM_NUMA_NODE;

#define DEFAULT_SWAP_BIOS (8 * 1048576 / PAGE_SIZE)
-static int swap_bios = DEFAULT_SWAP_BIOS;
+static DEFINE_GLOBAL_PAGE_SIZE_VAR(int, swap_bios, DEFAULT_SWAP_BIOS);
static int get_swap_bios(void)
{
int latch = READ_ONCE(swap_bios);