Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

jbd2: Improve scalability by not taking j_state_lock in jbd2_journal_stop()

One of the most contended locks in the jbd2 layer is j_state_lock when
running dbench. This is especially true if using the real-time kernel
with its "sleeping spinlocks" patch that replaces spinlocks with
priority inheriting mutexes --- but it also shows up on large SMP
benchmarks.

Thanks to John Stultz for pointing this out.

Reviewed by Mingming Cao and Jan Kara.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>

+1 -4
+1 -4
fs/jbd2/transaction.c
··· 1311 1311 if (handle->h_sync) 1312 1312 transaction->t_synchronous_commit = 1; 1313 1313 current->journal_info = NULL; 1314 - spin_lock(&journal->j_state_lock); 1315 1314 spin_lock(&transaction->t_handle_lock); 1316 1315 transaction->t_outstanding_credits -= handle->h_buffer_credits; 1317 1316 transaction->t_updates--; ··· 1339 1340 jbd_debug(2, "transaction too old, requesting commit for " 1340 1341 "handle %p\n", handle); 1341 1342 /* This is non-blocking */ 1342 - __jbd2_log_start_commit(journal, transaction->t_tid); 1343 - spin_unlock(&journal->j_state_lock); 1343 + jbd2_log_start_commit(journal, transaction->t_tid); 1344 1344 1345 1345 /* 1346 1346 * Special case: JBD2_SYNC synchronous updates require us ··· 1349 1351 err = jbd2_log_wait_commit(journal, tid); 1350 1352 } else { 1351 1353 spin_unlock(&transaction->t_handle_lock); 1352 - spin_unlock(&journal->j_state_lock); 1353 1354 } 1354 1355 1355 1356 lock_map_release(&handle->h_lockdep_map);