Linux EXT4 FS development
 help / color / mirror / Atom feed
From: Muhammad Umer <mumer.mobi@gmail.com>
To: linux-ext4@vger.kernel.org
Cc: tytso@mit.edu, adilger.kernel@dilger.ca,
	libaokun@linux.alibaba.com, jack@suse.cz, ojaswin@linux.ibm.com,
	ritesh.list@gmail.com, yi.zhang@huawei.com,
	Muhammad Umer <mumer.mobi@gmail.com>
Subject: [PATCH 0/2] ext4: fix goal trimming in CR_BEST_AVAIL_LEN
Date: Sun, 22 Nov 2026 13:56:28 -0500	[thread overview]
Message-ID: <20261122185630.2112-1-mumer.mobi@gmail.com> (raw)

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
-- 
2.53.0


             reply	other threads:[~2026-11-22 18:57 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-22 18:56 Muhammad Umer [this message]
2026-11-22 18:56 ` [PATCH 1/2] ext4: scan all groups before trimming the goal in CR_BEST_AVAIL_LEN Muhammad Umer
2026-11-22 18:56 ` [PATCH 2/2] ext4: fix off-by-one in CR_BEST_AVAIL_LEN min_order Muhammad Umer
2026-11-22 19:01 ` [PATCH 0/2] ext4: fix goal trimming in CR_BEST_AVAIL_LEN sashiko-bot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261122185630.2112-1-mumer.mobi@gmail.com \
    --to=mumer.mobi@gmail.com \
    --cc=adilger.kernel@dilger.ca \
    --cc=jack@suse.cz \
    --cc=libaokun@linux.alibaba.com \
    --cc=linux-ext4@vger.kernel.org \
    --cc=ojaswin@linux.ibm.com \
    --cc=ritesh.list@gmail.com \
    --cc=tytso@mit.edu \
    --cc=yi.zhang@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox