summaryrefslogtreecommitdiffstats
path: root/fs/btrfs/async-thread.h
diff options
context:
space:
mode:
authorChris Mason <chris.mason@oracle.com>2008-06-12 02:21:24 +0200
committerChris Mason <chris.mason@oracle.com>2008-09-25 17:04:03 +0200
commit35d8ba66294ff2a53c17337a1aa1ff6739492f41 (patch)
tree40297c7917bb0425e76030e54418a934b1225299 /fs/btrfs/async-thread.h
parentBtrfs: Add backport for the kthread work on kernels older than 2.6.20 (diff)
downloadlinux-35d8ba66294ff2a53c17337a1aa1ff6739492f41.tar.xz
linux-35d8ba66294ff2a53c17337a1aa1ff6739492f41.zip
Btrfs: Worker thread optimizations
This changes the worker thread pool to maintain a list of idle threads, avoiding a complex search for a good thread to wake up. Threads have two states: idle - we try to reuse the last thread used in hopes of improving the batching ratios busy - each time a new work item is added to a busy task, the task is rotated to the end of the line. Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/async-thread.h')
-rw-r--r--fs/btrfs/async-thread.h7
1 files changed, 4 insertions, 3 deletions
diff --git a/fs/btrfs/async-thread.h b/fs/btrfs/async-thread.h
index 52fc9da0f9e7..3436ff897597 100644
--- a/fs/btrfs/async-thread.h
+++ b/fs/btrfs/async-thread.h
@@ -60,11 +60,12 @@ struct btrfs_workers {
/* max number of workers allowed. changed by btrfs_start_workers */
int max_workers;
+ /* once a worker has this many requests or fewer, it is idle */
+ int idle_thresh;
+
/* list with all the work threads */
struct list_head worker_list;
-
- /* the last worker thread to have something queued */
- struct btrfs_worker_thread *last;
+ struct list_head idle_list;
/* lock for finding the next worker thread to queue on */
spinlock_t lock;