Merge pull request 'The kernel module's transparent-huge-pages defaults to madvise (hq issue 856, ADR 0381)' (#321) from fix/856-the-kernel-module-runs-everywhere into main
This commit was merged in pull request #321.
This commit is contained in:
@@ -20,7 +20,7 @@ lost its lease four times in 30 minutes. With `madvise`, only memory a program a
|
|||||||
|
|
||||||
| | what | notes |
|
| | 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 | `${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 |
|
| 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 |
|
| 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 |
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
// The module's shape (novox/hq issue 746): the setting's default is what the kernel boots with, so
|
// The module's shape (novox/hq issue 746): the setting's default is madvise, the value the mesh chose
|
||||||
// assigning the module changes nothing until a machine sets another value; the script is written into the
|
// (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,
|
// 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,
|
// 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.
|
// gives back and refuses as it says.
|
||||||
@@ -14,10 +14,10 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestTheDefaultChangesNothingAndTheUnitFollowsTheSetting(t *testing.T) {
|
func TestTheDefaultIsMadviseAndTheUnitFollowsTheSetting(t *testing.T) {
|
||||||
m := manifest(t)
|
m := manifest(t)
|
||||||
s := m.Settings["transparent-huge-pages"]
|
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)
|
t.Fatalf("the setting: %v", s)
|
||||||
}
|
}
|
||||||
var ids []string
|
var ids []string
|
||||||
|
|||||||
@@ -7,8 +7,8 @@
|
|||||||
"settings": {
|
"settings": {
|
||||||
"transparent-huge-pages": {
|
"transparent-huge-pages": {
|
||||||
"kind": "preference",
|
"kind": "preference",
|
||||||
"default": "always",
|
"default": "madvise",
|
||||||
"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)"
|
"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": [
|
"tools": [
|
||||||
|
|||||||
Reference in New Issue
Block a user