From c816cafc00bd498ce57484659252cfab3803eeae Mon Sep 17 00:00:00 2001 From: jochen Date: Thu, 15 Oct 2026 22:43:32 +0200 Subject: [PATCH] =?UTF-8?q?The=20kernel=20module's=20transparent-huge-page?= =?UTF-8?q?s=20defaults=20to=20madvise,=20the=20mesh's=20chosen=20value=20?= =?UTF-8?q?(hq=20issue=20856,=20ADR=200381=20=C2=A72,=20=C2=A73)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/kernel/README.md | 2 +- modules/kernel/cmd/kernel-tools/manifest_test.go | 8 ++++---- modules/kernel/module.json | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/modules/kernel/README.md b/modules/kernel/README.md index dddcebd4..09405354 100644 --- a/modules/kernel/README.md +++ b/modules/kernel/README.md @@ -20,7 +20,7 @@ lost its lease four times in 30 minutes. With `madvise`, only memory a program a | | what | notes | |---|---|---| -| setting | `transparent-huge-pages` | `always`, `madvise` or `never`. Default `always`, what the distribution's kernel boots with, so assigning the module changes nothing until a machine sets another value | +| setting | `transparent-huge-pages` | `always`, `madvise` or `never`. Default `madvise`, the value the mesh chose for every node (ADR 0381), not what the distribution's kernel boots with (`always`); a machine that needs another value is given it as its own setting, with its reason | | file | `${dir:state}/huge-pages` | the script, written from the setting: `apply` writes the mode to `/sys/kernel/mm/transparent_hugepage/enabled` and reads it back (a value that does not take fails the unit); `restore` gives back the mode found before the module first set it, kept in `${dir:state}/found` | | file | `/etc/systemd/system/mesh-kernel-huge-pages.service` | oneshot, early in boot (`sysinit.target`, before the services that fill the page cache); reloading it runs `apply`, stopping it runs `restore`, which also removes `found`. Sandboxed: the file system read-only but for the module's state (`/sys` stays writable), no home, no network, no new privileges; the journal's rotation goes over its local socket, which a private network leaves reachable | | service | `mesh-kernel-huge-pages.service` | running and enabled; **reloaded** when the script (so the setting) changes, so a new value is set directly and never passes back through the found one; restarted only when the unit changes; its health is the unit's | diff --git a/modules/kernel/cmd/kernel-tools/manifest_test.go b/modules/kernel/cmd/kernel-tools/manifest_test.go index bcdc42e3..022877fa 100644 --- a/modules/kernel/cmd/kernel-tools/manifest_test.go +++ b/modules/kernel/cmd/kernel-tools/manifest_test.go @@ -1,7 +1,7 @@ package main -// The module's shape (novox/hq issue 746): the setting's default is what the kernel boots with, so -// assigning the module changes nothing until a machine sets another value; the script is written into the +// The module's shape (novox/hq issue 746): the setting's default is madvise, the value the mesh chose +// (ADR 0381), not what the kernel boots with; the script is written into the // module's own state and run by a sandboxed oneshot unit that is reloaded (applied again) when the script, // and so the setting, changes and restarted only when the unit does; and the script itself sets, verifies, // gives back and refuses as it says. @@ -14,10 +14,10 @@ import ( "testing" ) -func TestTheDefaultChangesNothingAndTheUnitFollowsTheSetting(t *testing.T) { +func TestTheDefaultIsMadviseAndTheUnitFollowsTheSetting(t *testing.T) { m := manifest(t) s := m.Settings["transparent-huge-pages"] - if s["kind"] != "preference" || s["default"] != "always" || s["why"] == "" { + if s["kind"] != "preference" || s["default"] != "madvise" || s["why"] == "" { t.Fatalf("the setting: %v", s) } var ids []string diff --git a/modules/kernel/module.json b/modules/kernel/module.json index 15077979..0f2a0f01 100644 --- a/modules/kernel/module.json +++ b/modules/kernel/module.json @@ -7,8 +7,8 @@ "settings": { "transparent-huge-pages": { "kind": "preference", - "default": "always", - "why": "always is what the distribution's kernel boots with, so assigning the module changes nothing until a machine sets another value; madvise gives huge pages only to programs that ask for them, which stops a small write to a mapped file (the journal) dirtying and writing back a whole 2 MiB page on a machine whose disks are slow (novox/hq issue 746)" + "default": "madvise", + "why": "madvise is the value the mesh chose for every node (novox/hq ADR 0381), not the always the distribution's kernel boots with; a machine that needs another value is given it as its own setting; madvise gives huge pages only to programs that ask for them, which stops a small write to a mapped file (the journal) dirtying and writing back a whole 2 MiB page on a machine whose disks are slow (novox/hq issue 746)" } }, "tools": [