Ritesh Harjani
f7f497cb70
jbd2: kill t_handle_lock transaction spinlock
...
This patch kills t_handle_lock transaction spinlock completely from
jbd2.
To explain the reasoning, currently there were three sites at which
this spinlock was used.
1. jbd2_journal_wait_updates()
a. Based on careful code review it can be seen that, we don't need this
lock here. This is since we wait for any currently ongoing updates
based on a atomic variable t_updates. And we anyway don't take any
t_handle_lock while in stop_this_handle().
i.e.
write_lock(&journal->j_state_lock()
jbd2_journal_wait_updates() stop_this_handle()
while (atomic_read(txn->t_updates) { |
DEFINE_WAIT(wait); |
prepare_to_wait(); |
if (atomic_read(txn->t_updates) if (atomic_dec_and_test(txn->t_updates))
write_unlock(&journal->j_state_lock);
schedule(); wake_up()
write_lock(&journal->j_state_lock);
finish_wait();
}
txn->t_state = T_COMMIT
write_unlock(&journal->j_state_lock);
b. Also note that between atomic_inc(&txn->t_updates) in
start_this_handle() and jbd2_journal_wait_updates(), the
synchronization happens via read_lock(journal->j_state_lock) in
start_this_handle();
2. jbd2_journal_extend()
a. jbd2_journal_extend() is called with the handle of each process from
task_struct. So no lock required in updating member fields of handle_t
b. For member fields of h_transaction, all updates happens only via
atomic APIs (which is also within read_lock()).
So, no need of this transaction spinlock.
3. update_t_max_wait()
Based on Jan suggestion, this can be carefully removed using atomic
cmpxchg API.
Note that there can be several processes which are waiting for a new
transaction to be allocated and started. For doing this only one
process will succeed in taking write_lock() and allocating a new txn.
After that all of the process will be updating the t_max_wait (max
transaction wait time). This can be done via below method w/o taking
any locks using atomic cmpxchg.
For more details refer [1]
new = get_new_val();
old = READ_ONCE(ptr->max_val);
while (old < new)
old = cmpxchg(&ptr->max_val, old, new);
[1]: https://lwn.net/Articles/849237/
Suggested-by: Jan Kara <jack@suse.cz >
Signed-off-by: Ritesh Harjani <riteshh@linux.ibm.com >
Reviewed-by: Jan Kara <jack@suse.cz >
Link: https://lore.kernel.org/r/d89e599658b4a1f3893a48c6feded200073037fc.1644992076.git.riteshh@linux.ibm.com
Signed-off-by: Theodore Ts'o <tytso@mit.edu >
2022-02-25 21:28:13 -05:00
..
2021-11-25 18:30:52 +01:00
2021-12-09 16:42:27 -08:00
2021-12-17 12:37:18 -08:00
2021-11-26 16:19:19 +01:00
2022-01-05 12:09:06 +01:00
2022-02-02 18:50:36 +01:00
2021-11-23 10:29:05 +01:00
2021-11-26 16:48:59 +01:00
2021-12-03 10:58:13 -08:00
2022-01-03 17:05:02 +05:30
2021-12-31 14:35:40 +00:00
2022-01-14 16:02:28 +01:00
2021-11-28 14:02:41 -08:00
2021-12-16 22:16:41 +01:00
2021-12-17 12:26:14 +01:00
2021-12-12 17:12:18 +00:00
2021-12-16 13:21:12 +00:00
2022-01-08 14:42:01 -05:00
2021-11-29 13:02:00 +00:00
2022-01-12 17:02:27 -08:00
2022-01-06 16:22:52 -08:00
2021-11-17 14:52:44 +00:00
2021-12-31 13:31:34 +01:00
2021-11-22 08:41:56 -08:00
2022-01-09 23:30:13 +01:00
2021-11-15 10:13:36 +01:00
2022-01-17 08:07:57 +02:00
2021-12-03 18:24:21 -08:00
2022-01-06 08:37:03 -08:00
2022-01-11 12:17:45 -08:00
2022-02-19 11:11:05 +01:00
2022-01-13 09:05:29 -08:00
2021-12-24 14:06:45 +00:00
2022-01-07 17:14:30 +00:00
2022-01-17 05:49:30 +02:00
2021-11-16 10:56:54 +01:00
2022-01-20 08:52:53 +02:00
2022-01-25 18:30:15 +01:00
2022-01-12 15:57:59 -08:00
2022-01-22 08:33:34 +02:00
2021-11-23 15:10:26 +05:30
2022-02-07 22:38:02 +09:00
2021-12-30 17:27:44 -08:00
2021-12-22 13:56:19 +01:00
2021-11-06 13:30:34 -07:00
2021-11-06 14:08:17 -07:00
2022-01-12 12:51:41 -08:00
2021-12-11 09:09:45 +01:00
2022-01-15 08:47:31 -08:00
2022-01-15 08:47:31 -08:00
2022-01-09 10:36:51 -07:00
2021-12-22 23:38:29 -05:00
2022-02-17 07:54:03 -07:00
2022-01-06 12:27:03 +01:00
2021-11-09 10:02:49 -08:00
2021-12-29 17:54:40 -08:00
2022-01-19 01:21:24 +01:00
2021-12-16 14:57:10 -08:00
2021-12-16 14:57:10 -08:00
2021-12-29 20:03:05 -08:00
2022-01-19 01:21:46 +01:00
2021-11-12 10:19:09 -08:00
2021-12-10 15:56:13 -08:00
2021-11-17 10:36:15 -05:00
2021-12-03 10:58:13 -08:00
2021-12-08 16:49:42 +01:00
2022-01-11 09:14:37 -08:00
2021-12-08 11:19:20 +01:00
2021-11-06 13:30:39 -07:00
2021-12-09 16:42:28 -08:00
2021-12-09 16:42:28 -08:00
2021-11-06 14:08:17 -07:00
2022-02-02 14:41:04 -08:00
2021-11-27 13:52:22 +01:00
2021-11-09 10:02:49 -08:00
2022-01-22 08:33:36 +02:00
2021-12-30 17:44:07 +01:00
2021-12-14 12:30:26 +00:00
2022-01-15 08:47:31 -08:00
2021-11-06 13:30:38 -07:00
2021-11-09 10:02:52 -08:00
2021-12-23 22:35:00 +11:00
2022-01-15 16:30:33 +02:00
2021-12-18 08:04:53 -08:00
2022-01-22 08:33:36 +02:00
2021-12-10 17:10:55 -08:00
2022-01-20 08:52:55 +02:00
2021-12-18 08:04:53 -08:00
2021-12-16 22:22:16 +01:00
2021-11-18 09:36:39 +01:00
2021-11-11 09:35:13 +01:00
2021-11-17 14:44:29 +01:00
2021-12-17 21:42:17 +05:30
2022-01-22 08:33:34 +02:00
2021-12-23 16:55:20 +01:00
2021-12-10 12:51:28 +01:00
2022-01-18 08:51:51 +02:00
2022-01-20 08:52:53 +02:00
2022-01-20 08:52:53 +02:00
2021-12-01 00:06:43 +01:00
2022-01-20 11:30:15 +00:00
2022-01-08 14:42:01 -05:00
2022-01-22 08:33:35 +02:00
2022-02-02 15:14:56 +01:00
2022-01-05 19:46:32 -08:00
2022-01-15 08:47:31 -08:00
2022-01-22 08:33:38 +02:00
2022-01-17 09:40:29 +02:00
2021-12-09 14:09:36 -05:00
2022-02-01 11:13:24 -08:00
2022-01-07 13:43:18 +00:00
2022-01-21 21:36:28 +00:00
2021-12-15 14:04:27 +01:00
2022-01-24 14:16:46 +01:00
2021-11-09 10:02:49 -08:00
2021-11-09 10:02:49 -08:00
2021-11-29 06:38:35 -07:00
2022-01-15 16:30:29 +02:00
2022-01-20 08:52:54 +02:00
2022-01-10 09:49:13 +01:00
2021-11-18 15:05:56 -05:00
2021-12-16 14:07:07 +01:00
2022-01-04 13:15:33 -05:00
2022-01-15 16:30:29 +02:00
2022-01-15 16:30:29 +02:00
2021-12-26 15:02:06 -08:00
2022-02-07 17:55:30 +00:00
2021-12-13 11:44:47 +01:00
2021-11-28 21:53:04 +01:00
2021-12-07 20:44:58 -08:00
2022-02-01 20:59:43 -08:00
2021-12-24 10:24:30 -05:00
2021-12-06 16:05:11 -08:00
2022-01-22 08:33:35 +02:00
2021-11-09 10:02:49 -08:00
2021-12-21 15:09:46 -08:00
2021-12-17 16:13:14 +01:00
2021-11-11 22:45:40 +01:00
2021-12-17 09:06:15 +01:00
2021-12-10 20:47:38 +01:00
2021-11-06 13:30:36 -07:00
2021-12-16 10:59:02 -07:00
2022-01-26 09:19:20 -08:00
2021-12-20 09:03:05 +01:00
2021-12-20 13:53:26 +01:00
2021-11-20 10:35:54 -08:00
2022-01-04 12:17:35 +00:00
2021-12-01 00:15:07 +01:00
2021-12-04 10:56:23 +01:00
2022-02-25 21:28:13 -05:00
2021-11-09 10:02:51 -08:00
2022-01-15 20:37:06 +02:00
2021-12-09 16:42:29 -08:00
2021-12-09 16:42:26 -08:00
2022-01-20 10:41:01 +02:00
2021-12-21 10:34:39 +01:00
2022-02-11 17:55:00 -08:00
2022-01-04 14:36:06 +01:00
2022-01-22 08:33:36 +02:00
2022-01-20 10:41:01 +02:00
2022-01-07 10:44:44 -05:00
2022-02-05 00:58:25 -05:00
2022-01-07 10:44:44 -05:00
2022-02-04 16:44:23 +09:00
2022-01-20 08:52:53 +02:00
2021-11-09 10:02:49 -08:00
2022-01-29 08:52:27 +02:00
2021-12-06 13:46:24 -05:00
2022-01-16 23:34:43 +01:00
2022-01-05 11:22:17 +00:00
2021-11-26 18:31:46 +02:00
2022-01-11 12:36:47 +02:00
2022-02-11 17:55:00 -08:00
2021-11-06 13:30:42 -07:00
2021-11-06 13:30:42 -07:00
2022-01-15 16:30:30 +02:00
2022-01-15 20:37:06 +02:00
2021-12-17 17:17:14 +01:00
2021-11-06 13:30:41 -07:00
2022-01-22 08:33:34 +02:00
2022-01-15 16:30:27 +02:00
2022-01-30 09:56:58 +02:00
2022-01-30 09:56:58 +02:00
2022-01-15 16:30:29 +02:00
2021-12-05 10:28:57 +01:00
2021-11-11 22:45:40 +01:00
2022-01-17 07:32:51 +02:00
2022-01-22 08:33:36 +02:00
2021-12-06 16:06:02 -08:00
2021-12-16 22:22:20 +01:00
2022-02-14 13:36:36 +00:00
2022-01-09 23:35:16 +01:00
2022-01-09 23:30:13 +01:00
2022-02-01 10:29:18 -06:00
2021-12-06 16:06:02 -08:00
2022-01-25 20:16:03 +02:00
2022-02-02 10:47:33 -05:00
2022-01-13 09:30:48 -05:00
2022-02-09 09:24:40 -05:00
2021-11-06 13:30:42 -07:00
2021-12-09 07:02:22 -08:00
2022-01-12 10:14:09 -06:00
2022-01-20 12:55:26 -06:00
2021-11-16 19:07:53 -08:00
2022-01-15 16:30:31 +02:00
2021-11-11 09:34:35 -08:00
2022-02-04 09:25:04 -08:00
2022-01-18 06:40:47 +02:00
2022-01-12 12:37:02 -08:00
2022-01-13 16:50:50 -05:00
2022-01-16 08:08:11 +02:00
2022-01-16 08:08:11 +02:00
2022-01-02 18:48:47 +00:00
2021-12-09 15:41:09 -05:00
2022-01-20 08:52:52 +02:00
2022-01-18 12:09:47 +01:00
2022-02-04 09:25:05 -08:00
2021-12-09 13:23:02 -08:00
2021-12-16 10:37:13 +00:00
2022-01-26 18:57:09 -08:00
2022-01-22 08:33:36 +02:00
2022-01-03 21:24:34 -07:00
2021-11-09 10:02:49 -08:00
2022-01-12 19:59:05 +01:00
2022-01-12 19:59:05 +01:00
2021-12-23 22:35:00 +11:00
2022-01-22 08:33:35 +02:00
2022-01-11 11:26:57 -08:00
2022-01-22 08:33:36 +02:00
2022-01-22 08:33:37 +02:00
2022-01-08 12:43:57 -06:00
2022-01-14 16:02:28 +01:00
2022-01-18 12:09:57 +01:00
2022-01-30 09:56:58 +02:00
2021-12-17 16:59:47 +11:00
2021-11-26 11:38:20 -08:00
2022-01-06 12:18:08 +00:00
2021-11-18 09:36:39 +01:00
2022-01-24 14:45:02 +01:00
2021-11-09 10:02:49 -08:00
2022-01-07 00:25:25 +01:00
2021-12-07 15:14:12 +01:00
2021-12-07 16:24:44 -08:00
2021-11-30 17:25:20 -08:00
2021-11-30 17:25:20 -08:00
2022-01-22 08:33:37 +02:00
2021-11-15 13:27:13 +00:00
2021-11-19 12:23:45 +01:00
2021-12-20 11:02:38 +01:00
2021-12-21 10:22:19 +01:00
2021-11-10 09:05:11 -08:00
2021-12-04 10:56:23 +01:00
2022-01-22 08:33:37 +02:00
2022-01-22 08:33:37 +02:00
2022-01-22 08:33:37 +02:00
2021-11-09 10:02:49 -08:00
2022-01-13 12:52:14 -07:00
2021-12-22 09:21:43 +01:00
2022-02-03 11:20:34 -08:00
2021-12-06 13:46:24 -05:00
2021-12-10 06:38:26 -08:00
2022-01-22 08:33:37 +02:00
2021-12-31 13:42:30 +01:00
2021-12-30 13:23:44 +01:00
2021-12-20 16:53:44 +01:00
2022-01-22 08:33:38 +02:00
2021-11-09 10:11:53 -08:00
2021-12-02 11:44:56 -08:00
2022-01-27 08:45:13 -08:00
2021-11-16 13:10:34 +00:00
2022-01-06 12:26:13 +01:00
2022-01-19 11:15:19 +02:00
2022-01-06 12:26:13 +01:00
2021-11-09 10:02:49 -08:00
2022-01-22 08:33:37 +02:00
2021-12-07 15:14:12 +01:00
2021-12-09 16:42:27 -08:00
2021-11-30 17:25:20 -08:00
2022-01-22 08:33:37 +02:00
2022-01-22 08:33:35 +02:00
2021-12-10 14:06:03 +00:00
2021-11-30 11:57:58 +00:00
2021-11-18 18:40:08 +02:00
2022-02-07 21:02:31 +01:00
2022-01-15 16:30:28 +02:00
2022-01-22 08:33:38 +02:00
2021-12-20 18:01:09 +00:00
2022-01-11 15:38:59 -05:00
2022-01-15 16:30:30 +02:00
2022-01-30 09:56:58 +02:00
2021-12-07 11:36:30 -08:00
2022-01-10 08:13:52 -08:00
2021-12-01 00:06:43 +01:00
2021-12-03 15:58:27 +01:00
2021-12-07 16:36:17 -08:00
2022-01-09 00:18:47 +02:00
2022-01-13 16:23:04 -05:00
2022-01-08 12:43:58 -06:00
2021-11-26 16:27:42 +01:00
2021-11-25 18:35:23 +01:00
2021-11-26 16:27:42 +01:00
2021-11-26 16:27:42 +01:00
2021-11-26 16:27:42 +01:00
2021-12-13 12:42:08 +00:00
2022-01-12 15:46:11 -08:00
2021-12-30 12:13:04 +01:00
2022-01-14 18:50:54 -05:00
2021-11-11 13:09:33 +01:00
2021-12-20 18:47:37 -08:00
2022-01-14 18:50:52 -05:00
2022-01-15 16:30:29 +02:00
2022-01-15 16:30:25 +02:00
2021-12-09 10:49:56 -08:00
2021-12-06 22:33:39 +01:00
2022-01-07 09:22:19 +00:00
2021-12-23 11:21:53 +00:00
2022-01-08 00:28:41 -05:00
2021-11-08 16:55:32 -08:00
2021-11-08 16:55:32 -08:00
2021-11-08 16:55:32 -08:00