Skip to content

ext4: fix goal trimming in CR_BEST_AVAIL_LEN

Muhammad Umer linux-ext4 1 version New

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest2 patches 0 repliesNew

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2ext4: scan all groups before trimming the goal in CR_BEST_AVAIL_LENfs/ext4/mballoc.c+10 -60 replies
2/2ext4: fix off-by-one in CR_BEST_AVAIL_LEN min_orderfs/ext4/mballoc.c+1 -10 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/2] ext4: fix goal trimming in CR_BEST_AVAIL_LEN

Two issues in ext4_mb_scan_groups_best_avail() that make mballoc trim allocations more than needed or skip CR_BEST_AVAIL_LEN entirely.

1/2: groups below the scan start are only searched after the goal has
been trimmed to min_order. Regression from a3ce570a5d6a (v6.17).
2/2: min_order is one order too high for power-of-two requests, so they
fall through to CR_GOAL_LEN_SLOW. Present since 7e170922f06b.

Both reproduce on 6.18.44, 7.1.5 and 7.2.15. The two fixes were tested together on 7.2.15. Reproducers (loop device, run as root, read the ext4_mballoc_alloc tracepoint):

https://github.com/mumer2834/ext4-best-avail-repro

Patch 1 only changes the order in which CR_BEST_AVAIL_LEN visits groups; CR_POWER2_ALIGNED and CR_GOAL_LEN_FAST keep the linear-like traversal from a3ce570a5d6a. I have not measured multi-writer contention with this change.

Muhammad Umer (2):
ext4: scan all groups before trimming the goal in CR_BEST_AVAIL_LEN
ext4: fix off-by-one in CR_BEST_AVAIL_LEN min_order

 fs/ext4/mballoc.c | 18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)

base-commit: 4843f6873f7c4835e62f2c73ba0fd538e57a2f22

Signature · 1 line
2.53.0