linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] btrfs compression: reuse recently used workspace
@ 2014-06-24 15:00 Sergey Senozhatsky
  2014-06-24 15:00 ` Sergey Senozhatsky
  0 siblings, 1 reply; 3+ messages in thread
From: Sergey Senozhatsky @ 2014-06-24 15:00 UTC (permalink / raw)
  To: Chris Mason; +Cc: Josef Bacik, linux-btrfs, linux-kernel, Sergey Senozhatsky

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(-)

-- 
2.0.0.548.ge727dec


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH] btrfs compression: reuse recently used workspace
  2014-06-24 15:00 [PATCH] btrfs compression: reuse recently used workspace Sergey Senozhatsky
@ 2014-06-24 15:00 ` Sergey Senozhatsky
  2014-06-26 17:02   ` David Sterba
  0 siblings, 1 reply; 3+ messages in thread
From: Sergey Senozhatsky @ 2014-06-24 15:00 UTC (permalink / raw)
  To: Chris Mason; +Cc: Josef Bacik, linux-btrfs, linux-kernel, Sergey Senozhatsky

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'.

Signed-off-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
---
 fs/btrfs/compression.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/btrfs/compression.c b/fs/btrfs/compression.c
index 92371c4..1daea0b 100644
--- a/fs/btrfs/compression.c
+++ b/fs/btrfs/compression.c
@@ -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;
-- 
2.0.0.548.ge727dec


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] btrfs compression: reuse recently used workspace
  2014-06-24 15:00 ` Sergey Senozhatsky
@ 2014-06-26 17:02   ` David Sterba
  0 siblings, 0 replies; 3+ messages in thread
From: David Sterba @ 2014-06-26 17:02 UTC (permalink / raw)
  To: Sergey Senozhatsky; +Cc: Chris Mason, Josef Bacik, linux-btrfs, linux-kernel

On Wed, Jun 25, 2014 at 12:00:44AM +0900, Sergey Senozhatsky wrote:
> 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'.
> 
> Signed-off-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>

Makes sense to me,
Reviewed-by: David Sterba <dsterba@suse.cz>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-06-26 17:02 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-06-24 15:00 [PATCH] btrfs compression: reuse recently used workspace Sergey Senozhatsky
2014-06-24 15:00 ` Sergey Senozhatsky
2014-06-26 17:02   ` David Sterba

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).