Skip to content

Commit

Permalink
Merge 'main' into gsoc-overlay-handling-with-fuse-overlayfs-dev
Browse files Browse the repository at this point in the history
  • Loading branch information
PhilippWendler committed Sep 2, 2024
2 parents e0833b3 + b3debbe commit 147b4e2
Show file tree
Hide file tree
Showing 10 changed files with 59 additions and 16 deletions.
7 changes: 2 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,5 @@
/BenchExec.egg-info
/.coverage*
/coverage
/.pytype
.idea
node_modules/
/contrib/vcloud/lib/ivy*.jar
/contrib/vcloud/lib/vcloud-jars
/coverage.xml
/.idea
2 changes: 1 addition & 1 deletion .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ stages:
coverage_format: cobertura
path: coverage.xml

tests:cgroups1:python-3.8:
tests:cgroupsv1:python-3.8:
<<: *tests-cgroupsv1
variables:
PYTHON_VERSION: '3.8'
Expand Down
4 changes: 2 additions & 2 deletions benchexec/cgroups.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ def handle_errors(self, critical_cgroups):
pass

@abstractmethod
def create_fresh_child_cgroup(self, subsystems):
def create_fresh_child_cgroup(self, subsystems, prefix=None):
pass

@abstractmethod
Expand Down Expand Up @@ -356,7 +356,7 @@ def add_task(self, pid):
def kill_all_tasks(self):
pass

def create_fresh_child_cgroup(self, subsystems):
def create_fresh_child_cgroup(self, subsystems, prefix=None):
return self

def create_fresh_child_cgroup_for_delegation(self):
Expand Down
21 changes: 14 additions & 7 deletions benchexec/cgroupsv2.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ def initialize():
else:
# No usable cgroup. We might still be able to continue if we actually
# do not require cgroups for benchmarking. So we do not fail here
# but return an instance that will on produce an error later.
# but return an instance that will only produce an error later.
return CgroupsV2({})

# Now we are the only process in this cgroup. In order to make it usable for
Expand Down Expand Up @@ -562,6 +562,12 @@ def raise_error(e):
# On cgroupsv2, frozen processes can still be killed, so this is all we need to
# do.
util.write_file("1", self.path, "cgroup.freeze", force=True)
# According to Lennart Poettering, this is not enough:
# https://lwn.net/Articles/855312/
# But we never encountered any problems, and new kernels have cgroup.kill
# anyway (since 5.14). So it is probably not worth to fix it and instead
# we just eventually require kernel 5.14 for cgroupsv2
# (before 5.19 memory measurements are missing as well).
keep_child = self._delegated_to.path if self._delegated_to else None
for child_cgroup in recursive_child_cgroups(self.path):
kill_all_tasks_in_cgroup(child_cgroup)
Expand All @@ -587,12 +593,13 @@ def read_max_mem_usage(self):
return None

def _read_pressure_stall_information(self, subsystem):
for line in open(self.path / (subsystem + ".pressure")):
if line.startswith("some "):
for item in line.split(" ")[1:]:
k, v = item.split("=")
if k == "total":
return Decimal(v) / 1_000_000
with open(self.path / (subsystem + ".pressure")) as pressure_file:
for line in pressure_file:
if line.startswith("some "):
for item in line.split(" ")[1:]:
k, v = item.split("=")
if k == "total":
return Decimal(v) / 1_000_000
return None

def read_mem_pressure(self):
Expand Down
9 changes: 9 additions & 0 deletions benchexec/tablegenerator/react-table/.rgignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# This file is part of BenchExec, a framework for reliable benchmarking:
# https://github.com/sosy-lab/benchexec
#
# SPDX-FileCopyrightText: 2024 Dirk Beyer <https://www.sosy-lab.org>
#
# SPDX-License-Identifier: Apache-2.0

/build
/src/tests/__snapshots__/
9 changes: 9 additions & 0 deletions benchexec/tablegenerator/test_integration/.rgignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# This file is part of BenchExec, a framework for reliable benchmarking:
# https://github.com/sosy-lab/benchexec
#
# SPDX-FileCopyrightText: 2024 Dirk Beyer <https://www.sosy-lab.org>
#
# SPDX-License-Identifier: Apache-2.0

/expected
/results
9 changes: 9 additions & 0 deletions contrib/vcloud/lib/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# This file is part of BenchExec, a framework for reliable benchmarking:
# https://github.com/sosy-lab/benchexec
#
# SPDX-FileCopyrightText: 2007-2024 Dirk Beyer <https://www.sosy-lab.org>
#
# SPDX-License-Identifier: Apache-2.0

/ivy*.jar
/vcloud-jars
7 changes: 6 additions & 1 deletion doc/INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,10 @@ For other distributions, please read the following detailed requirements.

Except on Ubuntu, the full feature set of BenchExec is only usable
on **Linux 5.11 or newer**, so we suggest at least this kernel version.
And if your system is using cgroups v2 (cf. below),
the full feature set requires **Linux 5.19 or newer**.

On older kernels, you need to avoid using the kernel-based overlay filesystem (cf. below),
On kernels older than 5.11, you need to avoid using the kernel-based overlay filesystem (cf. below),
all other features are supported.
However, we strongly recommend to use at least **Linux 4.14 or newer**
because it reduces the overhead of BenchExec's memory measurements and limits.
Expand Down Expand Up @@ -219,6 +221,9 @@ echo 'GRUB_CMDLINE_LINUX_DEFAULT="${GRUB_CMDLINE_LINUX_DEFAULT} systemd.unified_
sudo update-grub
```

Furthermore, with cgroups v2 Linux 5.19 or newer is required
in order to have memory measurements.

### Setting up Cgroups v2 on Machines with systemd

This applies for example for Ubuntu 21.10 and newer,
Expand Down
6 changes: 6 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -72,5 +72,11 @@ ignore = [
]

[tool.pytest.ini_options]
filterwarnings = [
"error",
# TODO cf. https://github.com/sosy-lab/benchexec/issues/1073
# To make warning visible change "ignore" to "default".
"ignore:subprocess .* is still running:ResourceWarning",
]
python_files = ["test_*.py", "test_integration/__init__.py", "test.py"]
norecursedirs = ["contrib/p4/docker_files", "build", "benchexec/tablegenerator/react-table"]
1 change: 1 addition & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ license_files =
packages = benchexec, benchexec.tablegenerator, benchexec.tools
install_requires =
PyYAML >= 3.12
python_requires = >= 3.8
zip_safe = True

[options.extras_require]
Expand Down

0 comments on commit 147b4e2

Please sign in to comment.