Skip to content
This repository was archived by the owner on Jul 24, 2024. It is now read-only.

Commit 6ac35b3

Browse files
committed
[orabos] Also persist hugepages from proc
1 parent 142e2fa commit 6ac35b3

File tree

1 file changed

+10
-4
lines changed
  • features/orabos/file.include/opt/orabos

1 file changed

+10
-4
lines changed

features/orabos/file.include/opt/orabos/init.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,15 +68,21 @@ def setup_memory():
6868
return
6969

7070
cmdline = pathlib.Path("/proc/cmdline").read_text()
71-
m = re.search(r"hugepages=\d+", cmdline)
72-
if not m:
71+
m = re.search(r"hugepages=(\d+)", cmdline)
72+
hugepages=0
73+
if m:
74+
hugepages=int(m[1])
75+
else:
76+
hugepages=int(pathlib.Path("/proc/sys/vm/nr_hugepages").read_text())
77+
78+
if hugepages<=0:
7379
return
7480

75-
cfg.write_text(f'CMDLINE_LINUX="$CMDLINE_LINUX {m.group(0)}"\n')
81+
cfg.write_text(f'CMDLINE_LINUX="$CMDLINE_LINUX hugepages={hugepages}"\n')
7682

7783
for entry in pathlib.Path("/efi/loader/entries").glob("*.conf"):
7884
old = entry.read_text()
79-
new = re.sub(r"^options.*", f"\\g<0> {m.group(0)}", old, flags=re.M)
85+
new = re.sub(r"^options.*", f"\\g<0> hugepages={hugepages}", old, flags=re.M)
8086
entry.write_text(new)
8187

8288
setup_ovs()

0 commit comments

Comments
 (0)