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

Commit

Permalink
[orabos] Also persist hugepages from proc
Browse files Browse the repository at this point in the history
  • Loading branch information
fwiesel committed Jul 18, 2024
1 parent 5967a01 commit f26de93
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions features/orabos/file.include/opt/orabos/init.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,15 +68,21 @@ def setup_memory():
return

cmdline = pathlib.Path("/proc/cmdline").read_text()
m = re.search(r"hugepages=\d+", cmdline)
if not m:
m = re.search(r"hugepages=(\d+)", cmdline)
hugepages=0
if m:
hugepages=int(m[1])
else:
hugepages=int(pathlib.Path("/proc/sys/vm/nr_hugepages").read_text())

if hugepages<=0:
return

cfg.write_text(f'CMDLINE_LINUX="$CMDLINE_LINUX {m.group(0)}"\n')
cfg.write_text(f'CMDLINE_LINUX="$CMDLINE_LINUX hugepages={hugepages}"\n')

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

setup_ovs()
Expand Down

0 comments on commit f26de93

Please sign in to comment.