Skip to content

Commit 5f95f8e

Browse files
committed
unshare mounts to avoid systemd bottlenecking on mount discovery
1 parent 0362325 commit 5f95f8e

File tree

3 files changed

+10
-5
lines changed

3 files changed

+10
-5
lines changed

scripts/bin_test.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,6 @@ def _main():
8686

8787
registry = os.path.abspath(args.registry)
8888
with TestConfContext(registry=registry):
89-
print(f"Using registry: {registry}")
90-
print(f"Contents: {os.listdir(registry)}")
9189
run_tests()
9290

9391
check_test_results()

src/bench/bench.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ func run_benchmark(ctx *cli.Context, name string, seconds float64, tasks int, fu
9595
case err := <- errQ:
9696
if err != nil {
9797
errors += 1
98-
fmt.Printf(err.Error())
98+
fmt.Printf("%s\n", err.Error())
9999
} else {
100100
successes += 1
101101
}
@@ -180,7 +180,7 @@ func BenchCommands() []cli.Command {
180180
parseq = "par"
181181
}
182182
amt := fmt.Sprintf("%d", functions)
183-
if functions > 1024 {
183+
if functions >= 1024 {
184184
amt = fmt.Sprintf("%dk", functions / 1024)
185185
}
186186
name := fmt.Sprintf("py%s-%s", amt, parseq)

src/main.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,9 +158,16 @@ func worker(ctx *cli.Context) error {
158158
if err != nil {
159159
return err
160160
}
161-
// holds attributes that will be used when os.StartProcess
161+
// holds attributes that will be used when os.StartProcess.
162+
// we use CLONE_NEWNS because ol creates many mount points.
163+
// we don't want them to show up in /proc/self/mountinfo
164+
// for systemd because systemd creates a service for each
165+
// mount point, which is a major overhead.
162166
attr := os.ProcAttr{
163167
Files: []*os.File{nil, f, f},
168+
Sys: &syscall.SysProcAttr{
169+
Unshareflags: syscall.CLONE_NEWNS,
170+
},
164171
}
165172
cmd := []string{}
166173
for _, arg := range os.Args {

0 commit comments

Comments
 (0)