* [PATCH] jbd2: Increase IO priority of checkpoint.
@ 2025-08-25 12:53 Julian Sun
2025-08-25 13:47 ` Jan Kara
` (3 more replies)
0 siblings, 4 replies; 9+ messages in thread
From: Julian Sun @ 2025-08-25 12:53 UTC (permalink / raw)
To: linux-ext4; +Cc: tytso, jack, yi.zhang
In commit 6a3afb6ac6df ("jbd2: increase the journal IO's priority"),
the priority of IOs initiated by jbd2 has been raised, exempting them
from WBT throttling.
Checkpoint is also a crucial operation of jbd2. While no serious issues
have been observed so far, it should still be reasonable to exempt
checkpoint from WBT throttling.
Signed-off-by: Julian Sun <sunjunchao@bytedance.com>
---
fs/jbd2/checkpoint.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/jbd2/checkpoint.c b/fs/jbd2/checkpoint.c
index 38861ca04899..2d0719bf6d87 100644
--- a/fs/jbd2/checkpoint.c
+++ b/fs/jbd2/checkpoint.c
@@ -131,7 +131,7 @@ __flush_batch(journal_t *journal, int *batch_count)
blk_start_plug(&plug);
for (i = 0; i < *batch_count; i++)
- write_dirty_buffer(journal->j_chkpt_bhs[i], REQ_SYNC);
+ write_dirty_buffer(journal->j_chkpt_bhs[i], JBD2_JOURNAL_REQ_FLAGS);
blk_finish_plug(&plug);
for (i = 0; i < *batch_count; i++) {
--
2.20.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH] jbd2: Increase IO priority of checkpoint.
2025-08-25 12:53 [PATCH] jbd2: Increase IO priority of checkpoint Julian Sun
@ 2025-08-25 13:47 ` Jan Kara
2025-08-26 2:18 ` Zhang Yi
` (2 subsequent siblings)
3 siblings, 0 replies; 9+ messages in thread
From: Jan Kara @ 2025-08-25 13:47 UTC (permalink / raw)
To: Julian Sun; +Cc: linux-ext4, tytso, jack, yi.zhang
On Mon 25-08-25 20:53:39, Julian Sun wrote:
> In commit 6a3afb6ac6df ("jbd2: increase the journal IO's priority"),
> the priority of IOs initiated by jbd2 has been raised, exempting them
> from WBT throttling.
> Checkpoint is also a crucial operation of jbd2. While no serious issues
> have been observed so far, it should still be reasonable to exempt
> checkpoint from WBT throttling.
>
> Signed-off-by: Julian Sun <sunjunchao@bytedance.com>
Makes sense. Feel free to add:
Reviewed-by: Jan Kara <jack@suse.cz>
Honza
> ---
> fs/jbd2/checkpoint.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/jbd2/checkpoint.c b/fs/jbd2/checkpoint.c
> index 38861ca04899..2d0719bf6d87 100644
> --- a/fs/jbd2/checkpoint.c
> +++ b/fs/jbd2/checkpoint.c
> @@ -131,7 +131,7 @@ __flush_batch(journal_t *journal, int *batch_count)
>
> blk_start_plug(&plug);
> for (i = 0; i < *batch_count; i++)
> - write_dirty_buffer(journal->j_chkpt_bhs[i], REQ_SYNC);
> + write_dirty_buffer(journal->j_chkpt_bhs[i], JBD2_JOURNAL_REQ_FLAGS);
> blk_finish_plug(&plug);
>
> for (i = 0; i < *batch_count; i++) {
> --
> 2.20.1
>
--
Jan Kara <jack@suse.com>
SUSE Labs, CR
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] jbd2: Increase IO priority of checkpoint.
2025-08-25 12:53 [PATCH] jbd2: Increase IO priority of checkpoint Julian Sun
2025-08-25 13:47 ` Jan Kara
@ 2025-08-26 2:18 ` Zhang Yi
2025-08-26 20:55 ` Ritesh Harjani
2025-09-26 21:47 ` Theodore Ts'o
3 siblings, 0 replies; 9+ messages in thread
From: Zhang Yi @ 2025-08-26 2:18 UTC (permalink / raw)
To: Julian Sun, linux-ext4; +Cc: tytso, jack
On 8/25/2025 8:53 PM, Julian Sun wrote:
> In commit 6a3afb6ac6df ("jbd2: increase the journal IO's priority"),
> the priority of IOs initiated by jbd2 has been raised, exempting them
> from WBT throttling.
> Checkpoint is also a crucial operation of jbd2. While no serious issues
> have been observed so far, it should still be reasonable to exempt
> checkpoint from WBT throttling.
>
> Signed-off-by: Julian Sun <sunjunchao@bytedance.com>
Looks reasonable to me. Thanks for the patch!
Reviewed-by: Zhang Yi <yi.zhang@huawei.com>
> ---
> fs/jbd2/checkpoint.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/jbd2/checkpoint.c b/fs/jbd2/checkpoint.c
> index 38861ca04899..2d0719bf6d87 100644
> --- a/fs/jbd2/checkpoint.c
> +++ b/fs/jbd2/checkpoint.c
> @@ -131,7 +131,7 @@ __flush_batch(journal_t *journal, int *batch_count)
>
> blk_start_plug(&plug);
> for (i = 0; i < *batch_count; i++)
> - write_dirty_buffer(journal->j_chkpt_bhs[i], REQ_SYNC);
> + write_dirty_buffer(journal->j_chkpt_bhs[i], JBD2_JOURNAL_REQ_FLAGS);
> blk_finish_plug(&plug);
>
> for (i = 0; i < *batch_count; i++) {
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] jbd2: Increase IO priority of checkpoint.
2025-08-25 12:53 [PATCH] jbd2: Increase IO priority of checkpoint Julian Sun
2025-08-25 13:47 ` Jan Kara
2025-08-26 2:18 ` Zhang Yi
@ 2025-08-26 20:55 ` Ritesh Harjani
2025-08-27 4:57 ` [External] " Julian Sun
2025-08-27 4:57 ` Julian Sun
2025-09-26 21:47 ` Theodore Ts'o
3 siblings, 2 replies; 9+ messages in thread
From: Ritesh Harjani @ 2025-08-26 20:55 UTC (permalink / raw)
To: Julian Sun, linux-ext4; +Cc: tytso, jack, yi.zhang
Julian Sun <sunjunchao@bytedance.com> writes:
> In commit 6a3afb6ac6df ("jbd2: increase the journal IO's priority"),
> the priority of IOs initiated by jbd2 has been raised, exempting them
> from WBT throttling.
> Checkpoint is also a crucial operation of jbd2. While no serious issues
> have been observed so far, it should still be reasonable to exempt
> checkpoint from WBT throttling.
>
Interesting.. I was wondering whether we were able to observe any
throttling for jbd2 log writes or for jbd2 checkpoint?
Maybe It would have been nice, if we had some kind of data for this.
BTW - does it make sense for fastcommit path too maybe for non-tail
fc write requests? I think it uses ext4_fc_submit_bh().
-ritesh
> Signed-off-by: Julian Sun <sunjunchao@bytedance.com>
> ---
> fs/jbd2/checkpoint.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/jbd2/checkpoint.c b/fs/jbd2/checkpoint.c
> index 38861ca04899..2d0719bf6d87 100644
> --- a/fs/jbd2/checkpoint.c
> +++ b/fs/jbd2/checkpoint.c
> @@ -131,7 +131,7 @@ __flush_batch(journal_t *journal, int *batch_count)
>
> blk_start_plug(&plug);
> for (i = 0; i < *batch_count; i++)
> - write_dirty_buffer(journal->j_chkpt_bhs[i], REQ_SYNC);
> + write_dirty_buffer(journal->j_chkpt_bhs[i], JBD2_JOURNAL_REQ_FLAGS);
> blk_finish_plug(&plug);
>
> for (i = 0; i < *batch_count; i++) {
> --
> 2.20.1
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [External] Re: [PATCH] jbd2: Increase IO priority of checkpoint.
2025-08-26 20:55 ` Ritesh Harjani
@ 2025-08-27 4:57 ` Julian Sun
2025-08-27 4:57 ` Julian Sun
1 sibling, 0 replies; 9+ messages in thread
From: Julian Sun @ 2025-08-27 4:57 UTC (permalink / raw)
To: Ritesh Harjani (IBM), linux-ext4; +Cc: tytso, jack, yi.zhang
在 2025/8/27 04:55, Ritesh Harjani (IBM) 写道:
> Julian Sun <sunjunchao@bytedance.com> writes:
>
>> In commit 6a3afb6ac6df ("jbd2: increase the journal IO's priority"),
>> the priority of IOs initiated by jbd2 has been raised, exempting them
>> from WBT throttling.
>> Checkpoint is also a crucial operation of jbd2. While no serious issues
>> have been observed so far, it should still be reasonable to exempt
>> checkpoint from WBT throttling.
>>
>
> Interesting.. I was wondering whether we were able to observe any
> throttling for jbd2 log writes or for jbd2 checkpoint?
> Maybe It would have been nice, if we had some kind of data for this.
Good idea. But AFAICS wbt lacks of such a obversation mechanism now..>
> BTW - does it make sense for fastcommit path too maybe for non-tail
> fc write requests? I think it uses ext4_fc_submit_bh().
Yeah, I think so.
After a rough check of the code, the following code paths may result in
high latency or even task hangs:
1. fastcommit io is throttled by wbt or other block layer qos policies.
2. jbd2_fc_wait_bufs() might wait for a long time while
JBD2_FAST_COMMIT_ONGOING is set in journal->flags, and then
jbd2_journal_commit_transaction() waits for the
JBD2_FAST_COMMIT_ONGOING bit for a long time while holding the write
lock of j_state_lock.
3. start_this_handle() waits for read lock of j_state_lock which
results in high latency or task hang.
Hi, Jan, please correct me if I'm missing anything.
>
> -ritesh
>
>
>> Signed-off-by: Julian Sun <sunjunchao@bytedance.com>
>> ---
>> fs/jbd2/checkpoint.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/fs/jbd2/checkpoint.c b/fs/jbd2/checkpoint.c
>> index 38861ca04899..2d0719bf6d87 100644
>> --- a/fs/jbd2/checkpoint.c
>> +++ b/fs/jbd2/checkpoint.c
>> @@ -131,7 +131,7 @@ __flush_batch(journal_t *journal, int *batch_count)
>>
>> blk_start_plug(&plug);
>> for (i = 0; i < *batch_count; i++)
>> - write_dirty_buffer(journal->j_chkpt_bhs[i], REQ_SYNC);
>> + write_dirty_buffer(journal->j_chkpt_bhs[i], JBD2_JOURNAL_REQ_FLAGS);
>> blk_finish_plug(&plug);
>>
>> for (i = 0; i < *batch_count; i++) {
>> --
>> 2.20.1
Thanks,
--
Julian Sun <sunjunchao@bytedance.com>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] jbd2: Increase IO priority of checkpoint.
2025-08-26 20:55 ` Ritesh Harjani
2025-08-27 4:57 ` [External] " Julian Sun
@ 2025-08-27 4:57 ` Julian Sun
2025-08-27 11:15 ` Jan Kara
1 sibling, 1 reply; 9+ messages in thread
From: Julian Sun @ 2025-08-27 4:57 UTC (permalink / raw)
To: Ritesh Harjani (IBM), linux-ext4; +Cc: tytso, jack, yi.zhang
在 2025/8/27 04:55, Ritesh Harjani (IBM) 写道:
> Julian Sun <sunjunchao@bytedance.com> writes:
>
>> In commit 6a3afb6ac6df ("jbd2: increase the journal IO's priority"),
>> the priority of IOs initiated by jbd2 has been raised, exempting them
>> from WBT throttling.
>> Checkpoint is also a crucial operation of jbd2. While no serious issues
>> have been observed so far, it should still be reasonable to exempt
>> checkpoint from WBT throttling.
>>
>
> Interesting.. I was wondering whether we were able to observe any
> throttling for jbd2 log writes or for jbd2 checkpoint?
> Maybe It would have been nice, if we had some kind of data for this.
Good idea. But AFAICS wbt lacks of such a obversation mechanism now..>
> BTW - does it make sense for fastcommit path too maybe for non-tail
> fc write requests? I think it uses ext4_fc_submit_bh().
Yeah, I think so.
After a rough check of the code, the following code paths may result in
high latency or even task hangs:
1. fastcommit io is throttled by wbt or other block layer qos policies.
2. jbd2_fc_wait_bufs() might wait for a long time while
JBD2_FAST_COMMIT_ONGOING is set in journal->flags, and then
jbd2_journal_commit_transaction() waits for the
JBD2_FAST_COMMIT_ONGOING bit for a long time while holding the write
lock of j_state_lock.
3. start_this_handle() waits for read lock of j_state_lock which
results in high latency or task hang.
Hi, Jan, please correct me if I'm missing anything.
>
> -ritesh
>
>
>> Signed-off-by: Julian Sun <sunjunchao@bytedance.com>
>> ---
>> fs/jbd2/checkpoint.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/fs/jbd2/checkpoint.c b/fs/jbd2/checkpoint.c
>> index 38861ca04899..2d0719bf6d87 100644
>> --- a/fs/jbd2/checkpoint.c
>> +++ b/fs/jbd2/checkpoint.c
>> @@ -131,7 +131,7 @@ __flush_batch(journal_t *journal, int *batch_count)
>>
>> blk_start_plug(&plug);
>> for (i = 0; i < *batch_count; i++)
>> - write_dirty_buffer(journal->j_chkpt_bhs[i], REQ_SYNC);
>> + write_dirty_buffer(journal->j_chkpt_bhs[i], JBD2_JOURNAL_REQ_FLAGS);
>> blk_finish_plug(&plug);
>>
>> for (i = 0; i < *batch_count; i++) {
>> --
>> 2.20.1
Thanks,
--
Julian Sun <sunjunchao@bytedance.com>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] jbd2: Increase IO priority of checkpoint.
2025-08-27 4:57 ` Julian Sun
@ 2025-08-27 11:15 ` Jan Kara
2025-08-27 11:53 ` Julian Sun
0 siblings, 1 reply; 9+ messages in thread
From: Jan Kara @ 2025-08-27 11:15 UTC (permalink / raw)
To: Julian Sun; +Cc: Ritesh Harjani (IBM), linux-ext4, tytso, jack, yi.zhang
On Wed 27-08-25 12:57:32, Julian Sun wrote:
> 在 2025/8/27 04:55, Ritesh Harjani (IBM) 写道:
> > Julian Sun <sunjunchao@bytedance.com> writes:
> >
> > > In commit 6a3afb6ac6df ("jbd2: increase the journal IO's priority"),
> > > the priority of IOs initiated by jbd2 has been raised, exempting them
> > > from WBT throttling.
> > > Checkpoint is also a crucial operation of jbd2. While no serious issues
> > > have been observed so far, it should still be reasonable to exempt
> > > checkpoint from WBT throttling.
> > >
> >
> > Interesting.. I was wondering whether we were able to observe any
> > throttling for jbd2 log writes or for jbd2 checkpoint?
> > Maybe It would have been nice, if we had some kind of data for this.
>
> Good idea. But AFAICS wbt lacks of such a obversation mechanism now..>
Well, I guess Ritesh meant some test case which is reproducing the
situation where jbd2 log writes get stalled.
> > BTW - does it make sense for fastcommit path too maybe for non-tail
> > fc write requests? I think it uses ext4_fc_submit_bh().
>
> Yeah, I think so.
> After a rough check of the code, the following code paths may result in high
> latency or even task hangs:
> 1. fastcommit io is throttled by wbt or other block layer qos policies.
> 2. jbd2_fc_wait_bufs() might wait for a long time while
> JBD2_FAST_COMMIT_ONGOING is set in journal->flags, and then
> jbd2_journal_commit_transaction() waits for the JBD2_FAST_COMMIT_ONGOING bit
> for a long time while holding the write lock of j_state_lock.
> 3. start_this_handle() waits for read lock of j_state_lock which results
> in high latency or task hang.
>
> Hi, Jan, please correct me if I'm missing anything.
I think you're correct. In fact ext4_fc_commit() does modify current
process' io priority to match that of jbd2 thread so it would be logical
to match IO submission flags as well.
Honza
--
Jan Kara <jack@suse.com>
SUSE Labs, CR
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] jbd2: Increase IO priority of checkpoint.
2025-08-27 11:15 ` Jan Kara
@ 2025-08-27 11:53 ` Julian Sun
0 siblings, 0 replies; 9+ messages in thread
From: Julian Sun @ 2025-08-27 11:53 UTC (permalink / raw)
To: Jan Kara; +Cc: Ritesh Harjani (IBM), linux-ext4, tytso, jack, yi.zhang
在 2025/8/27 19:15, Jan Kara 写道:
> On Wed 27-08-25 12:57:32, Julian Sun wrote:
>> 在 2025/8/27 04:55, Ritesh Harjani (IBM) 写道:
>>> Julian Sun <sunjunchao@bytedance.com> writes:
>>>
>>>> In commit 6a3afb6ac6df ("jbd2: increase the journal IO's priority"),
>>>> the priority of IOs initiated by jbd2 has been raised, exempting them
>>>> from WBT throttling.
>>>> Checkpoint is also a crucial operation of jbd2. While no serious issues
>>>> have been observed so far, it should still be reasonable to exempt
>>>> checkpoint from WBT throttling.
>>>>
>>>
>>> Interesting.. I was wondering whether we were able to observe any
>>> throttling for jbd2 log writes or for jbd2 checkpoint?
>>> Maybe It would have been nice, if we had some kind of data for this.
>>
>> Good idea. But AFAICS wbt lacks of such a obversation mechanism now..>
>
> Well, I guess Ritesh meant some test case which is reproducing the
> situation where jbd2 log writes get stalled.
Ah, thanks for the clarification. It may be a little bit difficult to
reproduce it manually, I’ll give it a shot but I’m not sure if I can do
it..>
>>> BTW - does it make sense for fastcommit path too maybe for non-tail
>>> fc write requests? I think it uses ext4_fc_submit_bh().
>>
>> Yeah, I think so.
>> After a rough check of the code, the following code paths may result in high
>> latency or even task hangs:
>> 1. fastcommit io is throttled by wbt or other block layer qos policies.
>> 2. jbd2_fc_wait_bufs() might wait for a long time while
>> JBD2_FAST_COMMIT_ONGOING is set in journal->flags, and then
>> jbd2_journal_commit_transaction() waits for the JBD2_FAST_COMMIT_ONGOING bit
>> for a long time while holding the write lock of j_state_lock.
>> 3. start_this_handle() waits for read lock of j_state_lock which results
>> in high latency or task hang.
>>
>> Hi, Jan, please correct me if I'm missing anything.
>
> I think you're correct. In fact ext4_fc_commit() does modify current
> process' io priority to match that of jbd2 thread so it would be logical
> to match IO submission flags as well.
Thanks, I will send a patch to improve here.>
> Honza
--
Julian Sun <sunjunchao@bytedance.com>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] jbd2: Increase IO priority of checkpoint.
2025-08-25 12:53 [PATCH] jbd2: Increase IO priority of checkpoint Julian Sun
` (2 preceding siblings ...)
2025-08-26 20:55 ` Ritesh Harjani
@ 2025-09-26 21:47 ` Theodore Ts'o
3 siblings, 0 replies; 9+ messages in thread
From: Theodore Ts'o @ 2025-09-26 21:47 UTC (permalink / raw)
To: linux-ext4, Julian Sun; +Cc: Theodore Ts'o, jack, yi.zhang
On Mon, 25 Aug 2025 20:53:39 +0800, Julian Sun wrote:
> In commit 6a3afb6ac6df ("jbd2: increase the journal IO's priority"),
> the priority of IOs initiated by jbd2 has been raised, exempting them
> from WBT throttling.
> Checkpoint is also a crucial operation of jbd2. While no serious issues
> have been observed so far, it should still be reasonable to exempt
> checkpoint from WBT throttling.
>
> [...]
Applied, thanks!
[1/1] jbd2: Increase IO priority of checkpoint.
commit: 0f3b05c12158ec7545fb336469ccce38c31c7f9f
Best regards,
--
Theodore Ts'o <tytso@mit.edu>
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2025-09-26 21:48 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-25 12:53 [PATCH] jbd2: Increase IO priority of checkpoint Julian Sun
2025-08-25 13:47 ` Jan Kara
2025-08-26 2:18 ` Zhang Yi
2025-08-26 20:55 ` Ritesh Harjani
2025-08-27 4:57 ` [External] " Julian Sun
2025-08-27 4:57 ` Julian Sun
2025-08-27 11:15 ` Jan Kara
2025-08-27 11:53 ` Julian Sun
2025-09-26 21:47 ` Theodore Ts'o
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox