public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jan Kara <jack@suse.cz>
To: Liu Song <fishland@aliyun.com>
Cc: tytso@mit.edu, jack@suse.com, linux-ext4@vger.kernel.org,
	linux-kernel@vger.kernel.org, liu.song11@zte.com.cn
Subject: Re: [PATCH] jbd2: do not start commit when t_updates does not back to zero
Date: Fri, 29 Mar 2019 22:25:23 +0100	[thread overview]
Message-ID: <20190329212523.GC8757@quack2.suse.cz> (raw)
In-Reply-To: <20190324033835.55858-1-fishland@aliyun.com>

On Sun 24-03-19 11:38:35, Liu Song wrote:
> When t_updates back to zero, it guaranteed wake up process which
> waiting on j_wait_updates. If we triggered a commit start without
> considered t_updates, the commit thread wakes up and find t_updates
> is not zero, it have to wait on it once again. So, add checking code
> to avoid this happen.
> 
> Signed-off-by: Liu Song <liu.song11@zte.com.cn>

Do I understand correctly that this is a performance improvement? If yes,
did you measure any benefit of the patch? Because I have some doubts that
t_updates == 0 case is very common.

								Honza

> ---
>  fs/jbd2/transaction.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/jbd2/transaction.c b/fs/jbd2/transaction.c
> index 79a028a7a579..e0499fd73b1e 100644
> --- a/fs/jbd2/transaction.c
> +++ b/fs/jbd2/transaction.c
> @@ -144,12 +144,13 @@ static void wait_transaction_locked(journal_t *journal)
>  	__releases(journal->j_state_lock)
>  {
>  	DEFINE_WAIT(wait);
> -	int need_to_start;
> +	int need_to_start = 0;
>  	tid_t tid = journal->j_running_transaction->t_tid;
>  
>  	prepare_to_wait(&journal->j_wait_transaction_locked, &wait,
>  			TASK_UNINTERRUPTIBLE);
> -	need_to_start = !tid_geq(journal->j_commit_request, tid);
> +	if (!atomic_read(&journal->j_running_transaction->t_updates))
> +		need_to_start = !tid_geq(journal->j_commit_request, tid);
>  	read_unlock(&journal->j_state_lock);
>  	if (need_to_start)
>  		jbd2_log_start_commit(journal, tid);
> -- 
> 2.19.1
> 
> 
-- 
Jan Kara <jack@suse.com>
SUSE Labs, CR

       reply	other threads:[~2019-03-29 21:25 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20190324033835.55858-1-fishland@aliyun.com>
2019-03-29 21:25 ` Jan Kara [this message]
2019-03-29 21:52   ` [PATCH] jbd2: do not start commit when t_updates does not back to zero Andreas Dilger
     [not found]     ` <201903301524441962443@zte.com.cn>
2019-03-30 18:14       ` [PATCH] jbd2: do not start commit when t_updates does not back tozero Theodore Ts'o
     [not found]         ` <201904011035044343324@zte.com.cn>
2019-04-01 13:19           ` [PATCH] jbd2: do not start commit when t_updates does not backtozero Theodore Ts'o

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=20190329212523.GC8757@quack2.suse.cz \
    --to=jack@suse.cz \
    --cc=fishland@aliyun.com \
    --cc=jack@suse.com \
    --cc=linux-ext4@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=liu.song11@zte.com.cn \
    --cc=tytso@mit.edu \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox