All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] jbd2: Fix leaked transaction credits
@ 2020-05-18  9:21 Jan Kara
  2020-05-18  9:21 ` [PATCH 1/2] ext4: Drop ext4_journal_free_reserved() Jan Kara
  2020-05-18  9:21 ` [PATCH 2/2] jbd2: Avoid leaking transaction credits when unreserving handle Jan Kara
  0 siblings, 2 replies; 10+ messages in thread
From: Jan Kara @ 2020-05-18  9:21 UTC (permalink / raw)
  To: Ted Tso; +Cc: linux-ext4, Jan Kara

Hello,

after debugging more the reason why fsmark run is slower in dioread_nolock
mode (which became the default in 5.6), I've found jbd2 actually leaks
reserved credits if we start a transaction with reserved handle and then don't
use it. The first patch in the series is a small (and independent) cleanup in
the area, the second patch fixes the leak.

Then there was another revelation for me that in this workload ext4 actually
starts lots of reserved transaction handles that are unused. This is due to the
way how ext4 writepages code works - it starts a transaction, then inspects
page cache and writes one extent if found. Then starts again a transaction and
checks whether there's more to write. So for single extent files we always
start transaction twice, second time only to find there's nothing more to
write. In case all blocks are already allocated, we wouldn't even have to start
transaction at all.  This probably also deserves to be fixed but a simple fix I
made seems to break page writeback so I need to dig more into it and I want to
push out the obvious jbd2 fix early.

								Honza

^ permalink raw reply	[flat|nested] 10+ messages in thread
* [PATCH 0/2 v2] jbd2: Fix leaked transaction credits
@ 2020-05-20 13:31 Jan Kara
  2020-05-20 13:31 ` [PATCH 1/2] ext4: Drop ext4_journal_free_reserved() Jan Kara
  0 siblings, 1 reply; 10+ messages in thread
From: Jan Kara @ 2020-05-20 13:31 UTC (permalink / raw)
  To: Ted Tso; +Cc: linux-ext4, Jan Kara

Hello,

after debugging more the reason why fsmark run is slower in dioread_nolock
mode (which became the default in 5.6), I've found jbd2 actually leaks
reserved credits if we start a transaction with reserved handle and then don't
use it. The first patch in the series is a small (and independent) cleanup in
the area, the second patch fixes the leak.

Then there was another revelation for me that in this workload ext4 actually
starts lots of reserved transaction handles that are unused. This is due to the
way how ext4 writepages code works - it starts a transaction, then inspects
page cache and writes one extent if found. Then starts again a transaction and
checks whether there's more to write. So for single extent files we always
start transaction twice, second time only to find there's nothing more to
write. In case all blocks are already allocated, we wouldn't even have to start
transaction at all.  This probably also deserves to be fixed but a simple fix I
made seems to break page writeback so I need to dig more into it and I want to
push out the obvious jbd2 fix early.

Changes since v1:
* Add reviewed-by tag
* Fixed up one coding style issue pointed out by Andreas

								Honza

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2020-05-29  2:43 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-18  9:21 [PATCH 0/2] jbd2: Fix leaked transaction credits Jan Kara
2020-05-18  9:21 ` [PATCH 1/2] ext4: Drop ext4_journal_free_reserved() Jan Kara
2020-05-19  1:55   ` Andreas Dilger
2020-05-18  9:21 ` [PATCH 2/2] jbd2: Avoid leaking transaction credits when unreserving handle Jan Kara
2020-05-20  0:44   ` Andreas Dilger
2020-05-20 13:27     ` Jan Kara
2020-05-22  0:12   ` Sasha Levin
2020-05-20 13:31 [PATCH 0/2 v2] jbd2: Fix leaked transaction credits Jan Kara
2020-05-20 13:31 ` [PATCH 1/2] ext4: Drop ext4_journal_free_reserved() Jan Kara
2020-05-20 19:29   ` Andreas Dilger
2020-05-29  2:43     ` Theodore Y. Ts'o

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.