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.son...@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 <j...@suse.com> SUSE Labs, CR