Skip to contentSkip to conversation

btrfs compression: reuse recently used workspace

PATCH New Sergey Senozhatsky 2 participants 3 messages Jun 24, 2014 – Jun 26, 2014 Btrfs file system

lore
Share & tools
lore
#0 lore raw

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
#1 lore raw

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
index 92371c4..1daea0b 100644
@@ -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