From: Ritesh Harjani (IBM) <ritesh.list@gmail.com>
To: Andreas Dilger <adilger@dilger.ca>,
Ojaswin Mujoo <ojaswin@linux.ibm.com>
Cc: Baolin Liu <liubaolin12138@163.com>,
tytso@mit.edu, wangguanyu@vivo.com, yi.zhang@huaweicloud.com,
linux-ext4@vger.kernel.org, linux-kernel@vger.kernel.org,
Baolin Liu <liubaolin@kylinos.cn>
Subject: Re: [PATCH v2 v2 2/2] ext4: allow clearing mballoc stats through mb_stats
Date: Tue, 21 Apr 2026 09:10:35 +0530 [thread overview]
Message-ID: <7bq1t1zg.ritesh.list@gmail.com> (raw)
In-Reply-To: <4A904858-8611-42BC-B1BD-9679F284F8EE@dilger.ca>
Andreas Dilger <adilger@dilger.ca> writes:
> On Apr 20, 2026, at 03:12, Ojaswin Mujoo <ojaswin@linux.ibm.com> wrote:
>>
>> On Sun, Apr 19, 2026 at 02:34:36PM +0800, Baolin Liu wrote:
>>> From: Baolin Liu <liubaolin@kylinos.cn>
>>>
>>> Make /proc/fs/ext4/<dev>/mb_stats writable and clear the runtime
>>> mballoc statistics when 0 is written.
>>>
>>> Signed-off-by: Baolin Liu <liubaolin@kylinos.cn>
>>> ---
>> Hi Baolin, thanks for the changes.
>>
>> Seems like userspace doesn't have any way to know that writing 0 will
>> clear the that. Well, I guess if you are looking at this file you are
>> anyways debugging kernel code so that should be fine
>
> That could be documented in Documentation/filesystems/ext4/allocators.rst,
> or better would be to add a new file that covers mballoc in more detail.
>
I started looking for ext4's control knobs for sys-admins in kernel
Documentation where we should ideally document this, and I see those
are declared here..
Documentation/admin-guide/ext4.rst
Documentation/ABI/testing/sysfs-fs-ext4.rst
Looking at this and the relevant code, I see all /proc/ entries in ext4
are all readable and sysfs entries for ext4 are mostly the control knobs
which are declared in above admin guide.
But now this patch adds a control knob to /proc/fs/ext4/<dev>/mb_stats,
to clear the stats :).
I guess we could have simply documented a new control knob value (e.g.
"2") for clearing the stats via /sys/fs/ext4/<dev>/mb_stats itself or
maybe even having mb_stats_clear file in sysfs wasn't bad either... But
either ways, clearing the stats via the same procfs mb_stats file is not
totally bad and I don't have a strong preference.
For documenting this, we can add mb_stats entry under /proc section in
Documentation/admin-guide/ext4.rst and document this change. Something
like -
mb_stats
reports runtime statistics from multiblock allocator (mballoc),
including allocation request counts, groups scanned,
per-criteria scan hits (cr_p2_aligned, cr_goal_fast,
cr_best_avail, cr_goal_slow, cr_any_free), groups / extents
scanned, goal hits, buddy bitmap generations, and preallocation
usage etc.
Writing 0 to this procfs file resets all counters to zero.
-ritesh
next prev parent reply other threads:[~2026-04-21 4:19 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-19 6:34 [PATCH v2 v2 0/2] add blocks_allocated to mb_stats and clear mb_stats Baolin Liu
2026-04-19 6:34 ` [PATCH v2 v2 1/2] ext4: add blocks_allocated to mb_stats output Baolin Liu
2026-04-19 9:19 ` Andreas Dilger
2026-04-20 9:13 ` Ojaswin Mujoo
2026-04-19 6:34 ` [PATCH v2 v2 2/2] ext4: allow clearing mballoc stats through mb_stats Baolin Liu
2026-04-19 9:23 ` Andreas Dilger
2026-04-20 9:12 ` Ojaswin Mujoo
2026-04-20 18:28 ` Andreas Dilger
2026-04-21 3:40 ` Ritesh Harjani [this message]
2026-04-21 5:22 ` liubaolin
2026-04-21 6:12 ` Ojaswin Mujoo
2026-04-21 7:07 ` liubaolin
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=7bq1t1zg.ritesh.list@gmail.com \
--to=ritesh.list@gmail.com \
--cc=adilger@dilger.ca \
--cc=linux-ext4@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=liubaolin12138@163.com \
--cc=liubaolin@kylinos.cn \
--cc=ojaswin@linux.ibm.com \
--cc=tytso@mit.edu \
--cc=wangguanyu@vivo.com \
--cc=yi.zhang@huaweicloud.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 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.