lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20241114210649.71377-2-flo@geekplace.eu>
Date: Thu, 14 Nov 2024 22:06:48 +0100
From: Florian Schmaus <flo@...kplace.eu>
To: Kent Overstreet <kent.overstreet@...ux.dev>
Cc: Florian Schmaus <flo@...kplace.eu>,
	linux-bcachefs@...r.kernel.org,
	linux-kernel@...r.kernel.org
Subject: [PATCH 2/2] bcachefs: Set rebalance thread to SCHED_BATCH and nice 19

Set the rebalance thread's scheduling class to BATCH, which means it
could experience a higher scheduling latency. However, it reduces
preemption events of running threads.

And while the rebalance thread is ually not compute bound, it does
cause a considerable amount of I/O. By increasing its nice level from
0 to 19 we also implicitly reduce the thread's best-effort I/O
scheduling class level from 4 to 7. Therefore, the rebalance thread's
I/O operations will be deprioritized over standard I/O operations.

Signed-off-by: Florian Schmaus <flo@...kplace.eu>
---
 fs/bcachefs/rebalance.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/fs/bcachefs/rebalance.c b/fs/bcachefs/rebalance.c
index 4adc74cd3f70..b26c68007c5a 100644
--- a/fs/bcachefs/rebalance.c
+++ b/fs/bcachefs/rebalance.c
@@ -22,6 +22,7 @@
 
 #include <linux/freezer.h>
 #include <linux/kthread.h>
+#include <linux/sched.h>
 #include <linux/sched/cputime.h>
 
 /* bch_extent_rebalance: */
@@ -662,6 +663,8 @@ int bch2_rebalance_start(struct bch_fs *c)
 	if (ret)
 		return ret;
 
+	sched_set_batch(p, 19);
+
 	get_task_struct(p);
 	rcu_assign_pointer(c->rebalance.thread, p);
 	wake_up_process(p);
-- 
2.45.2


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ