All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/5 v3] ext4: Fix performance regression with mballoc
@ 2022-09-08  9:21 Jan Kara
  2022-09-08  9:21 ` [PATCH 1/5] ext4: Make mballoc try target group first even with mb_optimize_scan Jan Kara
                   ` (5 more replies)
  0 siblings, 6 replies; 18+ messages in thread
From: Jan Kara @ 2022-09-08  9:21 UTC (permalink / raw)
  To: Ted Tso
  Cc: linux-ext4, Thorsten Leemhuis, Ojaswin Mujoo, Stefan Wahren,
	Harshad Shirwadkar, Jan Kara

Hello,

Here is the third version of my mballoc improvements to avoid spreading
allocations with mb_optimize_scan=1. Since v2 there are only small changes and
fixes found during review and testing. Overall the series looks mostly ready to
go, I just didn't see any comments regarding patch 3 - a fix of metabg handling
in the Orlov allocator which is kind of independent, I've just found it when
reading the code. Also patch 5 needs final review after all the fixes.

Changes since v1:
- reworked data structure for CR 1 scan
- make small closed files use locality group preallocation
- fix metabg handling in the Orlov allocator

Changes since v2:
- whitespace fixes
- fix outdated comment
- fix handling of mb_structs_summary procfs file
- fix bad unlock on error recovery path

Original cover letter:

The patches fix the performance regression I was able to reproduce with reaim
on my test machine:

                     mb_optimize_scan=0     mb_optimize_scan=1     patched
Hmean     disk-1       2076.12 (   0.00%)     2099.37 (   1.12%)     2032.52 (  -2.10%)
Hmean     disk-41     92481.20 (   0.00%)    83787.47 *  -9.40%*    90308.37 (  -2.35%)
Hmean     disk-81    155073.39 (   0.00%)   135527.05 * -12.60%*   154285.71 (  -0.51%)
Hmean     disk-121   185109.64 (   0.00%)   166284.93 * -10.17%*   185298.62 (   0.10%)
Hmean     disk-161   229890.53 (   0.00%)   207563.39 *  -9.71%*   232883.32 *   1.30%*
Hmean     disk-201   223333.33 (   0.00%)   203235.59 *  -9.00%*   221446.93 (  -0.84%)
Hmean     disk-241   235735.25 (   0.00%)   217705.51 *  -7.65%*   239483.27 *   1.59%*
Hmean     disk-281   266772.15 (   0.00%)   241132.72 *  -9.61%*   263108.62 (  -1.37%)
Hmean     disk-321   265435.50 (   0.00%)   245412.84 *  -7.54%*   267277.27 (   0.69%)

The changes also significanly reduce spreading of allocations for small /
moderately sized files. I'm not able to measure a performance difference
resulting from this but on eMMC storage this seems to be the main culprit
of reduced performance. Untarring of raspberry-pi archive touches following
numbers of groups:

	mb_optimize_scan=0	mb_optimize_scan=1	patched
groups	4			22			7

To achieve this I have added two more changes on top of v1 - patches 4 and 5.
Patch 4 makes sure we use locality group preallocation even for files that are
not likely to grow anymore (previously we have disabled all preallocations for
such files, however locality group preallocation still makes a lot of sense for
such files). This patch reduced spread of a small file allocations but larger
file allocations were still spread significantly because they avoid locality
group preallocation and as they are not power-of-two in size, they also
immediately start with cr=1 scan. To address that I've changed the data
structure for looking up the best block group to allocate from (see patch 5
for details).

								Honza
Previous versions:
Link: http://lore.kernel.org/r/20220823134508.27854-1-jack@suse.cz # v1
Link: http://lore.kernel.org/r/20220906150803.375-1-jack@suse.cz # v2

^ permalink raw reply	[flat|nested] 18+ messages in thread
* [PATCH 0/5 v2] ext4: Fix performance regression with mballoc
@ 2022-09-06 15:29 Jan Kara
  2022-09-06 15:29 ` [PATCH 2/5] ext4: Avoid unnecessary spreading of allocations among groups Jan Kara
  0 siblings, 1 reply; 18+ messages in thread
From: Jan Kara @ 2022-09-06 15:29 UTC (permalink / raw)
  To: Ted Tso
  Cc: linux-ext4, Thorsten Leemhuis, Ojaswin Mujoo, Stefan Wahren,
	Andreas Dilger, Jan Kara

Hello,

Here is a second version of my mballoc improvements to avoid spreading
allocations with mb_optimize_scan=1. The patches fix the performance
regression I was able to reproduce with reaim on my test machine:

                     mb_optimize_scan=0     mb_optimize_scan=1     patched
Hmean     disk-1       2076.12 (   0.00%)     2099.37 (   1.12%)     2032.52 (  -2.10%)
Hmean     disk-41     92481.20 (   0.00%)    83787.47 *  -9.40%*    90308.37 (  -2.35%)
Hmean     disk-81    155073.39 (   0.00%)   135527.05 * -12.60%*   154285.71 (  -0.51%)
Hmean     disk-121   185109.64 (   0.00%)   166284.93 * -10.17%*   185298.62 (   0.10%)
Hmean     disk-161   229890.53 (   0.00%)   207563.39 *  -9.71%*   232883.32 *   1.30%*
Hmean     disk-201   223333.33 (   0.00%)   203235.59 *  -9.00%*   221446.93 (  -0.84%)
Hmean     disk-241   235735.25 (   0.00%)   217705.51 *  -7.65%*   239483.27 *   1.59%*
Hmean     disk-281   266772.15 (   0.00%)   241132.72 *  -9.61%*   263108.62 (  -1.37%)
Hmean     disk-321   265435.50 (   0.00%)   245412.84 *  -7.54%*   267277.27 (   0.69%)

The changes also significanly reduce spreading of allocations for small /
moderately sized files. I'm not able to measure a performance difference
resulting from this but on eMMC storage this seems to be the main culprit
of reduced performance. Untarring of raspberry-pi archive touches following
numbers of groups:

	mb_optimize_scan=0	mb_optimize_scan=1	patched
groups	4			22			7

To achieve this I have added two more changes on top of v1 - patches 4 and 5.
Patch 4 makes sure we use locality group preallocation even for files that are
not likely to grow anymore (previously we have disabled all preallocations for
such files, however locality group preallocation still makes a lot of sense for
such files). This patch reduced spread of a small file allocations but larger
file allocations were still spread significantly because they avoid locality
group preallocation and as they are not power-of-two in size, they also
immediately start with cr=1 scan. To address that I've changed the data
structure for looking up the best block group to allocate from (see patch 5
for details).

Stefan, can you please test whether these patches fix the problem for you as
well? Comments & review welcome.

								Honza
Previous versions:
Link: http://lore.kernel.org/r/20220823134508.27854-1-jack@suse.cz # v1

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

end of thread, other threads:[~2022-09-26 17:56 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-08  9:21 [PATCH 0/5 v3] ext4: Fix performance regression with mballoc Jan Kara
2022-09-08  9:21 ` [PATCH 1/5] ext4: Make mballoc try target group first even with mb_optimize_scan Jan Kara
2022-09-22  2:52   ` Theodore Ts'o
2022-09-22  9:15     ` Jan Kara
2022-09-26  9:11       ` Jan Kara
2022-09-26 17:32         ` Theodore Ts'o
2022-09-08  9:21 ` [PATCH 2/5] ext4: Avoid unnecessary spreading of allocations among groups Jan Kara
2022-09-08  9:21 ` [PATCH 3/5] ext4: Make directory inode spreading reflect flexbg size Jan Kara
2022-09-08  9:21 ` [PATCH 4/5] ext4: Use locality group preallocation for small closed files Jan Kara
2022-09-08  9:21 ` [PATCH 5/5] ext4: Use buckets for cr 1 block scan instead of rbtree Jan Kara
2022-09-09  6:12   ` Ritesh Harjani (IBM)
2022-09-08 10:36 ` [PATCH 0/5 v3] ext4: Fix performance regression with mballoc Stefan Wahren
2022-09-09 10:40   ` Jan Kara
2022-09-11 12:32     ` Stefan Wahren
  -- strict thread matches above, loose matches on Subject: below --
2022-09-06 15:29 [PATCH 0/5 v2] " Jan Kara
2022-09-06 15:29 ` [PATCH 2/5] ext4: Avoid unnecessary spreading of allocations among groups Jan Kara
2022-09-07 18:05   ` Ritesh Harjani (IBM)
2022-09-08  8:57     ` Jan Kara
2022-09-08  9:24       ` Ritesh Harjani (IBM)

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.