mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-24 07:31:41 +00:00
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>
This commit is contained in:
parent
d05e5a4dad
commit
35d8ba6629
2 changed files with 73 additions and 34 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue