All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] fs: reclaim least recently used dquots
@ 2018-06-08  1:37 Shakeel Butt
  2018-06-11 10:19 ` Jan Kara
  0 siblings, 1 reply; 2+ messages in thread
From: Shakeel Butt @ 2018-06-08  1:37 UTC (permalink / raw)
  To: Jan Kara; +Cc: Greg Thelen, linux-kernel, Shakeel Butt

From: Greg Thelen <gthelen@google.com>

The dquots in the free_dquots list are not reclaimed in LRU way.
put_dquot_last() puts entries to the tail and dqcache_shrink_scan()
frees from the tail. Free unreferenced dquots in LRU order because it
seems more reasonable than freeing most recently used.

Signed-off-by: Greg Thelen <gthelen@google.com>
Signed-off-by: Shakeel Butt <shakeelb@google.com>
---
 fs/quota/dquot.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/quota/dquot.c b/fs/quota/dquot.c
index d88231e3b2be..241b00f835b9 100644
--- a/fs/quota/dquot.c
+++ b/fs/quota/dquot.c
@@ -716,7 +716,7 @@ dqcache_shrink_scan(struct shrinker *shrink, struct shrink_control *sc)
 	unsigned long freed = 0;
 
 	spin_lock(&dq_list_lock);
-	head = free_dquots.prev;
+	head = free_dquots.next;
 	while (head != &free_dquots && sc->nr_to_scan) {
 		dquot = list_entry(head, struct dquot, dq_free);
 		remove_dquot_hash(dquot);
@@ -725,7 +725,7 @@ dqcache_shrink_scan(struct shrinker *shrink, struct shrink_control *sc)
 		do_destroy_dquot(dquot);
 		sc->nr_to_scan--;
 		freed++;
-		head = free_dquots.prev;
+		head = free_dquots.next;
 	}
 	spin_unlock(&dq_list_lock);
 	return freed;
-- 
2.18.0.rc1.242.g61856ae69a-goog

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

* Re: [PATCH] fs: reclaim least recently used dquots
  2018-06-08  1:37 [PATCH] fs: reclaim least recently used dquots Shakeel Butt
@ 2018-06-11 10:19 ` Jan Kara
  0 siblings, 0 replies; 2+ messages in thread
From: Jan Kara @ 2018-06-11 10:19 UTC (permalink / raw)
  To: Shakeel Butt; +Cc: Jan Kara, Greg Thelen, linux-kernel

On Thu 07-06-18 18:37:59, Shakeel Butt wrote:
> From: Greg Thelen <gthelen@google.com>
> 
> The dquots in the free_dquots list are not reclaimed in LRU way.
> put_dquot_last() puts entries to the tail and dqcache_shrink_scan()
> frees from the tail. Free unreferenced dquots in LRU order because it
> seems more reasonable than freeing most recently used.
> 
> Signed-off-by: Greg Thelen <gthelen@google.com>
> Signed-off-by: Shakeel Butt <shakeelb@google.com>

Thanks. I've added the patch to my tree.

								Honza

> ---
>  fs/quota/dquot.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/quota/dquot.c b/fs/quota/dquot.c
> index d88231e3b2be..241b00f835b9 100644
> --- a/fs/quota/dquot.c
> +++ b/fs/quota/dquot.c
> @@ -716,7 +716,7 @@ dqcache_shrink_scan(struct shrinker *shrink, struct shrink_control *sc)
>  	unsigned long freed = 0;
>  
>  	spin_lock(&dq_list_lock);
> -	head = free_dquots.prev;
> +	head = free_dquots.next;
>  	while (head != &free_dquots && sc->nr_to_scan) {
>  		dquot = list_entry(head, struct dquot, dq_free);
>  		remove_dquot_hash(dquot);
> @@ -725,7 +725,7 @@ dqcache_shrink_scan(struct shrinker *shrink, struct shrink_control *sc)
>  		do_destroy_dquot(dquot);
>  		sc->nr_to_scan--;
>  		freed++;
> -		head = free_dquots.prev;
> +		head = free_dquots.next;
>  	}
>  	spin_unlock(&dq_list_lock);
>  	return freed;
> -- 
> 2.18.0.rc1.242.g61856ae69a-goog
> 
> 
-- 
Jan Kara <jack@suse.com>
SUSE Labs, CR

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

end of thread, other threads:[~2018-06-11 10:19 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-06-08  1:37 [PATCH] fs: reclaim least recently used dquots Shakeel Butt
2018-06-11 10:19 ` Jan Kara

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.