All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jan Kara <jack@suse.cz>
To: Dmitry Monakhov <dmonakhov@openvz.org>
Cc: linux-fsdevel@vger.kernel.org, jack@suse.cz, hch@infradead.org
Subject: Re: [PATCH 08/19] quota: make dquot lists per-sb
Date: Mon, 22 Nov 2010 22:37:27 +0100	[thread overview]
Message-ID: <20101122213727.GF6141@quack.suse.cz> (raw)
In-Reply-To: <1289477678-5669-9-git-send-email-dmonakhov@openvz.org>

On Thu 11-11-10 15:14:27, Dmitry Monakhov wrote:
> Currently quota lists are global which is very bad for scalability.
> * inuse_lists -> sb->s_dquot->dq_inuse_list
> * free_lists  -> sb->s_dquot->dq_free_lists
> * Add per sb lock for quota's lists protection
> 
> Do not remove dq_lists_lock is used now only for protecting quota_hash
> 
> Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org>
> ---
>  fs/quota/dquot.c      |   88 +++++++++++++++++++++++++++++++++++++++---------
>  include/linux/quota.h |    3 ++
>  2 files changed, 74 insertions(+), 17 deletions(-)
> 
> diff --git a/fs/quota/dquot.c b/fs/quota/dquot.c
> index f719a6f..d7ec471 100644
> --- a/fs/quota/dquot.c
> +++ b/fs/quota/dquot.c
...
> @@ -335,17 +333,20 @@ static inline int mark_dquot_dirty(struct dquot *dquot)
>  int dquot_mark_dquot_dirty(struct dquot *dquot)
>  {
>  	int ret = 1;
> +	struct quota_info *dqopt = sb_dqopts(dquot);
>  
>  	/* If quota is dirty already, we don't have to acquire dq_list_lock */
>  	if (test_bit(DQ_MOD_B, &dquot->dq_flags))
>  		return 1;
>  
>  	spin_lock(&dq_list_lock);
> +	spin_lock(&dqopt->dq_list_lock);
>  	if (!test_and_set_bit(DQ_MOD_B, &dquot->dq_flags)) {
> -		list_add(&dquot->dq_dirty, &sb_dqopts(dquot)->
> -				info[dquot->dq_type].dqi_dirty_list);
> +		list_add(&dquot->dq_dirty,
> +			&dqopt->info[dquot->dq_type].dqi_dirty_list);
>  		ret = 0;
>  	}
> +	spin_unlock(&dqopt->dq_list_lock);
>  	spin_unlock(&dq_list_lock);
  OK, but the above code does nothing with the hash so you can remove
dq_list_lock immediately, can't you? Not that it would matter too much
since you remove it eventually but I'm curious...

>  /* Free unused dquots from cache */
> -static void prune_dqcache(int count)
> +static void prune_one_sb_dqcache(struct super_block *sb, void *arg)
>  {
>  	struct list_head *head;
>  	struct dquot *dquot;
> +	struct quota_info *dqopt = dqopts(sb);
> +	int count = *(int*) arg;
>  
> -	head = free_dquots.prev;
> -	while (head != &free_dquots && count) {
> +	mutex_lock(&dqctl(sb)->dqonoff_mutex);
  You cannot call mutex_lock() because you already hold dq_list_lock from
shrink_dqcache_memory(). If we could get away without the mutex completely,
it would be really welcome. The code can be called from page-reclaim
possibly holding all sorts of locks so if you cannot get rid of
dqonoff_mutex, you must bail out if gfp_mask passed to shrinker does not
have __GFP_FS set (which would be unfortunate).

> +	if (!sb_any_quota_loaded(sb)) {
> +		mutex_unlock(&dqctl(sb)->dqonoff_mutex);
> +		return;
> +	}
> +	spin_lock(&dqopt->dq_list_lock);
> +	head = dqopt->dq_free_list.prev;
> +	while (head != &dqopt->dq_free_list && count) {
>  		dquot = list_entry(head, struct dquot, dq_free);
>  		remove_dquot_hash(dquot);
>  		remove_free_dquot(dquot);
>  		remove_inuse(dquot);
>  		do_destroy_dquot(dquot);
>  		count--;
> -		head = free_dquots.prev;
> +		head = dqopt->dq_free_list.prev;
>  	}
> +	spin_unlock(&dqopt->dq_list_lock);
> +	mutex_unlock(&dqctl(sb)->dqonoff_mutex);
> +}
> +static void prune_dqcache(int count)
> +{
> +	iterate_supers(prune_one_sb_dqcache, &count);
>  }
> -
>  /*
>   * This is called from kswapd when we think we need some
>   * more memory

								Honza
-- 
Jan Kara <jack@suse.cz>
SUSE Labs, CR

  reply	other threads:[~2010-11-22 21:37 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-11 12:14 [PATCH 00/19] quota: RFC SMP improvements for generic quota V3 Dmitry Monakhov
2010-11-11 12:14 ` [PATCH 01/19] quota: protect getfmt call with dqonoff_mutex lock Dmitry Monakhov
2010-11-11 13:36   ` Christoph Hellwig
2010-11-22 19:35   ` Jan Kara
2010-12-02 11:40     ` Dmitry
2010-11-11 12:14 ` [PATCH 02/19] kernel: add bl_list Dmitry Monakhov
2010-11-11 12:14 ` [PATCH 03/19] quota: Wrap common expression to helper function Dmitry Monakhov
2010-11-11 12:14 ` [PATCH 04/19] quota: protect dqget() from parallels quotaoff via SRCU Dmitry Monakhov
2010-11-22 21:21   ` Jan Kara
2010-11-22 21:53     ` Dmitry
2010-11-11 12:14 ` [PATCH 05/19] quota: mode quota internals from sb to quota_info Dmitry Monakhov
2010-11-11 12:14 ` [PATCH 06/19] quota: Remove state_lock Dmitry Monakhov
2010-11-22 21:12   ` Jan Kara
2010-11-22 21:31     ` Dmitry
2010-11-23 10:55       ` Jan Kara
2010-11-23 11:33         ` Jan Kara
2010-11-11 12:14 ` [PATCH 07/19] quota: add quota format lock Dmitry Monakhov
2010-11-11 12:14 ` [PATCH 08/19] quota: make dquot lists per-sb Dmitry Monakhov
2010-11-22 21:37   ` Jan Kara [this message]
2010-11-11 12:14 ` [PATCH 09/19] quota: optimize quota_initialize Dmitry Monakhov
2010-11-11 12:14 ` [PATCH 10/19] quota: user per-backet hlist lock for dquot_hash Dmitry Monakhov
2010-11-11 12:14 ` [PATCH 11/19] quota: remove global dq_list_lock Dmitry Monakhov
2010-11-11 12:14 ` [PATCH 12/19] quota: rename dq_lock Dmitry Monakhov
2010-11-11 12:14 ` [PATCH 13/19] quota: make per-sb dq_data_lock Dmitry Monakhov
2010-11-11 12:14 ` [PATCH 14/19] quota: protect dquot mem info with object's lock Dmitry Monakhov
2010-11-11 12:14 ` [PATCH 15/19] quota: drop dq_data_lock where possible Dmitry Monakhov
2010-11-11 12:14 ` [PATCH 16/19] quota: relax dq_data_lock dq_lock locking consistency Dmitry Monakhov
2010-11-11 12:14 ` [PATCH 17/19] quota: Some stylistic cleanup for dquot interface Dmitry Monakhov
2010-11-23 11:37   ` Jan Kara
2010-11-11 12:14 ` [PATCH 18/19] fs: add unlocked helpers Dmitry Monakhov
2010-11-11 12:14 ` [PATCH 19/19] quota: protect i_dquot with i_lock instead of dqptr_sem Dmitry Monakhov
2010-11-19  5:44 ` [PATCH 00/19] quota: RFC SMP improvements for generic quota V3 Dmitry

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20101122213727.GF6141@quack.suse.cz \
    --to=jack@suse.cz \
    --cc=dmonakhov@openvz.org \
    --cc=hch@infradead.org \
    --cc=linux-fsdevel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.