commit:     2e6314580e10fb5fd67c06c834ad99bab7686589
Author:     Kai Krakow <kai <AT> kaishome <DOT> de>
AuthorDate: Wed Jul 31 09:49:48 2024 +0000
Commit:     Joonas Niilola <juippis <AT> gentoo <DOT> org>
CommitDate: Thu Aug  8 14:12:42 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=2e631458

sys-fs/bees: update patchset

This updates the patchset for better memory fragmentation behavior and
also adds a patch to reduce logging pressure if a lot of new files have
been added. The latter patch is pending upstream.

Signed-off-by: Kai Krakow <kai <AT> kaishome.de>
Signed-off-by: Joonas Niilola <juippis <AT> gentoo.org>

 sys-fs/bees/bees-9999.ebuild                       |  6 +--
 ...ote-abandoned-toxic-match-to-debug-log-le.patch | 36 ++++++++++++++++++
 ...Work-around-kernel-memory-fragmentatio_v2.patch | 43 ++++++++++++++++++++++
 3 files changed, 82 insertions(+), 3 deletions(-)

diff --git a/sys-fs/bees/bees-9999.ebuild b/sys-fs/bees/bees-9999.ebuild
index 1b164eb56b08..e1d5da90f548 100644
--- a/sys-fs/bees/bees-9999.ebuild
+++ b/sys-fs/bees/bees-9999.ebuild
@@ -1,4 +1,4 @@
-# Copyright 1999-2023 Gentoo Authors
+# Copyright 1999-2024 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI=8
@@ -18,7 +18,6 @@ fi
 
 LICENSE="GPL-3"
 SLOT="0"
-IUSE=""
 
 DEPEND="
        >=sys-apps/util-linux-2.30.2
@@ -30,7 +29,8 @@ 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"
+       
"${FILESDIR}/0001-context-demote-abandoned-toxic-match-to-debug-log-le.patch"
+       
"${FILESDIR}/0002-HACK-crucible-Work-around-kernel-memory-fragmentatio_v2.patch"
 )
 
 pkg_pretend() {

diff --git 
a/sys-fs/bees/files/0001-context-demote-abandoned-toxic-match-to-debug-log-le.patch
 
b/sys-fs/bees/files/0001-context-demote-abandoned-toxic-match-to-debug-log-le.patch
new file mode 100644
index 000000000000..387ae7f1100c
--- /dev/null
+++ 
b/sys-fs/bees/files/0001-context-demote-abandoned-toxic-match-to-debug-log-le.patch
@@ -0,0 +1,36 @@
+From fad9230cea8a9970980c36b442b71b864e69ded3 Mon Sep 17 00:00:00 2001
+From: Kai Krakow <k...@kaishome.de>
+Date: Sun, 30 Jun 2024 16:27:20 +0200
+Subject: [PATCH 1/2] context: demote "abandoned toxic match" to debug log
+ level
+
+This log message creates a overwhelmingly lot of messages in the system
+journal, leading to write-back flushing storms under high activity. As
+it is a work-around message, it is probably only useful to developers,
+thus demote to debug level.
+
+This fixes latency spikes in desktop usage after adding a lot of new
+files, especially since systemd-journal starts to flush caches if it
+sees memory pressure.
+
+Signed-off-by: Kai Krakow <k...@kaishome.de>
+---
+ src/bees-context.cc | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/bees-context.cc b/src/bees-context.cc
+index 09ec152..2251783 100644
+--- a/src/bees-context.cc
++++ b/src/bees-context.cc
+@@ -471,7 +471,7 @@ BeesContext::scan_one_extent(const BeesFileRange &bfr, 
const Extent &e)
+ 
+                       // Hash is toxic
+                       if (found_addr.is_toxic()) {
+-                              BEESLOGWARN("WORKAROUND: abandoned toxic match 
for hash " << hash << " addr " << found_addr << " matching bbd " << bbd);
++                              BEESLOGDEBUG("WORKAROUND: abandoned toxic match 
for hash " << hash << " addr " << found_addr << " matching bbd " << bbd);
+                               // Don't push these back in because we'll never 
delete them.
+                               // Extents may become non-toxic so give them a 
chance to expire.
+                               // hash_table->push_front_hash_addr(hash, 
found_addr);
+-- 
+2.44.2
+

diff --git 
a/sys-fs/bees/files/0002-HACK-crucible-Work-around-kernel-memory-fragmentatio_v2.patch
 
b/sys-fs/bees/files/0002-HACK-crucible-Work-around-kernel-memory-fragmentatio_v2.patch
new file mode 100644
index 000000000000..b62957c05291
--- /dev/null
+++ 
b/sys-fs/bees/files/0002-HACK-crucible-Work-around-kernel-memory-fragmentatio_v2.patch
@@ -0,0 +1,43 @@
+From 291574986ccfaff8b620f6baa185a567f2f0cfb5 Mon Sep 17 00:00:00 2001
+From: Kai Krakow <k...@kaishome.de>
+Date: Sun, 9 Jul 2023 12:24:40 +0200
+Subject: [PATCH 2/2] 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.
+
+v2:
+
+According to @Zygo:
+
+> Lately I've been running with vm.swappiness=0 and
+> BEES_MAX_EXTENT_REF_COUNT set to 9999. With those settings there's no
+> swapping at all.
+
+Link: https://github.com/Zygo/bees/issues/260#issuecomment-1627586574
+Link: https://github.com/Zygo/bees/issues/260#issuecomment-2068287231
+Signed-off-by: Kai Krakow <k...@kaishome.de>
+---
+ src/bees.h | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/bees.h b/src/bees.h
+index 4dbc005..a3c3872 100644
+--- a/src/bees.h
++++ b/src/bees.h
+@@ -96,7 +96,7 @@ const double BEES_TOO_LONG = 5.0;
+ const double BEES_TOXIC_SYS_DURATION = 0.1;
+ 
+ // Maximum number of refs to a single extent
+-const size_t BEES_MAX_EXTENT_REF_COUNT = (16 * 1024 * 1024 / 24) - 1;
++const size_t BEES_MAX_EXTENT_REF_COUNT = (10000) - 1;
+ 
+ // How long between hash table histograms
+ const double BEES_HASH_TABLE_ANALYZE_INTERVAL = BEES_STATS_INTERVAL;
+-- 
+2.44.2
+

Reply via email to