]> git.kernelconcepts.de Git - karo-tx-linux.git/commit
btrfs: Add threshold workqueue based on kernel workqueue
authorQu Wenruo <quwenruo@cn.fujitsu.com>
Fri, 28 Feb 2014 02:46:05 +0000 (10:46 +0800)
committerJosef Bacik <jbacik@fb.com>
Mon, 10 Mar 2014 19:17:04 +0000 (15:17 -0400)
commit0bd9289c28c3b6a38f5a05a812afae0274674fa2
tree784a5bd81a9b6692f07f34604d83433b1ef8ff21
parent1ca08976ae94f3594dd7303584581cf8099ce47e
btrfs: Add threshold workqueue based on kernel workqueue

The original btrfs_workers has thresholding functions to dynamically
create or destroy kthreads.

Though there is no such function in kernel workqueue because the worker
is not created manually, we can still use the workqueue_set_max_active
to simulated the behavior, mainly to achieve a better HDD performance by
setting a high threshold on submit_workers.
(Sadly, no resource can be saved)

So in this patch, extra workqueue pending counters are introduced to
dynamically change the max active of each btrfs_workqueue_struct, hoping
to restore the behavior of the original thresholding function.

Also, workqueue_set_max_active use a mutex to protect workqueue_struct,
which is not meant to be called too frequently, so a new interval
mechanism is applied, that will only call workqueue_set_max_active after
a count of work is queued. Hoping to balance both the random and
sequence performance on HDD.

Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
Tested-by: David Sterba <dsterba@suse.cz>
Signed-off-by: Josef Bacik <jbacik@fb.com>
fs/btrfs/async-thread.c
fs/btrfs/async-thread.h