Skip to content

Commit

Permalink
sabakan-cryptsetup: enable no_read_workqueue and no_write_workqueue
Browse files Browse the repository at this point in the history
We benchmarked dm-crypt device with no_read_workqueue and no_write_workqueue enabled,
and the performance improved for some workloads. There were not many workloads where
the performance dropped, so we enable them for the entire workload.

Co-authored-by: Toshikuni Fukaya <[email protected]>
  • Loading branch information
daichimukai and toshipp committed Jan 20, 2022
1 parent 3173a9f commit c1c6f98
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 1 deletion.
2 changes: 1 addition & 1 deletion mtest/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ PLACEMAT = /usr/bin/placemat2
GINKGO = $(GOPATH)/bin/ginkgo
ETCD_VERSION = 3.5.1
PLACEMAT_DATADIR = /var/scratch/placemat
COREOS_VERSION := 2765.2.1
COREOS_VERSION := 3033.2.0
COREOS_KERNEL := $(abspath .)/flatcar_production_pxe.vmlinuz
COREOS_INITRD := $(abspath .)/flatcar_production_pxe_image.cpio.gz
CT_VERSION = 0.6.1
Expand Down
26 changes: 26 additions & 0 deletions mtest/netboot_test.go
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
package mtest

import (
"bufio"
"bytes"
"encoding/json"
"errors"
"fmt"
"io"
"os"
"path/filepath"
"strings"
"time"

. "github.com/onsi/ginkgo"
Expand Down Expand Up @@ -65,6 +68,29 @@ func testNetboot() {
if err != nil {
return fmt.Errorf("%v: stderr=%s", err, stderr)
}
stdout, stderr, err = execAt(worker, "sudo", "dmsetup", "table", "/dev/mapper/crypt-*")
if err != nil {
return fmt.Errorf("%v: stderr=%s", err, stderr)
}
scanner := bufio.NewScanner(bytes.NewReader(stdout))
for scanner.Scan() {
hasNoReadWorkQueue := false
hasNoWriteWorkQueue := false
for _, field := range strings.Fields(scanner.Text()) {
if field == "no_read_workqueue" {
hasNoReadWorkQueue = true
}
if field == "no_write_workqueue" {
hasNoWriteWorkQueue = true
}
}
if !hasNoReadWorkQueue || !hasNoWriteWorkQueue {
return fmt.Errorf("no_read_workqueue or no_write_workqueue is not set: %s", scanner.Text())
}
}
if err = scanner.Err(); err != nil {
return fmt.Errorf("reading stdout: %w", err)
}
return nil
}, 6*time.Minute).Should(Succeed())
}
Expand Down
1 change: 1 addition & 0 deletions pkg/sabakan-cryptsetup/cmd/cryptsetup.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ func Cryptsetup(d Disk, md *Metadata, ek, tpmKek []byte) error {
// https://gitlab.com/cryptsetup/cryptsetup/wikis/DMCrypt
//"--sector-size=" + strconv.Itoa(d.SectorSize()),
"--allow-discards",
"--perf-no_read_workqueue", "--perf-no_write_workqueue",
"open", "--type=plain", d.Device(), d.CryptName(),
}
cmd := exec.Command(cryptsetupCmd, args...)
Expand Down

0 comments on commit c1c6f98

Please sign in to comment.