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: <20230226160259.18354-7-ammarfaizi2@gnuweeb.org>
Date:   Sun, 26 Feb 2023 23:02:59 +0700
From:   Ammar Faizi <ammarfaizi2@...weeb.org>
To:     Chris Mason <clm@...com>, Josef Bacik <josef@...icpanda.com>,
        David Sterba <dsterba@...e.com>, Tejun Heo <tj@...nel.org>
Cc:     Ammar Faizi <ammarfaizi2@...weeb.org>,
        Lai Jiangshan <jiangshanlai@...il.com>,
        Filipe Manana <fdmanana@...e.com>,
        Linux Btrfs Mailing List <linux-btrfs@...r.kernel.org>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
        Linux Fsdevel Mailing List <linux-fsdevel@...r.kernel.org>,
        GNU/Weeb Mailing List <gwml@...r.gnuweeb.org>
Subject: [RFC PATCH v1 6/6] btrfs: Add `BTRFS_DEFAULT_MAX_THREAD_POOL_SIZE` macro

Currently, the default max thread pool size is hardcoded as 8. This
number is not only used in one place. Keep the default max thread pool
size in sync by introducing a new macro.

Signed-off-by: Ammar Faizi <ammarfaizi2@...weeb.org>
---
 fs/btrfs/async-thread.h | 2 ++
 fs/btrfs/disk-io.c      | 3 ++-
 fs/btrfs/super.c        | 3 ++-
 3 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/fs/btrfs/async-thread.h b/fs/btrfs/async-thread.h
index 2b8a76fa75ef9e69..f11c3b36568053be 100644
--- a/fs/btrfs/async-thread.h
+++ b/fs/btrfs/async-thread.h
@@ -9,6 +9,8 @@
 
 #include <linux/workqueue.h>
 
+#define BTRFS_DEFAULT_MAX_THREAD_POOL_SIZE 8
+
 struct btrfs_fs_info;
 struct btrfs_workqueue;
 struct btrfs_work;
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
index 1bb1db461a30fa71..4f4ddc8e088b08ec 100644
--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -2957,7 +2957,8 @@ void btrfs_init_fs_info(struct btrfs_fs_info *fs_info)
 	btrfs_init_ref_verify(fs_info);
 
 	fs_info->thread_pool_size = min_t(unsigned long,
-					  num_online_cpus() + 2, 8);
+					  num_online_cpus() + 2,
+					  BTRFS_DEFAULT_MAX_THREAD_POOL_SIZE);
 
 	INIT_LIST_HEAD(&fs_info->ordered_roots);
 	spin_lock_init(&fs_info->ordered_root_lock);
diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c
index 34b7c5810d34d624..bf4be383e289ef6c 100644
--- a/fs/btrfs/super.c
+++ b/fs/btrfs/super.c
@@ -333,7 +333,8 @@ static void adjust_default_thread_pool_size(struct btrfs_fs_info *info)
 	}
 
 	old_thread_pool_size = info->thread_pool_size;
-	new_thread_pool_size = min_t(unsigned long, total_usable_cpu + 2, 8);
+	new_thread_pool_size = min_t(unsigned long, total_usable_cpu + 2,
+				     BTRFS_DEFAULT_MAX_THREAD_POOL_SIZE);
 
 	if (old_thread_pool_size == new_thread_pool_size)
 		return;
-- 
Ammar Faizi

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ