]> git.baikalelectronics.ru Git - kernel.git/commit
ext4: place buffer head allocation before handle start
authorJinke Han <hanjinke.666@bytedance.com>
Sat, 3 Sep 2022 01:24:29 +0000 (09:24 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 26 Oct 2022 11:22:18 +0000 (13:22 +0200)
commitdf9c8047dc77873aa1f91d806479558bdb988dec
treed1998c9318fe31d94b146ff0a55ebea877160d78
parent14f5f623ca22705dce1c18463dbc7d9d501e7937
ext4: place buffer head allocation before handle start

commit cc0c2c083f973414380bd4c3c1f1ad913ba637ff upstream.

In our product environment, we encounter some jbd hung waiting handles to
stop while several writters were doing memory reclaim for buffer head
allocation in delay alloc write path. Ext4 do buffer head allocation with
holding transaction handle which may be blocked too long if the reclaim
works not so smooth. According to our bcc trace, the reclaim time in
buffer head allocation can reach 258s and the jbd transaction commit also
take almost the same time meanwhile. Except for these extreme cases,
we often see several seconds delays for cgroup memory reclaim on our
servers. This is more likely to happen considering docker environment.

One thing to note, the allocation of buffer heads is as often as page
allocation or more often when blocksize less than page size. Just like
page cache allocation, we should also place the buffer head allocation
before startting the handle.

Cc: stable@kernel.org
Signed-off-by: Jinke Han <hanjinke.666@bytedance.com>
Link: https://lore.kernel.org/r/20220903012429.22555-1-hanjinke.666@bytedance.com
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/ext4/inode.c