btrfs compression: reuse recently used workspace
PATCH 1/1 btrfs compression: reuse recently used workspace
Hello,
Whenever possible, find_workspace() returns the first idle workspace; and free_workspace() puts workspace to idle list tail. Put workspace to head of idle list instead. Hopefully, this will let to reuse most recently used workspace and avoid workspace->mem, ->buf, ->cbuf address translations.
p.s. This patch is theoretical, no testing has been performed in order to support this patch.
Sergey Senozhatsky (1):
btrfs compression: reuse recently used workspace
fs/btrfs/compression.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Signature · 1 line
2.0.0.548.ge727dec
PATCH 1/1 btrfs compression: reuse recently used workspace
Add compression workspace' in free_workspace() to idle_workspace' list head, instead of tail. So we have better chances to reuse most recently used `workspace'.
--- fs/btrfs/compression.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/btrfs/compression.c +1 -1
@@ -821,7 +821,7 @@ static void free_workspace(int type, struct list_head *workspace)spin_lock (workspace_lock);if (*num_workspace <num_online_cpus ()) { -list_add_tail (workspace, idle_workspace); +list_add (workspace, idle_workspace); (*num_workspace)++;spin_unlock (workspace_lock); goto wake;
Signature · 1 line
2.0.0.548.ge727dec
Quoted 5 lines · Sergey Senozhatsky
Add compression
workspace' in free_workspace() toidle_workspace' list head, instead of tail. So we have better chances to reuse most recently used `workspace'.Signed-off-by Sergey Senozhatsky <[email protected]>
Makes sense to me,