summaryrefslogtreecommitdiff
path: root/sys-fs
diff options
context:
space:
mode:
authorKai Krakow <kai@kaishome.de>2023-07-09 12:40:09 +0200
committerSam James <sam@gentoo.org>2023-07-10 04:52:55 +0100
commit76545a0fd15d35ad830510b7f29a0ed1cc918b94 (patch)
treeb343627be6ce2e7ac3a826cee3c15e7c2cd77969 /sys-fs
parentsys-fs/bees: update 9999 (diff)
downloadgentoo-76545a0fd15d35ad830510b7f29a0ed1cc918b94.tar.gz
gentoo-76545a0fd15d35ad830510b7f29a0ed1cc918b94.tar.bz2
gentoo-76545a0fd15d35ad830510b7f29a0ed1cc918b94.zip
sys-fs/bees: Add memory fragmentation work-around
Signed-off-by: Kai Krakow <kai@kaishome.de> Signed-off-by: Sam James <sam@gentoo.org>
Diffstat (limited to 'sys-fs')
-rw-r--r--sys-fs/bees/bees-9999.ebuild14
-rw-r--r--sys-fs/bees/files/0001-HACK-crucible-Work-around-kernel-memory-fragmentatio.patch34
2 files changed, 48 insertions, 0 deletions
diff --git a/sys-fs/bees/bees-9999.ebuild b/sys-fs/bees/bees-9999.ebuild
index 65c3cbecea85..1b164eb56b08 100644
--- a/sys-fs/bees/bees-9999.ebuild
+++ b/sys-fs/bees/bees-9999.ebuild
@@ -29,6 +29,10 @@ RDEPEND="${DEPEND}"
CONFIG_CHECK="~BTRFS_FS"
ERROR_BTRFS_FS="CONFIG_BTRFS_FS: bees does currently only work with btrfs"
+PATCHES=(
+ "${FILESDIR}/0001-HACK-crucible-Work-around-kernel-memory-fragmentatio.patch"
+)
+
pkg_pretend() {
if [[ ${MERGE_TYPE} != buildonly ]]; then
if kernel_is -lt 4 11; then
@@ -66,6 +70,16 @@ pkg_pretend() {
ewarn "https://github.com/Zygo/bees/blob/master/docs/btrfs-kernel.md"
ewarn
fi
+ if kernel_is -gt 5 15 106; then
+ if kernel_is -lt 6 3 10; then
+ ewarn "With kernel versions 5.15.107 or later, there is a memory fragmentation"
+ ewarn "issue with LOGICAL_INO which can lead to cache thrashing and cause IO"
+ ewarn "latency spikes. This version ships with a work-around at the cost of not"
+ ewarn "handling highly duplicated filesystems that well. More details:"
+ ewarn "https://github.com/Zygo/bees/issues/260"
+ ewarn
+ fi
+ fi
elog "Bees recommends running the latest current kernel for performance and"
elog "reliability reasons, see README.md."
diff --git a/sys-fs/bees/files/0001-HACK-crucible-Work-around-kernel-memory-fragmentatio.patch b/sys-fs/bees/files/0001-HACK-crucible-Work-around-kernel-memory-fragmentatio.patch
new file mode 100644
index 000000000000..0ceb5cbfc79e
--- /dev/null
+++ b/sys-fs/bees/files/0001-HACK-crucible-Work-around-kernel-memory-fragmentatio.patch
@@ -0,0 +1,34 @@
+From 10c2006e627b5bda74f9f8aca1a574aa0e0e1eaa Mon Sep 17 00:00:00 2001
+From: Kai Krakow <kai@kaishome.de>
+Date: Sun, 9 Jul 2023 12:24:40 +0200
+Subject: [PATCH] HACK: crucible: Work around kernel memory fragmentation
+
+According to @Zygo:
+
+> This will drastically reduce the number of reflinks bees can handle
+> to a single extent, but that size is beyond more than enough for most
+> filesystems. Making the buffer smaller may also reduce the size of
+> vmallocs which might be aggravating the kernel's memory manager.
+
+Link: https://github.com/Zygo/bees/issues/260#issuecomment-1627586574
+Signed-off-by: Kai Krakow <kai@kaishome.de>
+---
+ include/crucible/fs.h | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/include/crucible/fs.h b/include/crucible/fs.h
+index 6d1780b..5da7da0 100644
+--- a/include/crucible/fs.h
++++ b/include/crucible/fs.h
+@@ -65,7 +65,7 @@ namespace crucible {
+ };
+
+ struct BtrfsIoctlLogicalInoArgs {
+- BtrfsIoctlLogicalInoArgs(uint64_t logical, size_t buf_size = 16 * 1024 * 1024);
++ BtrfsIoctlLogicalInoArgs(uint64_t logical, size_t buf_size = 64 * 1024);
+
+ uint64_t get_flags() const;
+ void set_flags(uint64_t new_flags);
+--
+2.39.3
+